formatting.xml

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE section PUBLIC "-//OASIS//DTD DocBook XML V4.4//EN"
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">

<section>
  <title>Correcting Poor Formatting</title>

  <para>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.</para>

  <tip>
    <para>Adjustments to formatting are best done late in the
    production process so that subsequent changes to content do not
    produce new problems.</para>
  </tip>

  <para>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 <xref
  linkend="sec-custom"/> chapter and the <xref linkend="sec-params"/>
  and <xref linkend="sec-pis"/> 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.</para>

  <section>
    <title>Floats</title>
    
    <para>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.</para>

    <para>One direct approach is to use the <quote>informal</quote>
    versions of the affected DocBook elements.  E.g. use
    <sgmltag>informaltable</sgmltag> instead of
    <sgmltag>table</sgmltag>.  The <quote>informal</quote> elements do
    not float.  Bear in mind though that <quote>informal</quote>
    elements do not appear in the table of contents.</para>
    
    <para>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:</para>

    <itemizedlist>
    <listitem><para>In a specific element, use the
    <sgmltag>floatstyle</sgmltag> attribute to
    specify the latex float placement policy. For example
    <literal>'[H]'</literal> tries to place the element where it is
    declared.</para></listitem>

    <listitem><para>Use the parameter
    <literal><replaceable>element</replaceable>.defaut.position</literal>
    to specify globaly the placement policy for this element.</para>
    </listitem>
    </itemizedlist>

    <para>Look at page <xref xrefstyle="template:%p"
    linkend="float-placement-choices"/> for more details
    about the meaning of the placement choice letters.</para>
  </section>

  <section>
    <title>Tables</title>

    <para>Placement problems with tables relate to their
    classification as a float.  For resolution regarding these issues
    see the section on floats above.</para>

    <para>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 <package>longtable</package> environment.  Among the
    available controls are: use of a <sgmltag>informaltable</sgmltag>
    element in place of a <sgmltag>table</sgmltag> element, the
    <sgmltag>table</sgmltag> element's <sgmltag>tabstyle</sgmltag>
    attribute, the <parameter>table.default.tabstyle</parameter> parameter,
    the <parameter>table.in.float</parameter> parameter<!--, and the <xref
    linkend="dblatex_table-in-float"/> PI-->.</para>

    <para>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.</para>

    <para><?latex-block sloppy="1"?>Better vertical placement of
    table horizontal rules can be obtained by providing values for
    the <parameter>newtbl.format.thead</parameter> and
    <parameter>newtbl.format.tbody</parameter> parameters.  Depending on the
    font in use, a value like
    <literal>\rule{0pt}{2.6ex}\rule[-0.9ex]{0pt}{0pt}</literal> can be
    used for both parameters.  This inserts a
    <wordasword>strut</wordasword>, a 0 width character, in each row
    of the table which <quote>pushes</quote> the horizontal rules
    upwards and downwards to provide adequate vertical spacing.</para>
  </section>

  <section>
    <title>Examples</title>

    <para>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.</para>

    <para>To avoid an example floating and to allow it cover several
    pages, set the parameter <parameter>example.float.type</parameter>
    to <literal>none</literal>.</para>
  </section>

  <section>
    <title>Hyphenation and over-long lines</title>

    <para>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 <quote>overfull hbox</quote>.</para>

    <para>The <parameter>hyphenation.format</parameter> parameter can
    be helpful to flag some formats for more agressive
    hyphenation.</para>

    <para>Various adjustments can be made with the
    <sgmltag class="xmlpi">latex</sgmltag> 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
    <quote>soft hyphens</quote> into words in your DocBook source
    using the <xref linkend="pi-latex"/> processing instruction.  This is
    described in the <xref linkend="sec-safe-latex"/> section.</para>

    <para>To educate LaTeX as to how to hyphenate your special
    vocabulary a custom LaTeX style is required.  Setting this up is
    described in the <xref linkend="sec-custom-latex"/> section.  The
    LaTeX command to use is <code>\hyphenation</code>.  For example
    <code>\hyphenation{PostgreSQL trans-mog-re-fi-ca-tion}</code>
    tells LaTeX that <wordasword>PostgreSQL</wordasword> should not be
    hyphenated and where to hyphenate
    <wordasword>transmogrification</wordasword>.</para>

    <para>Finally, long URLs can cause over-long lines.  Especially in
    footnotes.  Using the LaTeX <package>breakurl</package> package is
    one way to solve this.  This can be done with a custom latex
    stylesheet.  See <xref linkend="sec-custom-latex"/>.</para>
  </section>

  <!-- latex-block not yet provided
  <section>
    <title>Paragraphs, Lines, and Sentences</title>

    <para>Widows and orphans, single (or too few) lines at the top and
    bottom of pages, can be controlled with the <xref
    linkend="latex-block"/> processing instruction.</para>

    <para>Lines can grow longer than their normal right-hand boundary.
    This is generally due to problems with hyphenation.  Hyphenation
    problems can arise in various ways, e.g. the introduction of
    hyperlinks which do not hyphenate.  Sometimes hyphenation cannot
    or should not be changed.  In these situations the <xref
    linkend="latex-block"/> processing instruction can be used to
    prevent poorly formatted lines.  It provides controls which
    affect, among other things, the placement of line breaks.</para>

    <para>The <xref linkend="latex.frenchspacing"/> parameter controls
    spacing between sentences.  A <quote>safe</quote> <xref
    linkend="latex"/> processing instruction
    <parameter>content</parameter> value can, in some cases, provide
    control over individual instances of this.</para>
  </section>
  -->

  <section>
    <title>Characters and Manual Spacing</title>

    <para>The <sgmltag class="xmlpi">latex</sgmltag> processing instruction
    may be used to limit character kerning, the joining of pairs of
    characters.</para>

    <para>The following DocBook entity declarations can be useful to
    control spacing. These may be declared in your DocBook
    <code>DTD</code> within the trailing pair of square braces
    (<literal>[]</literal>) or elsewhere.  Once declared the entities
    may be used in your document text.  E.g.
    <literal>Von&amp;nbsp;Trapp</literal> puts a non-breaking space
    between <literal>Von</literal> and <literal>Trapp</literal>,
    ensuring that these two words will not appear on separate
    lines.</para>

    <programlisting>
  &lt;!ENTITY nbsp  "&amp;#x000A0;" &gt;
  &lt;!ENTITY ensp  "&amp;#x02002;" &gt;
  &lt;!ENTITY emsp  "&amp;#x02003;" &gt;
    </programlisting>
  </section>
</section>