## FAQ: How to write a thesis in LaTeX

If you are reading this, it is quite likely that you know LaTeX is far superior to Word. If not, read this. LaTeX is particularly useful while writing theses or papers as the writer can concentrate on the contents rather than the formatting. For example, you dont have to be worried about writing a table of contents, figure placements, figures that move as you add text, choosing a pretty font or even adjusting the images. LaTeX will do all of this (and many many more) for you. LaTeX is also free, well maintained and has excellent support forums. You can download LaTeX from here.

I used WinEdt 5, LaTeX2e, Bibmaker 1.1.5, GSView32 2.9 and Acrobat Reader 5.0 while writing my Masters thesis in the Department of Mechanical Engineering. If you are already scared, or about to return to your MS Wor(l)d, STOP! You are no different from my state when i started using LaTeX. Read how to make a quick-start and install the necessary software. And dont forget to read the disclaimer if you harbor any evil intentions for suing me etc..(even otherwise). If you find any errors or would like to submit a question/suggestion/more elegant solution, i would be glad to have them included here. Please send an email to bbalasub a-t uiuc d-ot edu.

#### 1. How to include figures?

The figures should be in EPS format. PS figures can also be included but some PS files might not display properly. In particular PS files generated using Tecplot 7.5 could not be resized and were displayed incorrectly. Once you have the figures, do the following:

a) Add the following line to the beginning of your thesis.tex file
\usepackage[dvips]{graphicx}
\usepackage[dvips]{epsfig}

b) Include the figure(fig1.eps) inside the tex file (results.tex, chapter1.tex etc) with
\begin{figure}[htbp]
\centering
\includegraphics[width=15cm]{Type_location_of_fig1.eps_here..for
example, Images/fig1..dont include .eps}
\caption{Picture of the experimental setup or whatever}
\label{Type_label_for_figure_here}
\end{figure}


#### 2. What about sideways figures?

a) Add the following lines to the beginning of your thesis.tex file
\usepackage[dvips]{graphicx}
\usepackage[dvips]{epsfig}
\usepackage{rotating}

b) Insert the figure(fig2.eps) sideways inside the tex file with
\begin{sidewaysfigure}[htbp]
\centering
\includegraphics[scale=0.85,angle=-90,viewport=10 10 550 580,clip]{fig2}
\caption{Type_out_your_caption_here} \label{put_the_label_used_for
_referencing_here}
\end{sidewaysfigure}

The "angle=-90" option is used to rotatate the figure, while "viewport =x,y,a,b,clip" displays a portion of the image and clips the rest. "scale=x" preserves the aspect ratio and scales the image. Use "height=xxcm" to scale according to height or "width=xxcm" to scale the width.

#### 3. What about multiple figures?

a) Add the following lines to the beginning of your thesis.tex file
\usepackage[dvips]{graphicx}
\usepackage[dvips]{epsfig}
\usepackage{subfigure}

b) Insert the sub-figures(figA.eps,figB.eps..FigD.eps) as a single figure inside the tex file with
\begin{figure}[htbp]
\centering \subfigure[Type_Caption1_here]{
\label{Type_label1_here} \centering
\includegraphics[width=xxcm]{Location_of_Figure A}}
\subfigure[Type_Caption2_here]{ \label{Type_label2_here}
\centering
\includegraphics[width=xxcm]{Location_of_Figure B}}
\subfigure[Type_Caption3_here]{ \label{Type_label3_here}
\centering
\includegraphics[width=xxcm]{Location_of_Figure C}}
\subfigure[Type_Caption4_here]{ \label{Type_label4_here}
\centering
\includegraphics[width=xxcm]{Location_of_Figure D}}
\caption{Type_Caption_for_whole_figure_here} \label{Type_label_for_
whole_figure_here}
\end{figure}


#### 4. Can I insert a powerpoint drawing into a LaTeX document?

Yes and its probably the fastest way to get nice line drawings into your LaTeX document. A very nifty method is described in the website of Martin C. Rinard.

#### 5. How to convert tiff/jpeg/gif images to eps?

The way that works the most number of times is to ftp all the figures to a unix/linux machine and use xv. Paint Shop Pro etc can also be used to export the images onto a EPS format but sometimes these images dont work well.

#### 6. How can I change the "Figure:" caption into "Figure "?

