Latex Tips

So you've finally completed your research and are ready to write your thesis. And you want to use latex. Latex is great for doing any kind of equation editing. It will also automatically generate figure numbers, table of contents and figures, and do a lot of formating for you. But if you need to do anything more advanced than the basics, it's not going to be anywhere near as easy as, say, the WYSIWYG of Microsoft Word.

My school had a number of standard formating requirements that were not the same as the latex defaults. Trying to figure out how to change the formating rules requires some in depth knowledge of latex (and a lot of Googling). I'll share with you what I learned to get my thesis formated right.

• Use \linespread{2} to double space your thesis. You can also use non-integer spacing.

• You can redefine almost anything you want, but use a special purpose package if you need to do something difficult or non-obvious. I used the following packages.

• fancyhdr - Use this to change things like page numbering, headers, and footers.

• graphicx - You'll need this for importing graphics. I always used .eps for postscript and .pdf (use ps2pdf) for pdf extensions. You can have latex decide which extension is appropriate by not giving it the extension. It will figure out whether to use the .pdf or .eps. As an example, use

\includegraphics[totalheight=0.6 \textheight,width=1\textwidth]{texfigs/misalign}

The directory of my images is texfigs. The file is misalign[.pdf][.eps].

• maple2e - You can use this package if you want to import maple code.

• subfig - I used this for figures broken across many pages. All you have to do is put /ContinuedFloat inside the next figure and latex will number it the same as the last one. You can also use this package to control multiple images or figures inside a single figure. I didn't know about this and did it the hard way by redefining fnum@figure. If you want to go that route, use

\makeatletter \renewcommand{\fnum@figure}{Figure \thefigure \hspace{1em}(cont.)} \makeatother

before the figure to redefine the caption. The \thefigure command is the figure number. Make sure to change it back after the figure unless you want to keep it that way.

• caption - You can use

\usepackage[justification=raggedright, singlelinecheck=false]{caption}

to left justify all your captions

• Change the page numbering style using \pagenumbering{roman} or \pagenumbering{arabic}.

• Get a new page with /newpage. You might need this if you need a special page before the first chapter that isn't a standard page (like the table of contents). Use /clearpage to end the current page. This will force latex to flush all it's images.

• Change page dimensions with
\addtolength{\oddsidemargin}{-.3in}


Change float spacing with
\renewcommand\floatpagefraction{.9}
\renewcommand\topfraction{.9}
\renewcommand\bottomfraction{.9}
\renewcommand\textfraction{.1}
\setcounter{totalnumber}{50}
\setcounter{topnumber}{50}
\setcounter{bottomnumber}{50}


• If you don't want the really fancy contents title that latex uses, you can do

\renewcommand{\contentsname}{\hspace{1.8in} \large CONTENTS}.

• If you need to remove a dangling line and increase or decrease a page size one line, use \enlargethispage{+\baselineskip}. Change the '+' to '-' to shrink the page. Make sure to place it between two paragraphs.

• Use /def to define symbols and text you use often. This will be especially helpful for equation editing.

• Use /label directly after captions in figures. Make sure the caption is outside of any inner environments in the figure environment.

• Use // to force a new line. I often use this in eqnarray. Use /nonumber to skip numbering the equation. You can skip equation numbering for the entire environment by putting a star after the environment name. E.g. /begin{eqnarray*}.

• If you need to enter non-bibitems in the bibliography, one solution is to use an empty bibitem. For example,

\makeatletter\def\@biblabel#1{\bf{General References}}\makeatother \bibitem[ ]{}

• To shorten captions in the list of figures, use /caption[Short version]{Loooooong version}.

• Sometimes importing certain images will change the amount of whitespace around the image. To fix this, use the viewport option inside include - ,viewport=75 180 550 600,clip. That's left of image, bottom of image, right of image, and top of image respectively.
Resources
www-h.eng.cam.ac.uk
www.tug.org
Latex Tips
comp.text.tex
latexlovers