I use LaTeX for typesetting papers. Aside from being essentially platform independent because it is widely ported, LaTeX is "text editor independent" because it uses plain ASCII text files. This makes collaborating on a LaTeX document possible even if your co-author doesn't know LaTeX and prefers to use WordPerfect, for example. ASCII text files are also likely to remain readable for longer than any proprietary or binary format, and since new releases of LaTeX are extremely infrequent, backwards and forwards compatibility are rarely a problem.
Some things are more difficult to do in LaTeX than in a WYSIWYG word processing program, but for academics its strengths in automatically generating cross references, tables of contents, and citations, and its mathematical typesetting, more than make up for other inconveniences.
Getting Started with LaTeX
LaTeX is very powerful, but you don't need to know much to get started with it. I learned the basics of LaTeX from the short introduction found in "Essential LaTeX" and "Essential Mathematical LaTeX"; MIT has a nice intro page, and here are some useful math symbols.
The bookshelf in the DECF had some LaTeX intro references in a binder. Useful reference books are Leslie Lamport's "LaTeX : a document preparation system" and Goossens et al.'s "The LaTeX Companion."
Bibtex
You will want to learn how to use bibtex, which makes it easy to automatically generate a bibliography for a particular paper from a master bibliograpy -- see for example Leslie Lamport's book (Appendix B in the 1st edition). If you use Google scholar, there is an option you can set to include a link to the bibtex for the papers it finds -- very handy! But please, clean up the bibtex you download. For example, don't include an address of New York for ACM conference papers; that's where the headquarters are, but it would confuse people to include it because the conferences are held elsewhere. Often the name of the conference or proceedings is long and redundant in the auto-generated bibtex. Add spaces between the initials of authors if two initials are listed. If you use three letter lowercase month codes, they will automatically be consistently turned into abbreviations or full month names based on the bibliography style. Make sure that letters that need to be capitalized no matter what are enclosed in curly braces, for example {GPU} or 3{D} or {V}oronoi, but don't do this just to try to put words into title-case. Use the "note" field for a url, put the url in a \url{} to make it a hyperlink in the pdf, include an "accessed on" date, and try \usepackage{url} \urlstyle{sf} in your header so that they take up less room when typeset. If only one chapter of a book is relevant, cite only that chapter, for example \cite[Chapter 3]{CLR} (apologies to Stein). And even though a citation is not a noun, and by default I think everyone should use apalike citation style, your most flexible option is to define your own macro that changes "\mylongcite{CLR} states" to either a) "Cormen et al. [1990] states" (use \shortcite) or b) "Cormen et al. [1] states" or c) "[1] states" depending on whether a) the bibliography is apalike, b) the bibliography uses numbers, or c) you need to reduce the length of your NSF grant proposal by half a page.
Figures
Another essential that is not covered in "Essential LaTeX" (or the
Lamport book) is how to
include figures. For PostScript figures in .eps or .ps format, add the line
\usepackage{epsfig}
in the preamble of your .tex file and then you can include
figures in the body using e.g.:
\begin{figure}[hbt]
\begin{center}
\psfig{file=FileName.eps,width=3.25in}
\end{center}
\caption[short TOC caption]{\em Caption to appear under the figure goes here.}
\label{ReferenceLabelHere}
\end{figure}
The \em is entirely optional and can be omitted -- I like to make my captions italic so that the reader won't confuse them with the running text. (Note that unlike italicizing with \it, emphasizing with \em will toggle between italics and non-italics when the command is nested.) The text enclosed in square brackets [] is also optional; it's a useful feature if you have an automatically generated table of contents with a list of figures and you don't want the whole verbatim caption for the figure to appear in it, but if you won't be making a table of contents omit it.
If your original figure is not postscript, the unix convert utitily (available on kepler) is useful, but it always converts to an intermediate bitmap. For graphs generated in Excel, select the graph, choose a PostScript printer, and print the graph to a file. You may need to edit the generated .prn file to delete the extra non-postscript PJL lines at the very beginning and end; you may also need to edit the bounding box info. On unix, use ps2epsi file.ps file.eps to convert from ps to eps, which calculates and adds the bounding box. (Don't use convert on Excel output because it will replace the scalable postscript commands with a low-res bitmap.)
In AutoCAD, you can create eps files using the psout command from the command line. Assuming you are using a truetype font, you need to type "textfill" and then "1" before doing this or the fonts seem to come out in a shadow sort of mode, at least in AutoCAD 2002.
If you are going to use pdflatex, convert all your figures to PDF
instead of .ps and put \usepackage{graphics} in the preamble, then don't
include the PDF extension when you include the figures such as for
test.pdf, \includegraphics{test}.
By default, the limit of the fraction of a page that can be devoted to
figures is too small. Some useful commands for the preamble:
\renewcommand{\topfraction}{0.9}% max fraction figs at top
\renewcommand{\bottomfraction}{0.9}% max fraction figs at bottom
\renewcommand{\textfraction}{0.05}% min fraction text
Here is some more advice if your figure placement misbehaves.
Comments
In addition to the built-in latex comment command %, I always define a comment command that can deal with comments spanning line breaks.
in the preamble:
\newcommand{\comment}[1]{}
usage example:
\comment{This is a comment and it won't show up in the output even if
it spans more than one line of the input file or the line breaks move around.}
You can also use conditional comments, shown here being used to allow commenting out all figures (very useful for faster previewing).
in the preamble:
\usepackage{ifthen}
\newboolean{includefigs}
\setboolean{includefigs}{true}
\newcommand{\condcomment}[2]{\ifthenelse{#1}{#2}{}}
usage example:
\condcomment{\boolean{includefigs}}{
\begin{figure}
....
\end{figure}
}
LaTeX style sheets a.k.a. classes
The .tex file you write contains the body of your document and some formatting information, but most of the formatting is defined separately in a latex class file with the suffix .cls (or the suffix .sty for the older 2.09 version of latex). If you are using a common format such as "article" your latex installation will already have the style/class installed in a common directory, probably under tex/inputs. Otherwise, you will need a definition of the latex class used. Many scientific journals provide their own LaTeX document classes. Here are some useful pointers:
For a UCB dissertation, see Paul Vojta's useful guide on Preparing Your Ph.D. Dissertation Using LaTeX, including links to the ucbthesis document class, sample files, etc.
For ASME publications, LaTeX files can be found at http://iel.ucdavis.edu/code/ASME/ (Note that the new ASME bibliography format is not a standard bibtex format so be sure to grab the .bst file so that bibtex will know how to format the bibliography. There are some bugs in here it seems such as punctuation placement being non-American -- you can always edit the generated .bbl file as a workaround.)
The SIGGRAPH document class (with minor variations) is usually what I use for a technical
paper if the conference or journal doesn't provide a LaTeX class of
its own. You can download it from http://www.siggraph.org/publications/instructions/acmsiggraph.zip.
The instructions under Preparing Your Content linked on the SIGGRAPH Author
Instructions page are helpful in explaining how to use dvips and
ps2pdf to produce good quality pdf files. Note that in general you
should include the lines
\usepackage{times} %use outline Times Roman font for regular text
in the preamble of your .tex file or the pdf file will look pretty awful on
the screen. For equations I also add
\usepackage{mathptm} %use an outline math font for most math text
to the .tex file and I used to use dvips -f -Pcmz to get all my fonts to be
happy Type 1 outline fonts (using version 6 or 6.5 of gs). The instructions
suggest using dvips -GO -Ppdf, which didn't work with
versions of gs older than 6.53 (gs -v will tell you
the version). On some platforms, the dvipdf command seems to do OK,
but see the instructions for which flags to use.
Playing well with others
To export text from Microsoft Word into latex or to paste into a text box, save as a .TXT file but choose other encoding, Western European (ISO), and check "allow character substitution" (and may then need to open in notepad and paste from there).
See also my notes on using CVS for concurrent editing of latex files.
Send
comments to
| Copyright © 2002-2011, Sara McMains |