Ancient LaTeX Tutorial

pix
Go back to home page

This page provides a progression of examples of using LaTeX for scientific typesetting. Links are provided to both downloadable and online references about LaTeX.
last modified: 08:54 PM CDT, Tue 11 Oct 2016

This page is ANCIENT. Nevertheless, below you will find an example of using LaTeX for an OU dissertation. Some OU students are still finding that useful. This page is designed for Unix/Linux users. But I have assembled some tips for people needing LaTeX on windows.

On Unix/Linux, you will need latex, pdflatex, xdvi, dvips and gv.


A first experience with LaTeX

Here we go. Download into a suitable directory (playtex might be a suitable name):

then:

latex jfm2esam.tex
latex jfm2esam.tex That's right, you really should type it twice
xdvi jfm2esam.dvi
dvips -o jfm2esam.ps jfm2esam.dvi
lpr jfm2esam.ps or preview first with gv

After looking at jfm2esam.ps (preferably at the 600 dpi resolution of a good printer) and being suitably impressed and excited, crack open jfm2esam.tex with a text editor and be suitably horrified. Does it really have to be that complicated? Well not always.

Try this for a gentler introduction. Download first.tex. Then

 latex first.tex
 latex first.tex
 xdvi first.dvi
 dvips -o first.ps first.dvi
 gv first.ps
 lpr first.ps
 pdflatex first.tex
 gv first.pdf 

Note: On some Linux systems, you may have gpdf or xpdf available for viewing pdf files. But gv, which originated as a postscript viewer, seems to have adequate pdf capabilities. ghostview has yielded to gv in recent Linux distros, with ghostview merely providing a symbolic link to gv.

Below you will find a progression of further examples that introduce the finer points of LaTeX. But first, read the manual...


Learning more about LaTeX

  • I recommend that you use gvim to view and edit the .tex files. For these examples to be highlighted correctly you will need some amendments to tex.vim, provided in my gvim tuneup.

  • Some of the best things in life are free. Not only LaTeX, but the documentation:

    • A not so Short Introduction to LaTeX2e: lshort.pdf. This document might be the only paper reference manual that you will ever need. Here is the home page of one of the authors: Tobi Oetiker.

    • Using EPS Graphics in Latex2e Documents: epslatex.pdf (86 pages) Detailed information about including encapsulated postscript figures in your LaTeX documents.

    • A Sample LaTeX Document: DuplexRef.ps (3 pages) Print this out to see a side-by-side example of the .tex file shown next to the final printed page.

    • Cambridge University Engineering Department also has a lot of good on-line help, though some of the advice is specific to their system.

  • As of March, 2005, the best book about LaTeX is (IMO):
    Guide to LaTeX, Fourth Edition Helmut Kopka and Patrick W. Daly. ISBN-13: 978-0321173850

    A worthy supplementary book to the above is: The LaTeX companion, 2nd Edition Mittelbach et al. ISBN-13: 978-0201362992

  • Latex2e help may be useful to you as an online reference, after you are familiar with LaTeX.

Bundled LaTeX examples

Below are several examples of using LaTeX. After you download thefiles.tar.gz then:

gunzip thefiles.tar.gz
tar xvf thefiles.tar
cd thefiles
cat Readme
  • texample.tar.gz Demonstrates user-defined commands, how to include graphics, and how to ultimately make either a .pdf file or a .ps file. revised February 25, 2003.

  • pdfprob.tar.gz New on August 5, 2001. Demonstrates how to overcome certain problems that arise when attempting to use epic graphics within pdflatex. A short description of the problem. Revised slightly on July 13, 2006.

  • amermeteorsoc.tar.gz Shows how to use a "style file" to make the output conform to a publications standard, in this case the preprint style of the American Meteorological Society. The use of BibTex to make bibliographies is also introduced. Revised March 1, 2006.

  • Updated December 14, 2011: oudis6.tar.gz oudis6.zip Shows how to use the style file OUdissertation6.cls to make a thesis or dissertation conforming to the standards of the University of Oklahoma's Graduate College. Loaded with examples of graphics, tables, equations, "includes" and BibTex. (Revised July 15, 2006 to avoid obsolete doublespace.sty, fix margins, and upgrade for pdflatex. Revised April 19, 2007 and November 25, 2007 and March 24, 2009 for stricter conformance with Graduate College. Dedication page procedure is simplified on April 21, 2009, and some out-of-date text is cleaned up.) In November 2011, Ben Root offered still more tweaks in revision of OUdissertation5.cls to OUdissertation6.cls

  • semex.tar.gz Shows how to use LaTeX to make big-print transparencies and how to use the "psfrag" system to annotate .eps graphics with LaTeX symbols. (Traditional transparencies offer much more resolution on the screen than does Powerpoint.) Note: this may be obsolete.

Some Tips

  • As you adapt some of these examples for your own work, you are advised to make a single directory in which to store all the .sty, .cls, .bst and .bib files that you will be reusing in various projects. I made one called mysty in my home directory and have the following line in my .bashrc on gentry.metr.ou.edu:
    TEXINPUTS=.:$HOME/mysty:/usr/share/texmf/tex//:/usr/share/texmf/tex//:
    export TEXINPUTS
    BSTINPUTS=.:$HOME/mysty:/usr/share/texmf/bibtex//
    export BSTINPUTS
    BIBINPUTS=.:$HOME/mysty:/usr/share/texmf/bibtex//
    export BIBINPUTS
    
    If your texmf directory is elsewhere (try locate texmf), you will need to alter the path accordingly.

  • One of the annoyances of LaTeX is getting the bugs out. When an error is encountered, latex will stop, showing a prompt of ? on the monitor. Note the message about the line number of the alleged error, enter X to abort latex, and then enter :linenumber in gvim (if that is the editor you are using) to lead you to the offending line. For some errors, just (continually) hitting return at the ? prompt will allow latex to complete, and then you may find where things went wrong by viewing the .dvi file.

  • I do my work with three windows open: gvim, xterm and xdvi. Use :w within gvim to write without quitting, use xterm to execute commands and see error messages, and use xdvi to view the .dvi file. Note that xdvi will automatically refresh when it is clicked to become the top window.

  • For spell checking, long ago I used:
    ispell myfile.tex
    
    ispell is smart enough to skip some, but not all, LaTeX tags and math. But now I use the spell checking features of gvim.

Links