# Using LaTeX to create professional reports

The majority of writers outside of academia use a word processor, such as Microsoft Word or OpenOffice, to create their reports. Word processors work fine for most reports however LaTeX (pronounced “Lah-tech”) has many advantages over traditional word processors. LaTeX produces the highest quality typesetting, it is easy to create complex equations and manage citations with it and it is completely free. Because LaTeX files are plain text files any text editing program can be used to edit them which makes your documents extremely portable and interoperable. However, LaTeX is more complicated to use for simple documents but becomes easier to manage than word processors for longer and more complicated documents.

First we need to install LaTeX. It is recommended for windows users to use the basic installer located here.

For the purposes of this tutorial we are going to use Texmaker as our text editor since it is designed for beginners to easily create LaTeX documents. Accept the defaults for both installers.

Starting Texmaker for the first time should show a window like the following.

 Figure 1: Opening Texmaker for the first time

Press the new button in the top left corner to create a new document and type the following:

 \documentclass[12pt]{article} \begin{document} Hello world! \end{document} Table 1: Simple Hello world! document

Save the document using the save button in the top left and then press the arrow button to the left of “Quick Build” to quickly create and preview a PDF.

 Figure 2: Pasting code into texmaker and locating the quick build button.

Commands start with a backslash. Commands can do a variety of things from inserting images to automatically formatting the document. The line “\documentclass[12pt]{article}” is a command that tells LaTeX to load the default options for an article. [12pt] is an option for that command that overrides the default 10pt text size. Text is typically placed after the “\begin{document}” command. For more standard margins we are going to add the “\usepackage{fullpage}” command to our file.

 \documentclass[12pt]{article} \usepackage{fullpage} \begin{document} Hello world! \end{document} Table 2: Simple Hello world! with more standard margins.

Italics can be created with the “\textit{…}” command and bold text can be created with the “\textbf{…}” command. The text that you want formatted is placed in the “…” section of the command. The document can be split into sections and subsections with the “\section{…}” and “\subsection{…}” commands, where “…” is the name of the section or subsection. All numbering and references are taken care of automatically by LaTeX so there is no need to worry about them.

 \documentclass[12pt]{article} \usepackage{fullpage} \begin{document} \section{Beginning} \subsection{The introduction} \textbf{Hello world}! \subsection{Another section} \textit{Text goes here.} \end{document} Table 3: A sample document showing off bold text, italic text and subsections.
 Figure 3: PDF output from table 3.

One of the advantages of LaTeX is the ability to quickly add complex equations. In-line equations are entered using $…$ and separate line equations are entered using $$…$$. The actual equation is entered where I placed the “…”. Symbols can be added by typing a backslash and the name of the symbol. A list of symbols can be found here. Exponents are entered using ^{…}, fractions are created using \frac{…}{…} and square roots are entered using \sqrt{…}. Numbers (or letters) are placed in the “…” parts of the commands. A complete list of math commands can be found here.

 \documentclass[12pt]{article} \usepackage{fullpage} \begin{document} Hello world! $3*2+1=7$ $$\frac{14}{2}=7$$ $$5^{2}=\sqrt{625}$$ $$E=h\nu$$ $$\nu=\frac{c}{\lambda}$$ $$E \psi(x) = - \frac{\hbar^2}{2m} \nabla^2 \psi(x) + V(x) \psi(x)$$ \end{document} Table 4: Sample document containing increasingly complicated equations.
 Figure 4: PDF output from table 4.

Tables can also be easily and professional created in LaTeX. First, the “\usepackage{float}” command is needed in the beginning of the document so that the table can be properly positioned. Next, the command “\begin{table}[H]” is used, [H] being an option that tells LaTeX to position the table where it is in the source text. “\caption{…}” is a command that is then used to give the table a caption. “\centering” is a command used to center the table horizontally. Next the command “\begin{tabular}{lcr}” begins the actual table. The {lcr} part defines three columns of the table, the first “l” being left justified, “c” being center justified and “r” being right justified. The “\hline” command creates horizontal lines and the command “&” is used to separate columns.

 \documentclass[12pt]{article} \usepackage{fullpage} \usepackage{float} \begin{document} \begin{table}[H] \caption{Caption text} \centering \begin{tabular}{lcr} \hline $\mu$L & $\lambda$ & cm \\ \hline 1 & 0.116 & 3.7\\ 2 & 0.248 & 2.5\\ 3 & 0.657 & 4.1\\ 4 & 1.548 & 4.0\\ \hline \end{tabular} \end{table} \end{document} Table 5: An example table
 Figure 5: PDF output from table 5.

To add images or graphics to a document the “\usepackage{graphicx}” command must be used. The command “\includegraphics{…}” adds the actual graphics where “…” is the filename. The width= option sets the width of the image and I typically use units of millimeters. The command “\centerline{…}” centers the graphics. You need an image file with the name test.jpg in the same place as the .tex file for this command to work.

 \documentclass[12pt]{article} \usepackage{fullpage} \usepackage{graphicx} \begin{document} \centerline{\includegraphics[width=85mm]{test.jpg}} \end{document} Table 6: A sample document including an image “test.jpg”.

More information about LaTeX can be found at the great wikibook available here or the more in-depth introduction available here.

Adam Hogan is a professional writing student and chemistry major at the University of South Florida.