LaTeX does not invariably produce good looking output. To remedy this it can sometimes be useful to guide LaTeX in the formatting of individual characters, words, sentences, and pages. It is best to adjust with caution, making adjustments only to fix specific problems and limiting adjustments to the affected area.
Adjustments to formatting are best done late in the production process so that subsequent changes to content do not produce new problems.
This section provides an overview of common problems and summarizes methods which may be used to resolve issues related to formatting. Much more detail can be found in the Chapter 4, Customization chapter and the Appendix A, Dblatex XSL Parameter Reference and Appendix B, Dblatex Processing Instruction Reference appendixes. Be sure to look through these, especially the appendixes, to see whether there is an adjustment which will solve your particular problem. Of course the DocBook documentation should also be consulted to see if a DocBook attribute can be used to adjust document presentation.
Floats are figures, tables, examples, images, and so forth which do not necessarily appear in the output document in the location in which they appear in the DocBook source. The placement of floats can result in visually poor or otherwise undesirable output.
One direct approach is to use the “informal”
versions of the affected DocBook elements. E.g. use
informaltable
instead of
table
. The “informal” elements do
not float. Bear in mind though that “informal”
elements do not appear in the table of contents.
The alternative to eliminating the float entirely is to make an adjustment by parameter, attributes, or processing instruction. For figure, example, and equation, you can play with these methods:
In a specific element, use the
floatstyle
attribute to
specify the latex float placement policy. For example
'[H]'
tries to place the element where it is
declared.
Use the parameter
to specify globaly the placement policy for this element.element
.defaut.position
Look at page for more details about the meaning of the placement choice letters.
Placement problems with tables relate to their classification as a float. For resolution regarding these issues see the section on floats above.
Tables exceeding the length of a page, or tables that
otherwise need to cross page boundaries, have special
requirements. They must not be floats and must be rendered using
the LaTeX longtable environment. Among the
available controls are: use of a informaltable
element in place of a table
element, the
table
element's tabstyle
attribute, the table.default.tabstyle
parameter,
the table.in.float
parameter.
It is worth mentioning that good typesetting design practice for tables generally calls for eliminating all vertical rules (the lines between columns) and most horizontal rules.
Better vertical placement of
table horizontal rules can be obtained by providing values for
the newtbl.format.thead
and
newtbl.format.tbody
parameters. Depending on the
font in use, a value like
\rule{0pt}{2.6ex}\rule[-0.9ex]{0pt}{0pt}
can be
used for both parameters. This inserts a
strut, a 0 width character, in each row
of the table which “pushes” the horizontal rules
upwards and downwards to provide adequate vertical spacing.
Placement of examples has the same issue than tables, that is, it is an element that can contain many materials and need to split over several pages. In this case it cannot be considered as a float.
To avoid an example floating and to allow it cover several
pages, set the parameter example.float.type
to none
.
LaTeX is generally very good at hyphenation, but this applies only to actual words. Technical writing may include long character sequences that are not actual words. Hyphenation failure will typically result in lines of text that flow past the expected right-hand edge of a line. In LaTeX terminology this is known as a “overfull hbox”.
The hyphenation.format
parameter can
be helpful to flag some formats for more agressive
hyphenation.
Various adjustments can be made with the
<?latex?>
processing instruction to
add raw latex directives and eliminate
overfull hboxes but it often makes sense to address hyphenation
problems directly. This can be done either on an ad-hoc basis,
telling LaTeX how to hyphenate specific occurrences of words where
a problem exists, or by telling LaTeX how to hyphenate words it
does not know. The first method is accomplished by inserting
“soft hyphens” into words in your DocBook source
using the latex processing instruction. This is
described in the the section called “Safe LaTeX Insertions” section.
To educate LaTeX as to how to hyphenate your special
vocabulary a custom LaTeX style is required. Setting this up is
described in the the section called “Customized LaTeX style” section. The
LaTeX command to use is \hyphenation
. For example
\hyphenation{PostgreSQL trans-mog-re-fi-ca-tion}
tells LaTeX that PostgreSQL should not be
hyphenated and where to hyphenate
transmogrification.
Finally, long URLs can cause over-long lines. Especially in footnotes. Using the LaTeX breakurl package is one way to solve this. This can be done with a custom latex stylesheet. See the section called “Customized LaTeX style”.
The <?latex?>
processing instruction
may be used to limit character kerning, the joining of pairs of
characters.
The following DocBook entity declarations can be useful to
control spacing. These may be declared in your DocBook
DTD
within the trailing pair of square braces
([]
) or elsewhere. Once declared the entities
may be used in your document text. E.g.
Von Trapp
puts a non-breaking space
between Von
and Trapp
,
ensuring that these two words will not appear on separate
lines.
<!ENTITY nbsp " " > <!ENTITY ensp " " > <!ENTITY emsp " " >