Add the code shown below to the beginning of your thesis.tex document (or your main tex file) after the \usepackage lines but before \begin{document}
%the following lines are to change the : after a figure to a space
\makeatletter  % Allow the use of @ in command names
\long\def\@makecaption#1#2{%
\vskip\abovecaptionskip
\sbox\@tempboxa{#1  #2}%        % replace : by . (in your
case: space)
\ifdim \wd\@tempboxa >\hsize
#1  #2\par                    % hier habe ich : durch . ersetzt
\else
\global \@minipagefalse
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
\fi
\vskip\belowcaptionskip}
\makeatother   % Cancel the effect of \makeatletter

(credits:Sören Kahl)

#### 7. My figures dont show up properly. Whats wrong?

Several solutions can be tried. One of them is to use a ! option to force latex put the figure at the place where you want it to. Instead of inserting the figure starting with a
\begin{figure}[htbp]

try typing
\begin{figure}[!htbp]

If this does not work, redefine the parameters which determine the figure placements, number of figures to be placed and so on. Choose to modify any one or more of the following lines (lines to be added to the start of the thesis.tex document before the \begin but after \usepackage)
\renewcommand{\topfraction}{.85}
\renewcommand{\bottomfraction}{.7}
\renewcommand{\textfraction}{.15}
\renewcommand{\floatpagefraction}{.66}
\renewcommand{\dbltopfraction}{.66}
\renewcommand{\dblfloatpagefraction}{.66}
\setcounter{topnumber}{9} \setcounter{bottomnumber}{9}
\setcounter{totalnumber}{20} \setcounter{dbltopnumber}{9}

Even if this does not help, when all the figures accumulate and show up at the end, there is one more thing that you can do. Add a
/clearpage

command to the tex file. When LaTeX encounters this command, it starts dumping all the tables and figures that were carried over from previous instances. This is a very poor technique for formatting and should be used only very rarely.

#### 8. How to add a "Page" string at the top of the Table of Contents or List of Figures or List of Tables?

Some departments might need a "Page" label on top of the page numbers as shown in the following diagrams. The picture on the left is from a thesis generated with the uiucthesis.sty file without any modifications while the picture on the right can be obtained by adding the following lines before the \begin of thesis.tex file
\addtocontents{toc}{\hfill Page\endgraf}%


#### 9. How to make the Appendix?

Start by making an appendix.tex file. The contents of the file should be as follows:
\appendix
\chapter{Illustrative Vector Fields}
.
.
.
.
\chapter{Program Listings}
.
.
.
.
\label{app}

After creating this file, add the following file to your thesis.tex file:
\include{appendix}


#### 10. How to list C++ programs?

\usepackage{listings}

to the thesis.tex file. You might have to download the listings.sty file off the web. You might also need to update the filename database of LaTeX. Read about it here. After you install the listings package, use the following piece of code to list your file:
\lstinputlisting[%
showstringspaces=false,%
frame={tb},%
lineskip=-1pt,%
extendedchars=true,%
basicstyle=\footnotesize\ttfamily,%
numbers=left,%
stepnumber=1,%
numberstyle=\tiny,%
xleftmargin=2em,%
language=C++,%
breaklines]{cppcode/v2frms/v2frms.cpp}

There is another way of doing this (although not half as elegant and more space consuming). This method simply dumps the text file onto the output file verbatim. Add \usepackage{verbatim} to thesis.tex and use \verbatiminput{cppcode/v2frms/readme.txt} to list the file cppcode/v2frms/readme.txt.

#### 11. Is there a listing of symbols available in LaTeX?

Yes. A comprehensive listing is located here.

#### 12. How can i create the bibliography?

Use bibmaker to type in your references. Export the database into a .bib file(for ex.,thesisbib.bib). Add the following lines after \include{appendix}
\backmatter
\nocite{*}
\bibliographystyle{unsrt}
\bibliography{bibthesis}

Now run "latex thesis" once, then run "bibtex thesis" from a command prompt and then run "latex thesis" twice again to get the references listed at the end of your thesis. The unsrt option is used to sort the references according to the order in which they were referenced.

#### 13. Is there a sample listing of a UIUC thesis.tex file?

\documentclass[11pt,oneside]{book}
\usepackage[fullpage]{uiucthesis}
\usepackage[dvips]{epsfig}
%\usepackage{textcomp}
\usepackage{latexsym}
\usepackage[dvips]{graphicx}
\usepackage{subfigure}
\usepackage{rotating}
\usepackage{listings}
\usepackage{verbatim}
\usepackage{ifthen}

%The following lines were added by Balakumar BJ
\renewcommand{\topfraction}{.85}
\renewcommand{\bottomfraction}{.7}
\renewcommand{\textfraction}{.15}
\renewcommand{\floatpagefraction}{.66}
\renewcommand{\dbltopfraction}{.66}
\renewcommand{\dblfloatpagefraction}{.66}
\setcounter{topnumber}{9} \setcounter{bottomnumber}{9}
\setcounter{totalnumber}{20} \setcounter{dbltopnumber}{9}

