Blame docs/formatting.xml

Packit 0f19cf
Packit 0f19cf
Packit 0f19cf
"http://www.oasis-open.org/docbook/xml/4.4/docbookx.dtd">
Packit 0f19cf
Packit 0f19cf
<section>
Packit 0f19cf
  <title>Correcting Poor Formatting</title>
Packit 0f19cf
Packit 0f19cf
  <para>LaTeX does not invariably produce good looking output.  To
Packit 0f19cf
  remedy this it can sometimes be useful to guide LaTeX in the
Packit 0f19cf
  formatting of individual characters, words, sentences, and pages.
Packit 0f19cf
  It is best to adjust with caution, making adjustments only to fix
Packit 0f19cf
  specific problems and limiting adjustments to the affected
Packit 0f19cf
  area.</para>
Packit 0f19cf
Packit 0f19cf
  <tip>
Packit 0f19cf
    <para>Adjustments to formatting are best done late in the
Packit 0f19cf
    production process so that subsequent changes to content do not
Packit 0f19cf
    produce new problems.</para>
Packit 0f19cf
  </tip>
Packit 0f19cf
Packit 0f19cf
  <para>This section provides an overview of common problems and
Packit 0f19cf
  summarizes methods which may be used to resolve issues related to
Packit 0f19cf
  formatting.  Much more detail can be found in the 
Packit 0f19cf
  linkend="sec-custom"/> chapter and the <xref linkend="sec-params"/>
Packit 0f19cf
  and <xref linkend="sec-pis"/> appendixes.  Be sure to look through
Packit 0f19cf
  these, especially the appendixes, to see whether there is an
Packit 0f19cf
  adjustment which will solve your particular problem.  Of course the
Packit 0f19cf
  DocBook documentation should also be consulted to see if a DocBook
Packit 0f19cf
  attribute can be used to adjust document presentation.</para>
Packit 0f19cf
Packit 0f19cf
  <section>
Packit 0f19cf
    <title>Floats</title>
Packit 0f19cf
    
Packit 0f19cf
    <para>Floats are figures, tables, examples, images, and so forth
Packit 0f19cf
    which do not necessarily appear in the output document in the
Packit 0f19cf
    location in which they appear in the DocBook source.  The
Packit 0f19cf
    placement of floats can result in visually poor or otherwise
Packit 0f19cf
    undesirable output.</para>
Packit 0f19cf
Packit 0f19cf
    <para>One direct approach is to use the <quote>informal</quote>
Packit 0f19cf
    versions of the affected DocBook elements.  E.g. use
Packit 0f19cf
    <sgmltag>informaltable</sgmltag> instead of
Packit 0f19cf
    <sgmltag>table</sgmltag>.  The <quote>informal</quote> elements do
Packit 0f19cf
    not float.  Bear in mind though that <quote>informal</quote>
Packit 0f19cf
    elements do not appear in the table of contents.</para>
Packit 0f19cf
    
Packit 0f19cf
    <para>The alternative to eliminating the float entirely is
Packit 0f19cf
    to make an adjustment by parameter, attributes, or processing
Packit 0f19cf
    instruction. For figure, example, and equation, you can play
Packit 0f19cf
    with these methods:</para>
Packit 0f19cf
Packit 0f19cf
    <itemizedlist>
Packit 0f19cf
    <listitem><para>In a specific element, use the
Packit 0f19cf
    <sgmltag>floatstyle</sgmltag> attribute to
Packit 0f19cf
    specify the latex float placement policy. For example
Packit 0f19cf
    <literal>'[H]'</literal> tries to place the element where it is
Packit 0f19cf
    declared.</para></listitem>
Packit 0f19cf
Packit 0f19cf
    <listitem><para>Use the parameter
Packit 0f19cf
    <literal><replaceable>element</replaceable>.defaut.position</literal>
Packit 0f19cf
    to specify globaly the placement policy for this element.</para>
Packit 0f19cf
    </listitem>
Packit 0f19cf
    </itemizedlist>
Packit 0f19cf
Packit 0f19cf
    <para>Look at page 
Packit 0f19cf
    linkend="float-placement-choices"/> for more details
Packit 0f19cf
    about the meaning of the placement choice letters.</para>
Packit 0f19cf
  </section>
Packit 0f19cf
Packit 0f19cf
  <section>
Packit 0f19cf
    <title>Tables</title>
Packit 0f19cf
Packit 0f19cf
    <para>Placement problems with tables relate to their
Packit 0f19cf
    classification as a float.  For resolution regarding these issues
