Tips on Book Creation Using LY X

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:

Tips for LY X:

Tips for TeTeX:

Tips for Ghostscript and pdf:

Tips for LaTex2html:

Recommended books for LaTeX fine-tuning:

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


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

#set -x


mkdir /tmp/$$


for FILE


        # 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/$$/"${BASE}sc" \

        -T /usr/tex/dvips/base/texnansx.enc /tmp/$$/"r${BASE}sc" | tee /tmp/$$a


        vptovf /tmp/$$/"${BASE}sc".vpl /tmp/$$/"${BASE}sc".vf /tmp/$$/"${BASE}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/

        echo "$FONT2" >> /usr/contrib/teTeX/texmf/fontname/

        pipe grep -v "^$FONTSC2$" /usr/contrib/teTeX/texmf/fontname/

        echo "$FONTSC2" >> /usr/contrib/teTeX/texmf/fontname/


        pipe grep -v "^$FONT " /usr/contrib/teTeX/texmf/dvips/misc/

        echo "$FONT" "<$BASEFILE.pfb" >>/usr/contrib/teTeX/texmf/dvips/misc/

        pipe grep -v "^$FONTSC " /usr/contrib/teTeX/texmf/dvips/misc/

        echo "$FONTSC" "<$BASEFILE.pfb" >>/usr/contrib/teTeX/texmf/dvips/misc/



texhash Creative Commons Attribution License