%the following lines are to change the : after a figure to a space
\makeatletter  % Allow the use of @ in command names
\long\def\@makecaption#1#2{%
\vskip\abovecaptionskip
\sbox\@tempboxa{#1  #2}%        % replace : by . (in your
case: space)
\ifdim \wd\@tempboxa >\hsize
#1  #2\par                    % hier habe ich : durch . ersetzt
\else
\global \@minipagefalse
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
\fi
\vskip\belowcaptionskip}
\makeatother   % Cancel the effect of \makeatletter

%\nofiles

\begin{document}
\title{PIV Measurements in a Solid Rocket Motor Exhaust Plume}
\author{Balakumar Jothimohan Balasubramaniam}
\department{Mechanical Engineering} \schools{B.S., Indian
Institute of Technology, Madras, 2000} \msthesis \degreeyear{2002}
\maketitle

\frontmatter
\newpage
\leavevmode
\vfill
\begin{center}
\vspace{-3cm} To my parents, Santha and Jothimohan for their
infinite patience and great love.
\end{center}
\vfill

\include{Acknowledgements}

\tableofcontents

\listoftables

\listoffigures

\mainmatter
\include{Chapter1}
\include{Chapter2}
\include{Chapter3}
\include{Chapter4}
\include{Chapter5}
\include{appendix}

\backmatter
\bibliographystyle{unsrt}
\bibliography{bibthesis}
% calls plain style bib from file rocketrefs.bib

\end {document}


#### 14. How do I change the "Chapter xx" heading to all uppercase as in "CHAPTER xx"(some departments require it)?

Open the book.cls file (usually found at c:\texmf\tex\latex\base). A few lines from the end of the file (around line 25), there is a line which reads
\newcommand\chaptername{Chapter}

Change it to
\newcommand\chaptername{CHAPTER}


#### 15. My subsubsection does not appear in the table of contents (toc). How do I make it appear? (equally applicable for section, subsection, paragraph, subparagraph etc.)

Change the following line in book.cls file (see Question 14 to find this file):
\setcounter{tocdepth}{2}

to
\setconter{tocdepth}{3} % or higher for paragraph, subparagraph etc.

Latex numbers chapter as level 0, section as level 1 and so on. If LEVEL of section is less than or equal to tocdepth, it is included in the toc.

#### 16. subsubsection titles do not appear in my ps, pdf file (and/or) subsubsection is not numbered.

Change the following line in uiucthesis.sty style file
\renewcommand\subsubsection{@startsection{subsubsection}{3}{\z@}%

to
\renewcommand\subsubsection{@startsection{subsubsection}{2}{\z@}%


#### 17. Section and subsection titles appear double line spaced. My department demands that it be single line spaced. How can it be wrapped correctly?

Add a couple of lines-in front and after each of your section headings. This will temporarily change the document spacing settings:
\renewcommand{\baselinestretch}{1}
\section{Nervous behavior of relaxed bovines after intergalactic
trips on rat steered spaceships}
\renewcommnd{\baselinestretch}{2}


### Quick start guide

#### WinEdt 5:

WinEdt is the standard editor and a shell used for creating tex files. It is quite similar to wordpad but is especially designed for TeX/LaTeX. For example, LaTeX commands are colored differently when compared to the normal text. It is also a shell since LaTeX/TeX/Ghostview etc can be started from the editor window itself. Its a shareware and can be downloaded here. You could also use Texnic center instead of WinEdt. Unlike WinEdt (which issues very very painful reminders after the first few days of usage), Texnic is freeware and can be downloaded from here. The geeks should note that WinEdt licence is hackable. The geekier ones note that Texnic is opensource! So you choose.

#### LaTeX2e:

The LaTeX compiler used for creating dvi(devied independent) files which can then be converted into ps and pdf files. Download and install from here.

#### Bibmaker 1.1.5:

A nifty tool used for creating input files for BibTex. BibTex creates the references/bibliographics used in papers and theses. Free from here.

#### GSView:

Ghostscript(GS) reader is used for opening ps files(basically a PostScript interpretor). Can be downloaded free from here.

### Credits

Listed in alphabetical order:
Ramesh Arakoni
Ganesh Balamurugan
Vaibhav Donde
Gregory Geller
Sören Kahl
Tim Love
Renchi Raju
Mike Seelinger (and Lucas Evangelista Rincon)
Kendra Sharp
Vandana Venkat
Peter Wilson.