Usage of LaTeX

LaTex is a wonderful tool as it is all text based and you basically run programs to convert it to output. What does this mean in practice? Your machine doesn't lock for half an hour and crash like it does when using an office package.

Yes LaTeX isn't simple but if you can edit a web page using HTML you can write LaTeX. It's just a markup language like HTML.

Here are some basic notes for others to use - I will add as I find things and please feel free to send me notes also.

Environment

I would recommend using kile as your editor and pdftex as the output. I think pdftex is the default on most versions of Linux these days.

Getting graphs into a document

These can look pretty ugly and miss features if you follow a lot of the old tutorials.

Here I would recommend using gnuplot. See my gnuplot page for generating the graph first. Convert the .eps output of that to .pdf by running epstopdf.

Now in your .tex file put the following line near the top

\usepackage[pdftex]{graphics}

Or I have started doing this more recently instead (can't remember why sorry!):

\usepackage[pdftex]{graphicx}

and then where you want your graph put do something like:

This gave us a result as shown in Figure~\ref{fig:myplot}.

\begin{figure}
\includegraphics[width=15cm]{my_plot}
\caption{My pretty plot}
\label{fig:myplot}
\end{figure}

You will need to alter the width parameter above to suit your column layout. If graphs are cutting into columns etc look for Overfull \hbox in the compiling output and then then continue reducing width until this error goes away. This error (and also Float too large error) causes the caption to disappear sometimes. Just reduce the size and the caption will reappear.

One thing with a statement such as \includegraphics[width=15cm]{my_plot} is that the aspect ratio isn't preserved. If this is important to you do it like this instead \includegraphics[scale=0.8]{my_plot} instead.

If you want the graph to be on it's own page do \begin{figure*} rather than \begin{figure}

Incorrect references in a document

If your figure or table references get all muddled up and the numbers are wrong in the text then remember that \label must come after \caption (thanks to this page for helping me sort that out).

Embedding fonts in a document

IEEE papers require that you embed all fonts. By default PDFs generated on Linux don't embed the standard 14 fonts (e.g. Times-Roman). This occurs whether using LaTeX, PDFTex, epstopdf etc. After much hunting I found this article using Google (I have copied a chunk - can't find author to ask for permission). In this article he/she talked about modifying /usr/share/gs-afpl/8.14/lib/gs_pdfwr.ps and change lines

/.standardfonts [
/Courier /Courier-Bold /Courier-Oblique /Courier-BoldOblique
/Helvetica /Helvetica-Bold /Helvetica-Oblique /Helvetica-BoldOblique
/Times-Roman /Times-Bold /Times-Italic /Times-BoldItalic
/Symbol /ZapfDingbats
] readonly def

to

/.standardfonts [
% /Courier /Courier-Bold /Courier-Oblique /Courier-BoldOblique
% /Helvetica /Helvetica-Bold /Helvetica-Oblique /Helvetica-BoldOblique
% /Times-Roman /Times-Bold /Times-Italic /Times-BoldItalic
% /Symbol /ZapfDingbats
] readonly def

In Ubuntu 7.10 the file needed is /usr/share/ghostscript/8.61/lib - gs is short for GhostScript. This file will vary per Linux install but hopefully you get the idea of what to look for - to find the exact location use 'locate gs_pdfwr.ps' (thanks Andre Lage Freitas for the tip). If you can't work out which fonts aren't embedded use pdffonts as you have to regenerate all your documents (e.g. graph figures) to get them to embed the font.

Links:
WLUG wiki links on LaTeX
Publishing with Latex, Gnuplot, Mathematica ...
Cambridge University guide to LaTeX

Back to my home page

Last modified 06 Jan 2011