Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Tips on Book Creation Using LyX

Bruce Momjian

During the process of writing a book on PostgreSQL, I learned number of tricks. I required output of both HTML and PDF formats. I used:

  • LyX 1.04, http://www.lyx.org
  • teTeX 0.40
  • Alladin Ghostscript 6.0 for PDF
  • Alladin Ghostscript Adobe-35 fontset
  • Bitstream 500 fontset
  • Latex2html 98.1p1

Tips for LyX

  • Read all the documentation under the Help menu.
  • I modified LYX to allow word-wrap of of multi-word typewriter text. Patch sent to maintainers, available on request.

Tips for TeTeX

  • Use the vruler package from http://www.ctan.org for numbers in the margins.
  • Use the hyphenat package from http://www.ctan.org with the htt option to allow word-wraping in typewriter font.
  • I use hyperref to generate PDF bookmarks and links.
  • Use \interfootnotelinepenalty=300 to keep footnotes from splitting across pages.
  • Add your Latex configurations to your LaTeX preamble in LyX.
  • Read dvips.dvi to see how fonts are installed in TeX. I generated my own tfm and vf files for my fonts because the encoding of the TeX-supplied fonts do not match the fonts I have. This is seen in certain PDF viewers, like Adobe Acrobat, which can't render ligatures, like fi and fl, and special symbols. I had trouble generating proper smallcaps, but finally figured it out. I have a script for this at the end of this paper.
  • You will need to define any new fonts in the nfss font system for seen by TeX.
  • Any additions to the TeX directory tree requires texhash to be run.

Tips for Ghostscript and PDF

  • PDF files contain fonts embedded in the PDF file. There are two types of fonts in PDF files, Postscript Type 1 and Type 3. Type 1 fonts are outline, curved fonts, that look good on screen and in print. They scale to any size. Type 3 fonts are bitmap fonts that look fine on paper, but don't look good on screen. They look bad in gv, ghostview, and xpdf, and terrible in Adobe Acrobat.
  • Ghostscript 5.50 and earlier could render Type 1 fonts in PDF only for the standard 35 Adobe fonts. Non-standard fonts are rendered as Type 3 fonts. It also only worked for Latin1 encoding. Newer Ghostscript versions do not have this limitation.
  • When testing PDF files, start Acrobat, and choose File/Document Info/Fonts. Then choose List all Fonts. That will show the type of fonts in your document. I only have one Type 3 font called A with encoding Custom, which represent bullets. All the rest are Type 1.
  • Alladin has a nice set of the 35 standard Adobe fonts. However, the encoding does not match the standard encoding defined in the TeX tfm/vf files, so you will need to generate new files for these fonts.

Tips for LaTex2html

  • Disable image sharing with -reuse 0 or set REUSE=0 in latex2html.config. Image sharing is broken for my uses. It thinks certain figures are the same, when the are different.
  • I used \begin...\end and htmlonly in the title page to control that LaTeX sees and what latex2html sees.

Recommended books for LaTeX fine-tuning

  • Lamport, Leslie LaTeX: A Document Preparation System, Addison-Wesley
  • Goosens, Mittelback, Samarin LaTeX Companion, Addison-Wesley
  • Knuth, Donald The TeX Book, Addision-Wesley

New TeX fonts

Here is the script I use to install new TeX fonts:
:
[ "$#" -eq 0 ] && echo "Usage:  $0 [-n] afm ..." 1>&2 && exit 1

# This uses LY1 encoding from http://www.yandy.com/usely1.htm

trap "rm -fr /tmp/$$ /tmp/$$a" 0 1 2 3 15
#set -x

mkdir /tmp/$$

for FILE
do
        # Remove a__ for Bitstream
        BASE="`filebaseonly $FILE | sed 's/[a-z]___$//g' | sed 's/___$//g'`"
        BASEFILE="`filebaseonly $FILE`"

# non-smallcaps

        afm2tfm "$FILE" -v /tmp/$$/"$BASE" \
        -T /usr/tex/dvips/base/texnansx.enc /tmp/$$/r"$BASE" | tee /tmp/$$a

        vptovf /tmp/$$/"$BASE".vpl /tmp/$$/"$BASE".vf /tmp/$$/"$BASE".tfm

        FONT="`head -1 /tmp/$$a | sed 's/^r//g' | sed 's/texnansx/texnansi/g'`"
        FONT2="`echo $FONT | awk '{print $1, $2}'`"
        FONTSC="r`echo $FONT | sed 's/ /sc /'`"
        FONTSC2="`echo $FONTSC | awk '{print $1, $2}'`"

# do smallcaps

        afm2tfm "$FILE" -V /tmp/$$/"$sc" \
        -T /usr/tex/dvips/base/texnansx.enc /tmp/$$/"r$sc" | tee /tmp/$$a

        vptovf /tmp/$$/"$sc".vpl /tmp/$$/"$sc".vf /tmp/$$/"$sc".tfm


        cp /tmp/$$/*.tfm /usr/contrib/teTeX/texmf/fonts/tfm/local

        cp /tmp/$$/*.vf /usr/contrib/teTeX/texmf/fonts/vf/local

        rm /tmp/$$/*

        pipe grep -v "^$FONT2$" /usr/contrib/teTeX/texmf/fontname/local.map
        echo "$FONT2" >> /usr/contrib/teTeX/texmf/fontname/local.map
        pipe grep -v "^$FONTSC2$" /usr/contrib/teTeX/texmf/fontname/local.map
        echo "$FONTSC2" >> /usr/contrib/teTeX/texmf/fontname/local.map

        pipe grep -v "^$FONT " /usr/contrib/teTeX/texmf/dvips/misc/psfonts.map
        echo "$FONT" "<$BASEFILE.pfb" >>/usr/contrib/teTeX/texmf/dvips/misc/psfonts.map
        pipe grep -v "^$FONTSC " /usr/contrib/teTeX/texmf/dvips/misc/psfonts.map
        echo "$FONTSC" "<$BASEFILE.pfb" >>/usr/contrib/teTeX/texmf/dvips/misc/psfonts.map

done
texhash

Privacy Policy | Project hosted by our server sponsors. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group