My LaTeX Notes


There are many, many latex packages available on the web. If you're looking for a way to do something in latex, chances are you can find the package at or a mirror site.


To see if a latex package is installed on your system, look for <package name>.sty. Oftentimes there is a corresponding DVI documentation file; look for <package name>.dvi or <package name>.dvi.gz.


enumerate   [example]
Allows for different numbering styles for enumerated lists. The style is specified as an optional argument to the enumerate command.

longtable   [example]
Does page breaking for tables that span more than one page. Syntax is similar to regular tables except that you also specify a header and a footer for each page.

pseudocode   [example]
For displaying formatted pseudocode. I modified the pseudocode style file to give it a format that I found to be better. You can get this file from here.

Provides the commands sidewaysfigure and sidewaystable which work the same as figure and table respectively except that they print the figure/table in landscape rather than portrait mode. Note that the captions won't show up rotated in the DVI file but will in the postscript file.

Provides the command subfigure which can be used within the figure environment.

Performs appropriate line breaking for urls. Doesn't always work great, but does a pretty decent job.


xspace   [example]
Use at the end of a macro. It adds a space unless the macro is followed by specific punctuation characters.


Defining a command:

A latex command can be defined as follows:

\newcommand{\<name of command>}{<body>}

For example,

    \newcommand{\twok}{$2k \times 2k$\xspace}

See above for explanation of xspace. Or

Using a command:

To use a command that you defined, just type

\<name of command>

within the text. For example,

        for the \twok experiments.  We also found that the

You can also have arguments in your commands like a function. You specify the number of arguments as an optional argument to \newcommand. You can then access them using #<arg_num>. For example,


You can also have one optional argument. To specify, use the second optional argument to \newcommand. This also allows you to specify the default value of the optional argument. For example,


The first argument (i.e. #1) will be the optional argument. The required arguments follow in order.


I wrote a small package that simplifies the use of figures for me. It is available here. It provides the following commands:


\setfiguredirectory{DIRECTORY} sets the figure directory to DIRECTORY. This package will then look for all figures in DIRECTORY. The default figure directory is '.'.


\centerfig[OPT]{FILENAME}{CAPTION}{TOC CAPTION} centers a eps figure. The label for the figure will be FILENAME.

OPT is a spec string argument to epsfig. E.g. width=4in, height=5in. Note that OPT will overide the default spec string 'height=3.65in'

FILENAME is the name of the eps file without the .eps. Default is to look for the figure in the current directory unless it has been reset with \setfiguredirectory.

CAPTION is the caption for the figure.

TOC CAPTION is the caption that will be displayed in the document's table of contents


\pairfig{FILENAME1}{FILENAME2}{CAPTION}{TOC CAPTION} inserts a a pair of figures on a single page one on top of the other. The figures will have sublabels (a) and (b) respectively.

FILENAME1 is the name of the first eps file without the .eps.

FILENAME2 is the name of the second eps file without the .eps.

CAPTION, and TOC CAPTION are described in centerfig.