Wednesday, September 29, 2010

School Of Maths - Thesis Template

The school of maths provides a class file and thesis template which can be found on the school website (restricted access):-
Templates

Open both files with the editor/IDE of your choice. Notice that the muthesis.cls contains information both about how the file works, and the required structure of your thesis. Build and view the file, you should have the beginnings of a thesis! In this short tutorial, we shall go through how to create a table, import graphics and use bibtex for your bibliography.

Tables

Your thesis is likely to include tables of one sort or another. A table in latex is a float, that means it can have a caption, a label, can appear in the table of contents, and will be placed by latex within the text in order to make the document look nice.

In order to create a table, we need to know about the tabular environment. An example of a simple tabular environment is:

\begin{tabular}{c|r}
1  &  2  \\
\hline
three  & four
\end{tabular}

and the output is:


The arguments after \begin{tabular} specifies the number of columns, the justification, and any vertical lines between columns. For instance writing {c||rrr} makes one centered column, two vertical lines followed by three right justified columns. Inside the environment individual cells are separated with an ampersand (&) and the row is ended with the end line command double backslash. We can use the command \hline to give a horizontal line.

Now to make a table, we must include the tabular environment inside the table environment. An example follows:
\begin{table} % start table environment
\begin{center} % center the table and caption
% build the table
\begin{tabular}{c|ccc}
 & \multicolumn{3}{c}{Attendance at Course} \\
 Week & MATH10121 & MATH10212 & MATH10222 \\
\hline
1 & 234 & 157 & 153 \\
2 & 223 & 167 & 148 \\
3 & 227 & 129 & 133 \\
4 & 236 & 134 & 113 \\
5 & 212 & 127 & 101 
\end{tabular}
\caption{My table showing preparations times} % caption for the table (gives it a number)
\label{tab:myTable}
\end{center}
\end{table}
and the output is:
Including Graphics

In latex documents there are two ways to import graphics into your documents, depending on your required needs. If you are to be including technical plots, then encapsulated postscript graphics give the best looking results, and also allow latex to substitute text in your figures for typeset text. This can be particularly useful when you want equations or greek text in your figures. In order to use eps graphics and produce pdf's, you need to enable your IDE to run "LaTex -> DVI -> PS -> PDF". There are instructions on how to do this with kile or teXnicCenter elsewhere on this blog.

First let us try to import some simple graphics in png or jpg format. Go to the web and download a picture in jpg or png format, and save it in the same folder as your tex file. Now change your build profile to "LaTex => PDF", and include the following line after documentclass but before begin document:
\usepackage{graphicx}
Somewhere inside the document, maybe inside the introduction, include the line
\includegraphics[width=0.5\textwidth]{filename.jpg}
Now build and view the file, the picture should appear in the document. If you are having problems check that you have the usepackage command in the right place, and that you have the correct build profile.

Next we wish to make a figure. Like the table environment, a figure environment is a float, which means that latex will choose exactly where the figure will appear in the document, although you do have some control. Now try to place your picture inside a figure, with a caption and a label.
\begin{figure} % start the figure environment
\begin{center} % center the graphics and caption
% include the graphics
\includegraphics[width=0.5\textwidth]{help-my-dogs-as-fat-as-me.jpg}
\caption{A fat dog} % caption for the picture
\label{fig:fatDog}
\end{center}
\end{figure}
the output from this is:
Notice that because I have included the figure in chapter 2, the reference number for the figure gives the chapter number then the position in that chapter. It is possible to change this behaviour if you wanted to.

EPS Graphics and PSFrag

Now let us give an example of including eps graphics. Remove any statements that reference any jpg or png pictures. Now download the eps example figure from my website:
http://www.maths.manchester.ac.uk/~pjohnson/Latex/Figures/
Include the following line after documentclass but before begin document:
\usepackage{psfrag}
and change your build profile to "Latex -> PS -> PDF". Now enter the following:
\begin{figure} % start the figure environment
\begin{center} % center the graphics and caption
% setup psfrag
\psfrag{x}[][]{$\eta$}
\psfrag{y}[][]{$f(\eta)$}
\psfrag{f(x)=sin(x)/x}[][]{$f(\eta) = \frac{\sin(\eta)}{\eta}$}
% include the graphics
\includegraphics[width=0.75\textwidth]{example-figure.eps}
\caption{A figure using psfrag.} % caption for the picture
\label{fig:sinxoverx}
\end{center}
\end{figure} 
and the output is:




Bibliography

You may wish to use bibtex to cite articles in your thesis. This is useful because it generates your bibliography automatically. To do this, create a new file called "myBibFile.bib" and save it in the same directory as your thesis file. Open the file and enter:

@article{einstein1935can,
  title={{Can quantum-mechanical description of physical reality be considered complete?}},
  author={Einstein, A. and Podolsky, B. and Rosen, N. and others},
  journal={Physical review},
  volume={47},
  number={10},
  pages={777--780},
  year={1935},
  publisher={APS}
}
Note that from google scholar you can set it up to import citations into bibtex format. Here einstein1935can is the reference keyword for this citation. First place the following underneath your package list:
\bibliographystyle{plain}
and then edit the part for the bibliography to read
\bibliography{myBibFile}
% 
% \begin{thebibliography}{999}
% \bibitem{ANO} A.N.~Other, ....
% \end{thebibliography}
This should enable the bib file in your document. Now you just need to cite the text so that it will be included in your text:
Einstein showed in his paper \cite{einstein1935can} that ...
You can add as many reference as you like to your bib file, only those that are referenced within the text of your thesis will show up in the bibliography.

4 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. I really like to learn programming.

    ReplyDelete
    Replies
    1. Programming can indeed help a lot in the productivity of the schools. I am just thinking if there are some simple programming tools that my be used at aiming to help people doing math related dissertations.

      Delete