Packit 0f19cf
    see the section on floats above.</para>
Packit 0f19cf
Packit 0f19cf
    <para>Tables exceeding the length of a page, or tables that
Packit 0f19cf
    otherwise need to cross page boundaries, have special
Packit 0f19cf
    requirements.  They must not be floats and must be rendered using
Packit 0f19cf
    the LaTeX <package>longtable</package> environment.  Among the
Packit 0f19cf
    available controls are: use of a <sgmltag>informaltable</sgmltag>
Packit 0f19cf
    element in place of a <sgmltag>table</sgmltag> element, the
Packit 0f19cf
    <sgmltag>table</sgmltag> element's <sgmltag>tabstyle</sgmltag>
Packit 0f19cf
    attribute, the <parameter>table.default.tabstyle</parameter> parameter,
Packit 0f19cf
    the <parameter>table.in.float</parameter> parameter
Packit 0f19cf
    linkend="dblatex_table-in-float"/> PI-->.</para>
Packit 0f19cf
Packit 0f19cf
    <para>It is worth mentioning that good typesetting design practice
Packit 0f19cf
    for tables generally calls for eliminating all vertical rules (the
Packit 0f19cf
    lines between columns) and most horizontal rules.</para>
Packit 0f19cf
Packit 0f19cf
    <para>Better vertical placement of
Packit 0f19cf
    table horizontal rules can be obtained by providing values for
Packit 0f19cf
    the <parameter>newtbl.format.thead</parameter> and
Packit 0f19cf
    <parameter>newtbl.format.tbody</parameter> parameters.  Depending on the
Packit 0f19cf
    font in use, a value like
Packit 0f19cf
    <literal>\rule{0pt}{2.6ex}\rule[-0.9ex]{0pt}{0pt}</literal> can be
Packit 0f19cf
    used for both parameters.  This inserts a
Packit 0f19cf
    <wordasword>strut</wordasword>, a 0 width character, in each row
Packit 0f19cf
    of the table which <quote>pushes</quote> the horizontal rules
Packit 0f19cf
    upwards and downwards to provide adequate vertical spacing.</para>
Packit 0f19cf
  </section>
Packit 0f19cf
Packit 0f19cf
  <section>
Packit 0f19cf
    <title>Examples</title>
Packit 0f19cf
Packit 0f19cf
    <para>Placement of examples has the same issue than tables, that is, it
Packit 0f19cf
    is an element that can contain many materials and need to split over
Packit 0f19cf
    several pages. In this case it cannot be considered as a float.</para>
Packit 0f19cf
Packit 0f19cf
    <para>To avoid an example floating and to allow it cover several
Packit 0f19cf
    pages, set the parameter <parameter>example.float.type</parameter>
Packit 0f19cf
    to <literal>none</literal>.</para>
Packit 0f19cf
  </section>
Packit 0f19cf
Packit 0f19cf
  <section>
Packit 0f19cf
    <title>Hyphenation and over-long lines</title>
Packit 0f19cf
Packit 0f19cf
    <para>LaTeX is generally very good at hyphenation, but this
Packit 0f19cf
    applies only to actual words.  Technical writing may include long
Packit 0f19cf
    character sequences that are not actual words.  Hyphenation
Packit 0f19cf
    failure will typically result in lines of text that flow past the
Packit 0f19cf
    expected right-hand edge of a line.  In LaTeX terminology this is
Packit 0f19cf
    known as a <quote>overfull hbox</quote>.</para>
Packit 0f19cf
Packit 0f19cf
    <para>The <parameter>hyphenation.format</parameter> parameter can
Packit 0f19cf
    be helpful to flag some formats for more agressive
Packit 0f19cf
    hyphenation.</para>
Packit 0f19cf
Packit 0f19cf
    <para>Various adjustments can be made with the
Packit 0f19cf
    <sgmltag class="xmlpi">latex</sgmltag> processing instruction to
Packit 0f19cf
    add raw latex directives and eliminate
Packit 0f19cf
    overfull hboxes but it often makes sense to address hyphenation
Packit 0f19cf
    problems directly.  This can be done either on an ad-hoc basis,
Packit 0f19cf
    telling LaTeX how to hyphenate specific occurrences of words where
Packit 0f19cf
    a problem exists, or by telling LaTeX how to hyphenate words it
Packit 0f19cf
    does not know.  The first method is accomplished by inserting
Packit 0f19cf
    <quote>soft hyphens</quote> into words in your DocBook source
