Once you have written out your formula in LaTeX or
TeX format, follow this procedure to prepare artwork
for inclusion in DocBook. If you use a Makefile, you can automate this procedure;
see Section 12.4, “Automating math display production with your Makefile”.
Translate the file to DVI format. For LaTeX, the command is:
latex file.tex
For TeX:
tex file.tex
For example, if your source file is eq14.tex, this will create a file named
eq14.dvi.
If there are any errors, fix them and recompile. Use xdvi or another DVI viewer to inspect the typeset output and fix any content or appearance problems.
Convert the .dvi file to
Encapsulated Postscript. To continue the example:
dvips -E eq14.dvi -o eq14.eps
The -E option forces dvips to produce EPS output, shrinking
the bounding box to include only the marks on the page.
Convert the EPS file to Encapsulated PDF. This command
will build a file named eq14.pdf
that can be included in DocBook PDF output:
epstopdf eq14.eps
Convert the Encapsulated PDF file to a grayscale
image in PGM format. The pdftoppm utility does this
conversion. Its -gray option uses
anti-aliasing to produce an image that is
considerably better-looking than a pure black and
white image. The first argument is the input file.
The second argument is the “base name”;
each page of the input file is written to a file
whose name is that base name with a suffix of the
form -, where NNNNNN.pgm is the page number.
In our case, there will be only one page.
NNNNNN
The pdftoppm program
also accepts a resolution in dots per inch, but the
default (-r 150) is reasonable.
To continue the example, this would build file
eq14-000001.pgm:
pdftoppm -gray eq14.pdf eq14
Finally, convert the .pgm file
to JPEG format using pnmtojpeg. In our example:
pnmtojpeg eq14-000001.pgm >eq14.jpg
In your DocBook source file, encode the equation like this:
<informalequation>
<mediaobject>
<imageobject role="html">
<imagedata fileref="file.jpg"/>
</imageobject>
<imageobject role="fo">
<imagedata fileref="file.pdf"/>
</imageobject>
</mediaobject>
</informalequation>
The informalequation element is
preferable to the equation element,
since it does not number the equation or give it a
title.