The MEnet L^{A}TEX FAQ

R W Kaszeta^{∗}

July 22, 1999

Contents 1 Where to find information: . . . . . . . . . . . . . . 1 2 Fixing L^{A}TEX’s defaults . . . . . . . . . . . . . . . . 1 3 Using L^{A}TEX on MEnet systems . . . . . . . . . . . 2 4 Common Mistakes to Avoid . . . . . . . . . . . . . 2 5 Formatting Math in L^{A}TEX . . . . . . . . . . . . . . 2 6 Graphics . . . . . . . . . . . . . . . . . . . . . . . . 3 7 Bibliographies . . . . . . . . . . . . . . . . . . . . . 3 8 Useful Macros and Packages . . . . . . . . . . . . . 3

Introduction

This document is provided as a collection of answers, tips, and tricks typically requested by MEnet L^{A}TEX users. For the most part, this document is sorted by topic. Before asking MEnet about any L^{A}TEX related question, please be sure to look in this document for answers to your question. For reference, the .tex version of this document is provided in

/stage/share/tex.local/samples.

1 Where to find information:

If the answer to your question isn’t here, also check the

teTeX documentation at http://www.menet.umn.edu/docs/

tex/index.html. Other good places to look are The L^{A}TEX Book and The L^{A}TEX Companion, available for loan from me, or for purchase from the bookstore.

Three useful documents are available from the MEnet web page:

• Essential Guide to LaTeX (http://www.menet.

     umn.edu/docs/tex/tetex-1.0/latex/general/
     essential.dvi)

• Not-So-Short Intro to LaTeX (http://www.menet.umn.

     edu/docs/tex/tetex-1.0/latex/general/lshort.
     dvi)

• LaTeX Command Reference (http://www.menet.

     umn.edu/docs/tex/tetex-1.0/latex/latex2e-html/
     index.html)

2 Fixing L^{A}TEX’s defaults

2.1 How do I get L^{A}TEX to use Times or other Postscript fonts?

To change L^{A}TEX to use Times for text and math, Helvetica for sans serif text, and Courier for typewriter text, simply use the pslatex package:

                                                       \usepackage{pslatex}

Similar style files are provided for other standard postscript fonts, including palatino, bookman, courier, and newcent.

2.2 How do I fix the borders?

The easiest way to accomplish with this is to use the geometry package, which allows you to easily set all four borders. As an example,

                                                             \usepackage{geometry}
                                                             \geometry{nohead, lmargin=1.5in, rmargin=1in,
                                                               tmargin=1in, bmargin=1in, footskip=24pt}

2.3 How do I fix the section headers so they aren’t so big?

This one is a little complicated, since it involved tweaking L^{A}TEX internals. Consult The L^{A}TEX Companion, or use the following code in the preamble:

                                                                     \makeatletter
                                                                     \renewcommand{\section}{\@startsection{section}{1}{0pt}{10pt}
                                                                       {0.1pt}{\bfseries}}
                                                                     \renewcommand{\subsection}{\@startsection{subsection}{1}{0pt}
                                                                       {10pt}{0.1pt}{}}
                                                                     \renewcommand{\subsubsection}{\@startsection{subsubsection}
                                                                       {1}{0pt}{10pt}{0.1pt}{}}
                                                                     \makeatother

2.4 How do I double-space my document?

Do you really want double-spacing? You probably want oneand-a-half spacing, it looks a lot better. The easiest way to do this is using the setspace package:

                                                       \usepackage{setspace}

Once the package is loaded, to activate doublespacing, simply add a \doublespacing to the top of the document. Similarly, add \onehalfspacing to get one-and-a-half spacing. Both of these effects can be undone (a good idea before references and indices) with a simple \singlespacing.

∗kaszeta@me.umn.edu

2.5 How do I make overheads?

Use either the seminar document class, or the foils class. Both of these are too involved to describe here. Instead look at the MEnet documentation web page, http://www.menet.umn.

edu/docs/tex/index.html.