Packit 0f19cf
    using the <xref linkend="pi-latex"/> processing instruction.  This is
Packit 0f19cf
    described in the <xref linkend="sec-safe-latex"/> section.</para>
Packit 0f19cf
Packit 0f19cf
    <para>To educate LaTeX as to how to hyphenate your special
Packit 0f19cf
    vocabulary a custom LaTeX style is required.  Setting this up is
Packit 0f19cf
    described in the <xref linkend="sec-custom-latex"/> section.  The
Packit 0f19cf
    LaTeX command to use is \hyphenation.  For example
Packit 0f19cf
    \hyphenation{PostgreSQL trans-mog-re-fi-ca-tion}
Packit 0f19cf
    tells LaTeX that <wordasword>PostgreSQL</wordasword> should not be
Packit 0f19cf
    hyphenated and where to hyphenate
Packit 0f19cf
    <wordasword>transmogrification</wordasword>.</para>
Packit 0f19cf
Packit 0f19cf
    <para>Finally, long URLs can cause over-long lines.  Especially in
Packit 0f19cf
    footnotes.  Using the LaTeX <package>breakurl</package> package is
Packit 0f19cf
    one way to solve this.  This can be done with a custom latex
Packit 0f19cf
    stylesheet.  See <xref linkend="sec-custom-latex"/>.</para>
Packit 0f19cf
  </section>
Packit 0f19cf
Packit 0f19cf
  
Packit 0f19cf
  <section>
Packit 0f19cf
    <title>Paragraphs, Lines, and Sentences</title>
Packit 0f19cf
Packit 0f19cf
    <para>Widows and orphans, single (or too few) lines at the top and
Packit 0f19cf
    bottom of pages, can be controlled with the 
Packit 0f19cf
    linkend="latex-block"/> processing instruction.</para>
Packit 0f19cf
Packit 0f19cf
    <para>Lines can grow longer than their normal right-hand boundary.
Packit 0f19cf
    This is generally due to problems with hyphenation.  Hyphenation
Packit 0f19cf
    problems can arise in various ways, e.g. the introduction of
Packit 0f19cf
    hyperlinks which do not hyphenate.  Sometimes hyphenation cannot
Packit 0f19cf
    or should not be changed.  In these situations the 
Packit 0f19cf
    linkend="latex-block"/> processing instruction can be used to
Packit 0f19cf
    prevent poorly formatted lines.  It provides controls which
Packit 0f19cf
    affect, among other things, the placement of line breaks.</para>
Packit 0f19cf
Packit 0f19cf
    <para>The <xref linkend="latex.frenchspacing"/> parameter controls
Packit 0f19cf
    spacing between sentences.  A <quote>safe</quote> 
Packit 0f19cf
    linkend="latex"/> processing instruction
Packit 0f19cf
    <parameter>content</parameter> value can, in some cases, provide
Packit 0f19cf
    control over individual instances of this.</para>
Packit 0f19cf
  </section>
Packit 0f19cf
  -->
Packit 0f19cf
Packit 0f19cf
  <section>
Packit 0f19cf
    <title>Characters and Manual Spacing</title>
Packit 0f19cf
Packit 0f19cf
    <para>The <sgmltag class="xmlpi">latex</sgmltag> processing instruction
Packit 0f19cf
    may be used to limit character kerning, the joining of pairs of
Packit 0f19cf
    characters.</para>
Packit 0f19cf
Packit 0f19cf
    <para>The following DocBook entity declarations can be useful to
Packit 0f19cf
    control spacing. These may be declared in your DocBook
Packit 0f19cf
    DTD within the trailing pair of square braces
Packit 0f19cf
    (<literal>[]</literal>) or elsewhere.  Once declared the entities
Packit 0f19cf
    may be used in your document text.  E.g.
Packit 0f19cf
    <literal>Von&nbsp;Trapp</literal> puts a non-breaking space
Packit 0f19cf
    between <literal>Von</literal> and <literal>Trapp</literal>,
Packit 0f19cf
    ensuring that these two words will not appear on separate
Packit 0f19cf
    lines.</para>
Packit 0f19cf
Packit 0f19cf
    <programlisting>
Packit 0f19cf
  <!ENTITY nbsp  "&#x000A0;" >
Packit 0f19cf
  <!ENTITY ensp  "&#x02002;" >
Packit 0f19cf
  <!ENTITY emsp  "&#x02003;" >
Packit 0f19cf
    </programlisting>
Packit 0f19cf
  </section>
Packit 0f19cf
</section>