Back to HOWTOs

LaTeX HOWTOs

HOWTOs

  • To add a latex package
    1. Say the package's name is foo. Make a ~/textmf/tex/latex/foo directory.
    2. Place in foo.sty in the ~/texmf/tex/latex/foo directory.
    3. For a bibtex file, place foo.bst in the ~/texmf/bibtex/bst directory.
    4. Run texhash

  • To place latex symbols in xfig
    • NOTE: This can be done much easier by using the psfrag package from CTAN. See the package documentation for details.
    1. Suppose you want to have alpha^2 in xfig. Write in the text $\alpha^2$ in xfig.
    2. Choose edit and click on the text.
    3. Change special flag to special from normal.
    4. Change pen color to default from black.
    5. Save the figure as a combined ps/latex file.
    6. Refer to the figure as *.pstex_t in your tex file.

  • To translate a PS file to a non-bitmapped PDF
    1. Make sure you're using dvips version 5.90 or greater:
      dvips file.dvi -o file.ps -t letter -Ppdf;
      ps2pdf file.ps file.pdf;

  • To merge multiple PDFs into one file
  • There's numerous tools to do this, but this is one is open source and easy to install if you have Sun's Java 1.4 (or greater) on your system and works via the command line. Download the Multivalent utility from Sourcforge. You should only need to download a single JAR file.

    Wherever you downloaded the JAR file to, simply add it to your CLASSPATH variable. For example, in ~/.cshrc add (assuming you downloaded the file to /usr/local/bin/:

    setenv CLASSPATH "${CLASSPATH}:/usr/local/bin/Multivalent20040415.jar"
    To run the merge tool, simply do:
    java tool.pdf.Merge file1.pdf file2.pdf file3.pdf
    Which will produce a file1-m.pdf file with all the specified PDF documents merged.

  • To create a PDF that passes IEEEXplore's requirements
    (PDF format >= 1.3 and all fonts embedded)
    1. Use recent version of ghostscript (e.g., AFPL 8.50)
      • NOTE: There was a parse error when I made ghostscript 8.50. To fix it, in jasper/src/libjasper/include/jasper/jas_types.h, make the following change:
        //#if defined(HAVE_STDBOOL_H)
        #if defined(SOME_UNDEFINED_VARIABLE)
        To avoid the #include command.
    2. Using dvips (version >= 5.90), do the following command:
      dvips -t letter -Ppdf -D 600 -G0 myfile.dvi
    3. If some fonts are not recognized, you may try adding the following switches to the dvips command line:
      -Pdownload35 -u ps2pk.map
    4. The ps2pdf scripts that come with ghostscript need to be modified to embed the fonts when converting to the PDF. As an example, the script the ps2pdf12 script should be:
      #!/bin/sh
      # Convert PostScript to PDF 1.2 (Acrobat 3-and-later compatible).
      exec ps2pdfwr -sPAPERSIZE=letter -dPDFSETTINGS=/printer \
      -dMaxSubsetPct=100 -dSubsetFonts=true -dEmbedAllFonts=true \
      -dCompatibilityLevel=1.2 "$@"
      For the ps2pdf13 and ps2pdf14 scripts, the -dCompatibilityLevel switch needs to be updated to 1.3 and 1.4, respectively.
    5. Generate the PDF file using the ps2pdf13 script (or a different script if a different compatibility level is desired).
    6. To check and make sure the PDF version is correct:
      • Use the command line tool, pdffonts:
        pdffonts my_file.pdf
        And verify that the emb and sub columns say yes for all the fonts listed.
      • Alternatively, in Adobe Acrobat, go to File --> Document Properties --> Summary. To check that the fonts are correct, go to File --> Document Properties --> Fonts and click List All in the dialog box. For each font listed, Type should be Type 1 and Used Font should be Embedded Subset. If the Used Font column shows up as blank for some fonts, you may need to scroll through the PDF first and then list all the fonts.
    7. URW Fonts in GhostScript
      • An email I received from Michael Shell:
        "I recommend that you use the latest URW fonts from: http://freshmeat.net/projects/urw-fonts-cyrillic if you have not installed them already. The older version that comes with GhostScript has bugs in the on-screen hinting of Palatino/Paladio. However, only IEEE Computer Society papers use Palatino. Installation is as simple as unpacking the new fonts in the GhostScript font directory (I'd backup the old ones first in case something goes wrong)."

  • Generating EPS Files With Embedded Fonts
    • In gnuplot, this can be done by setting the terminal as:
      set terminal postscript eps enhanced "NimbusSanL-Regu" fontfile "uhvr8a.pfb"
    • In xfig, I'm currently not sure how (or if it is necessary) to explicitly embed fonts.
    • If you have existing EPS files and you do not want to regenerate them with the native program, you can go through and search and replace the following strings in each EPS file (I have a perl script to do this). Each line shows the old string first (i.e., the one to be replaced) followed by the new string (i.e., the one to replace with).

      Times-Bold --> NimbusSanL-Bold
      Times-Roman --> NimbusSanL-Regu
      Times --> NimbusSanL-Regu
      Helvetica-BoldOblique --> NimbusSanL-BoldItal
      Helvetica-Oblique --> NimbusSanL-ReguItal
      Helvetica-Bold --> NimbusSanL-Bold
      Helvetica-Bold-iso --> NimbusSanL-Bold
      Helvetica --> NimbusSanL-Regu
      Helvetica-iso --> NimbusSanL-Regu
      Symbol --> StandardSymL