3 Using L^{A}TEX on MEnet systems

3.1 The TEXINPUTS variable

By default, the various TEX programs look only in the main TEX area (/stage/share/teTeX) and the current directory for files. Often, users wish to have TEX and L^{A}TEX also look for files in a subdirectory of their home directory. This can be accomplished by setting the TEXINPUTS environment variable. For example, adding the line

setenv TEXINPUTS :$HOME/tex//

to your .cshrc file will cause TEX to look for style files and input file in the /tex subdirectory (and any subdirectories under that) in the user’s home directory.

3.2 Where are umthes2e.sty and asmelike.sty?

Due to the multiple version floating around and some of the outdated macros contained in these files, they are included

without support in /stage/share/tex-unsupported.

3.3 How do I typeset my thesis, then?

Use the new thesis-me.cls class file for this. For documen-

tation, consult http://www.menet.umn.edu/docs.

3.4 Where can I find (some random macro package)?

The best place to look for macro packages is on the CTAN sites,

ftp.cdrom.com:/pub/tex and ftp.dante.de:/tex-archive.

Using the method mentioned above you can keep the macro package or style file under your home directory. If you find a macro package that isn’t available on MEnet that you think is useful, let us know and we may make it available on a systemwide basis.

4 Common Mistakes to Avoid

4.1 Using L^{A}TEX 2.09 commands

While L^{A}TEX2e provides a compatibility mode for L^{A}TEX 2.09 documents (those begining with \documentstyle), this support is not very good, and for the best results you should convert your document to L^{A}TEX2e by changing the

\documentstyle to \documentclass. Then move the optional

arguments (the ones in square brackets) into \usepackage commands.

Example:

                                                       \documentstyle[yourstylefile]{article}

becomes

                                                       \documentclass{article}
                                                       \usepackage{yourstylefile}

Similarly, you should avoid using L^{A}TEX 2.09 commands in L^{A}TEX2e. These include \rm, \it, \tt, \sl, and \sc.

For more information, consult Appendix D in the L^{A}TEX Book.

4.2 Outdated Macro Packages

The side package (for sideways figures and tables) is outdated. Instead you should use the rotating package.

Similarly, the epsfig and psfig packages are outdated. Instead, the more powerful graphics package should be used (which provides an \epsfig command for compatibility). MEnet will not answer any questions regarding problems with either the epsfig or psfig packages.

4.3 Editing class files

Many users have attempted to make permanent changes to the default L^{A}TEX class files (i.e. article.cls). This is a bad idea, since

1. It is very easy to “break” these files.

2. If the systems staff updates L^{A}TEX the modified .cls file will likely break.

The proper way to accomplish the same thing is to either

1. Make a .sty file with your changes.

2. (experts only) Write your own .cls file which inherits from one of the base classes. See the L^{A}TEX Companion for information.

5 Formatting Math in L^{A}TEX

5.1 Subscripting words in math mode

Often in math mode one wants to use subscripts like “adiabatic” and “effective”, or abbreviations like these. The direct approach, using something like

                                                       $T_{effective}$

results in rather ugly output:

T_{effective}  (1)

The proper way to do this is to tell L^{A}TEX that you want to format the subscript as italics instead of math:

$T_{\mathit{effective}}$

which results in much nicer output:

T_{effective}  (2)

5.2 Typing multiline equations

One occasionally runs into equations that are more than one line in length. The best way to handle these is to use the amsmath package (described in The L^{A}TEX Companion), which among many other features provides a number of environments, align and multline among others, for typesetting math.

5.3 How do I typeset degrees and percents?

Both of these are pretty simple. Degrees are typeset with $^\circ$ (giving ^{∘}), (consider using a macro for this).

Percent signs are easy to do, they are simple: \% .

5.4 In running text and captions, L^{A}TEX puts too much space around the = sign. How do I fix that?

