Chapter 5. Miscellaneous Tips

Table column width

If column width is not specified in the XML, tables will look different depending on the output format. In HTML the columns automatically adjust to fit contents, but in PDF the page width is divided evenly by the number of columns. This often wastes space in PDF tables so setting relative column widths for all tables is recommended.

In the example below, the colwidth parameter defines relative column width. Columns 1 and 2 are of equal width, each using a quarter of the page. Column 3 is twice the size and covers the remaining half of the page.

 
<table>
   <title>Title of Table Here</title>
      <tgroup cols="3" align="left" colsep="1" rowsep="1">
         <colspec colnum="1" colname="issues" colwidth="1*"/>
         <colspec colnum="2" colname="actions" colwidth="1*"/>
         <colspec colnum="3" colname="tasks" colwidth="2*"/>
        

For details see DocBook XSL: The Complete Guide.

To avoid the following error during processing of PDF files,

WARNING: table-layout="fixed" and column-width unspecified => falling back to proportional-column-width(1)

it seems necessary to add decimal values in the colwidth parameter <colspec colwidth="1.0*"/ >

See http://osdir.com/ml/fop-users-xmlgraphics.apache.org/2009-04/msg00109.html

Using CDATA for XML Code

if you find yourself with long <programlisting> or <screen> sections that contain a lot of XML code, you can wrap the whole thing in <![CDATA[ .... ]]> and the XML parser will skip it. For example:


<programlisting language="xml">
<![CDATA[
<!-- Example of an app-specific setting override -->
<opensrf.persist>
  <app_settings>
  <dbfile>/tmp/persist.db</dbfile>
  </app_settings>
</opensrf.persist>
]]&gt;
</programlisting>

It's a lot easier to add the <![CDATA[ .... ]]> wrapper than change the individual occurances of < and >.

Semantic Oriented Markup

Adopting more semantic markup gives us the ability to have more fine-grained control over the stylesheets and resulting output. Finding semantic alternatives to the <emphasis> tag is important for allowing more control over display of the content.

Here are some examples of existing DocBook tags which should be used in place of <emphasis>:

Documentation for Evergreen version 1.6
Copyright © 2010, Evergreen Community