Latex Links of Interest

Latex Tips

  1. Getting started: A latex template
  2. Perpendicular symbol
  3. Color in latex
  4. Active web links in pdf files
  5. Latex users' manual sample files
  6. Drawing figures for Latex using the picture environment
  7. Drawing figures for Latex using metapost
  8. Incorporating PostScript files and adding math/greek
  9. Fix xdvi font problem
  1. How do I get started in Latex? Use this template.

  2. How do I get a "perpendicular" symbol in Latex? Put this before the \begin{document} command, to activate "\independent".
  3. How do I use color in Latex? Before your \begin{document} command include these lines in your .tex file:
         \input colordvi
         \def\Red#1{\Color{0 0.70 0.70 0.2}{#1}}
         \def\Green#1{\Color{0.70 0 0.5 0.2}{#1}}
         \def\Blue#1{\Color{0.70 0 0 0.2}{#1}}
    Then, anywhere in your document, use e.g. Her eyes were \Green{hazel}.
    You can create any colors you like by specifying the relative proportions of cyan, yellow, magenta, and black, as in the examples. Note that our xdvi previewer does not show the colors, but they will be in the postscript file and will be seen with both ghostview and on a color printer.

  4. How do I get active web links in a pdf document? A sample tex file is pdfurl.tex. The pdf file produced is pdfurl.pdf.

  5. Where are the sample files for the Latex users' manual? Look in /usr/statlocal/teTeX/share/texmf/tex/latex/localstyles/

  6. How do I draw figures in Latex using the picture environment? The file DAG.tex shows an example of drawing a DAG.

  7. How do I draw figures in Latex using metapost? Metapost is a powerful drawing/programming language that creates Latex compatable files. The manual is at A great set of examples is And an excellent tutorial is (An alternative to metapost is Asymptote.)

    And here is a full example:

  8. How do I use postscript files in my Latex documents? How do I get Greek or math for the embedded postscript files? To incorporate a postscript file, add the line \usepackage{graphicx} below your \documentclass line in your .tex file. Then use either of these forms in your document to incorporate
        \caption{\label{fig:xxx} The caption}
    You can change the width, height and angle as needed.

    If you want to incorporate Latex math or greek into a postscript file, created in S or xfig, you can use "psfrag" to change codes, e.g. "xyz" or "frac0.5" into Latex expressions such as "\alpha+\beta=\gamma^2" or "\frac{1}{2}". (For R, use the plotmath() function.)

    First add the line \usepackage{psfrag} below your \documentclass line in your .tex file. Then add lines such as

    \psfrag{xyz}{\Large $\alpha+\beta=\gamma^2}$}
    to your latex file just above the \includegraphics line.

    The "fragments" that are to be replaced (e.g. xyz or frac0.5) must be placed in the postscript file (e.g. as separate items. For plots produced in S, this means a separate text("xyz") command. For figures produced with xfig, this means a separate use of the "text" command.

    Now just run latex and dvips. The psfrag procedure doesn't work correctly on your .dvi file, but when you use dvips to create a .ps file, the substitutions will appear in the .ps file (when printed or when viewed with ghostview).

  9. Is xdvi wasting time recreating fonts? Tom Nichols says:
    With the new LaTeX (and maybe only with LaTeX 2.09 documents) if xdvi doesn't have a font it builds it (creating many screens full of crap) and tries to save it in /usr/statlocal somewhere. But unless you're on Tedium, /usr/statlocal is a read-only disk, so each time you run xdvi you get the same annoying crap... the solution of course is just to slogin to tedium, fire up xdvi the one time and then continue on your own machine.

All links active 8/2/2005. Please report missing links to

Up Back to my Home Page