Typically, text likes to leave a lot of space around operators, so $a=b+c$ gives a = b + c. To fix this, you can tell L^{A}TEX not to typeset the equals as an operator by putting curly braces around it, for example $a{=}b+c$ gives a=b + c. Note that this also works for other operators, $a{=}b{+}c$ gives a=b+c.

6 Graphics

6.1 How do I embed Xfig drawings?

The steps to include Xfig drawings in L^{A}TEX documents are fairly simple:

1. Make the drawing in Xfig.

2. Make sure any text you want formatted by L^{A}TEX is marked as “special” in the “text properties” box.

3. “Export” the drawing as “Two Part L^{A}TEX/Postscript (postscript part)” in portrait mode.

4. “Export” the drawing as “Two Part L^{A}TEX/Postscript (L^{A}TEX Part).

5. Make sure your document includes the graphics package.

6. Load the drawing into the document using

\input{file.pstex_t}

6.2 How do I include EPS figures?

To include EPS figures, the easiest way is to use the graphicx package (the example here loads file.eps at 66% scale),

\usepackage{graphicx}
\includegraphics[scale=0.66]{file.eps}

6.3 What about other graphics formats?

Converting them to .eps is about the only convenient way of doing it.

6.4 How do I include landscape(rotated) figures?

The simplest way to do this is to load the rotating package and use the sidewaysfigure environment:

\usepackage{rotating}
\begin{sidewaysfigure}
...
\end{sidewaysfigure}

A similar environment, sidewaystable is provided for tables.

6.5 How about other graphics tricks?

The are many more interesting graphics packages available. The best place to see what is available and how to use them (with many good examples) is The L^{A}TEX Graphics Companion by Goosens, Rahtz, and Mittelbach, available from the Minnesota Book Center.

7 Bibliographies

The default L^{A}TEX handling of bibliographies is not very capable (for example, it doesn’t handle author-year citations), so you will have to use an additional style file and bibTEX style for these. MEnet supports two common macro packages:

7.1 The natbib package

The natbib package is a simple package providing author-year citations such as (Kaszeta, 1997). It replaces L^{A}TEX’s \cite macro with two related macros, \citet and \citep for textual (of the form “Kaszeta (1997)”) and parenthetical citations (of the form “(Kaszeta, 1997)”).

To go with this package, MEnet provides the bibTEX file menet.bst which provides formatting of bibliographies that satisfies both the Graduate School and ASME while maintaining compatibilty with the natbib package.

8 Useful Macros and Packages

8.1 The me-tools package

I have written a macro package that provides a number of useful macros for typesetting mechanical engineering papers.

Currently, the package provides macros for the following:

1. Convenient typesetting of non-dimensional numbers such as Re and Pr.

2. Macros to streamline the typsetting of many fraction-like items like total and partial derivatives.

This package is documented on the MEnet documentation web

page, http://www.menet.umn.edu/docs.

8.2 The url package

The url package provides a useful means to typeset long filenames, email addresses, and URL’s (providing proper line breaks, etc.). As an example,

\url{http://www.menet.umn.edu/~kaszeta}
typsets as http://www.menet.umn.edu/~kaszeta, even if
it occurs over a line break: http://www.menet.umn.edu/
~kaszeta.

8.3 The showkeys package

The showkeys package prints the “keys” used by the \label, \ref, and \cite commands in the margin of the document, which is useful for draft copies.

8.4 The nopageno package

The nopageno package turns off page numbering for the entire document, so you don’t have to put lots of \pagestyle and \thispagestyle calls everywhere.

8.5 Typesetting Programs

For typesetting C, matlab, pascal, scripts, and similar programs, there are four good options:

1. The listing package, which does keyword highlighting and formatting for most common programming languages, and requires no pre-processing.

2. The algorithm package, which provides a generalized environment for typing out algorithms.

3. The program package, which provides a modified tabbing environment for typesetting programs. This is built around Pascal, but it is fairly easy to use with C, too.

4. The lgrind program, which pre-processes various languages so they can be included in a latex document.

For FORTRAN codes, the best is to use the verbatim environment, or the related \verbatiminput command provided by the moreverb package.