| 1 |
<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
| 2 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Correcting Poor Formatting</title><link rel="stylesheet" type="text/css" href="manual.css" /><meta name="generator" content="DocBook XSL Stylesheets V1.79.1" /><link rel="home" href="index.html" title="DocBook to LaTeX Publishing" /><link rel="up" href="ch03.html" title="Chapter 3. Using dblatex" /><link rel="prev" href="sec-table.html" title="Creating Tables" /><link rel="next" href="ch03s10.html" title="Writing Mathematics" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Correcting Poor Formatting</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="sec-table.html">Prev</a> </td><th width="60%" align="center">Chapter 3. Using dblatex</th><td width="20%" align="right"> <a accesskey="n" href="ch03s10.html">Next</a></td></tr></table><hr /></div><div class="section"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="idp1412"></a>Correcting Poor Formatting</h2></div></div></div><div class="toc"><dl class="toc"><dt><span class="section"><a href="ch03s09.html#idp1421">Floats</a></span></dt><dt><span class="section"><a href="ch03s09.html#idp1442">Tables</a></span></dt><dt><span class="section"><a href="ch03s09.html#idp1460">Examples</a></span></dt><dt><span class="section"><a href="ch03s09.html#idp1466">Hyphenation and over-long lines</a></span></dt><dt><span class="section"><a href="ch03s09.html#idp1486">Characters and Manual Spacing</a></span></dt></dl></div><p>LaTeX does not invariably produce good looking output. To |
| 3 |
remedy this it can sometimes be useful to guide LaTeX in the |
| 4 |
formatting of individual characters, words, sentences, and pages. |
| 5 |
It is best to adjust with caution, making adjustments only to fix |
| 6 |
specific problems and limiting adjustments to the affected |
| 7 |
area.</p><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">Tip</h3><p>Adjustments to formatting are best done late in the |
| 8 |
production process so that subsequent changes to content do not |
| 9 |
produce new problems.</p></div><p>This section provides an overview of common problems and |
| 10 |
summarizes methods which may be used to resolve issues related to |
| 11 |
formatting. Much more detail can be found in the <a class="xref" href="sec-custom.html" title="Chapter 4. Customization">Chapter 4, <em>Customization</em></a> chapter and the <a class="xref" href="sec-params.html" title="Appendix A. Dblatex XSL Parameter Reference">Appendix A, <em>Dblatex XSL Parameter Reference</em></a> |
| 12 |
and <a class="xref" href="sec-pis.html" title="Appendix B. Dblatex Processing Instruction Reference">Appendix B, <em>Dblatex Processing Instruction Reference</em></a> appendixes. Be sure to look through |
| 13 |
these, especially the appendixes, to see whether there is an |
| 14 |
adjustment which will solve your particular problem. Of course the |
| 15 |
DocBook documentation should also be consulted to see if a DocBook |
| 16 |
attribute can be used to adjust document presentation.</p><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="idp1421"></a>Floats</h3></div></div></div><p>Floats are figures, tables, examples, images, and so forth |
| 17 |
which do not necessarily appear in the output document in the |
| 18 |
location in which they appear in the DocBook source. The |
| 19 |
placement of floats can result in visually poor or otherwise |
| 20 |
undesirable output.</p><p>One direct approach is to use the <span class="quote">“<span class="quote">informal</span>”</span> |
| 21 |
versions of the affected DocBook elements. E.g. use |
| 22 |
<code class="sgmltag-element">informaltable</code> instead of |
| 23 |
<code class="sgmltag-element">table</code>. The <span class="quote">“<span class="quote">informal</span>”</span> elements do |
| 24 |
not float. Bear in mind though that <span class="quote">“<span class="quote">informal</span>”</span> |
| 25 |
elements do not appear in the table of contents.</p><p>The alternative to eliminating the float entirely is |
| 26 |
to make an adjustment by parameter, attributes, or processing |
| 27 |
instruction. For figure, example, and equation, you can play |
| 28 |
with these methods:</p><div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem"><p>In a specific element, use the |
| 29 |
<code class="sgmltag-element">floatstyle</code> attribute to |
| 30 |
specify the latex float placement policy. For example |
| 31 |
<code class="literal">'[H]'</code> tries to place the element where it is |
| 32 |
declared.</p></li><li class="listitem"><p>Use the parameter |
| 33 |
<code class="literal"><em class="replaceable"><code>element</code></em>.defaut.position</code> |
| 34 |
to specify globaly the placement policy for this element.</p></li></ul></div><p>Look at page <a class="xref" href="table.default.position.html#float-placement-choices"></a> for more details |
| 35 |
about the meaning of the placement choice letters.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="idp1442"></a>Tables</h3></div></div></div><p>Placement problems with tables relate to their |
| 36 |
classification as a float. For resolution regarding these issues |
| 37 |
see the section on floats above.</p><p>Tables exceeding the length of a page, or tables that |
| 38 |
otherwise need to cross page boundaries, have special |
| 39 |
requirements. They must not be floats and must be rendered using |
| 40 |
the LaTeX <span class="package">longtable</span> environment. Among the |
| 41 |
available controls are: use of a <code class="sgmltag-element">informaltable</code> |
| 42 |
element in place of a <code class="sgmltag-element">table</code> element, the |
| 43 |
<code class="sgmltag-element">table</code> element's <code class="sgmltag-element">tabstyle</code> |
| 44 |
attribute, the <em class="parameter"><code>table.default.tabstyle</code></em> parameter, |
| 45 |
the <em class="parameter"><code>table.in.float</code></em> parameter.</p><p>It is worth mentioning that good typesetting design practice |
| 46 |
for tables generally calls for eliminating all vertical rules (the |
| 47 |
lines between columns) and most horizontal rules.</p><p>Better vertical placement of |
| 48 |
table horizontal rules can be obtained by providing values for |
| 49 |
the <em class="parameter"><code>newtbl.format.thead</code></em> and |
| 50 |
<em class="parameter"><code>newtbl.format.tbody</code></em> parameters. Depending on the |
| 51 |
font in use, a value like |
| 52 |
<code class="literal">\rule{0pt}{2.6ex}\rule[-0.9ex]{0pt}{0pt}</code> can be |
| 53 |
used for both parameters. This inserts a |
| 54 |
<em class="wordasword">strut</em>, a 0 width character, in each row |
| 55 |
of the table which <span class="quote">“<span class="quote">pushes</span>”</span> the horizontal rules |
| 56 |
upwards and downwards to provide adequate vertical spacing.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="idp1460"></a>Examples</h3></div></div></div><p>Placement of examples has the same issue than tables, that is, it |
| 57 |
is an element that can contain many materials and need to split over |
| 58 |
several pages. In this case it cannot be considered as a float.</p><p>To avoid an example floating and to allow it cover several |
| 59 |
pages, set the parameter <em class="parameter"><code>example.float.type</code></em> |
| 60 |
to <code class="literal">none</code>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="idp1466"></a>Hyphenation and over-long lines</h3></div></div></div><p>LaTeX is generally very good at hyphenation, but this |
| 61 |
applies only to actual words. Technical writing may include long |
| 62 |
character sequences that are not actual words. Hyphenation |
| 63 |
failure will typically result in lines of text that flow past the |
| 64 |
expected right-hand edge of a line. In LaTeX terminology this is |
| 65 |
known as a <span class="quote">“<span class="quote">overfull hbox</span>”</span>.</p><p>The <em class="parameter"><code>hyphenation.format</code></em> parameter can |
| 66 |
be helpful to flag some formats for more agressive |
| 67 |
hyphenation.</p><p>Various adjustments can be made with the |
| 68 |
<code class="sgmltag-xmlpi"><?latex?></code> processing instruction to |
| 69 |
add raw latex directives and eliminate |
| 70 |
overfull hboxes but it often makes sense to address hyphenation |
| 71 |
problems directly. This can be done either on an ad-hoc basis, |
| 72 |
telling LaTeX how to hyphenate specific occurrences of words where |
| 73 |
a problem exists, or by telling LaTeX how to hyphenate words it |
| 74 |
does not know. The first method is accomplished by inserting |
| 75 |
<span class="quote">“<span class="quote">soft hyphens</span>”</span> into words in your DocBook source |
| 76 |
using the <a class="xref" href="pi-latex.html" title="latex"><span class="refentrytitle">latex</span></a> processing instruction. This is |
| 77 |
described in the <a class="xref" href="pi-latex.html#sec-safe-latex" title="Safe LaTeX Insertions">the section called “Safe LaTeX Insertions”</a> section.</p><p>To educate LaTeX as to how to hyphenate your special |
| 78 |
vocabulary a custom LaTeX style is required. Setting this up is |
| 79 |
described in the <a class="xref" href="sec-custom-latex.html" title="Customized LaTeX style">the section called “Customized LaTeX style”</a> section. The |
| 80 |
LaTeX command to use is <code class="code">\hyphenation</code>. For example |
| 81 |
<code class="code">\hyphenation{PostgreSQL trans-mog-re-fi-ca-tion}</code> |
| 82 |
tells LaTeX that <em class="wordasword">PostgreSQL</em> should not be |
| 83 |
hyphenated and where to hyphenate |
| 84 |
<em class="wordasword">transmogrification</em>.</p><p>Finally, long URLs can cause over-long lines. Especially in |
| 85 |
footnotes. Using the LaTeX <span class="package">breakurl</span> package is |
| 86 |
one way to solve this. This can be done with a custom latex |
| 87 |
stylesheet. See <a class="xref" href="sec-custom-latex.html" title="Customized LaTeX style">the section called “Customized LaTeX style”</a>.</p></div><div class="section"><div class="titlepage"><div><div><h3 class="title"><a id="idp1486"></a>Characters and Manual Spacing</h3></div></div></div><p>The <code class="sgmltag-xmlpi"><?latex?></code> processing instruction |
| 88 |
may be used to limit character kerning, the joining of pairs of |
| 89 |
characters.</p><p>The following DocBook entity declarations can be useful to |
| 90 |
control spacing. These may be declared in your DocBook |
| 91 |
<code class="code">DTD</code> within the trailing pair of square braces |
| 92 |
(<code class="literal">[]</code>) or elsewhere. Once declared the entities |
| 93 |
may be used in your document text. E.g. |
| 94 |
<code class="literal">Von&nbsp;Trapp</code> puts a non-breaking space |
| 95 |
between <code class="literal">Von</code> and <code class="literal">Trapp</code>, |
| 96 |
ensuring that these two words will not appear on separate |
| 97 |
lines.</p><pre class="programlisting"> |
| 98 |
<!ENTITY nbsp "&#x000A0;" > |
| 99 |
<!ENTITY ensp "&#x02002;" > |
| 100 |
<!ENTITY emsp "&#x02003;" > |
| 101 |
</pre></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="sec-table.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch03.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch03s10.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Creating Tables </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Writing Mathematics</td></tr></table></div></body></html> |