Using LaTeX on the Linux Machines

David L. Finn RHIT

1 Getting Started

To use LaTex (pronounced la-tech), you first need to write your document plus commands for displaying the mathematics in an editor. Thus, the first step is to choose an editor. I would suggest usng the simple Nedit editor, there are other editors, but I suggest the Nedit editor as it is simple and you will not need anything other than a simple editor as LaTex does all the formatting for you. To start the Nedit editor, go under the Applications Menu to Programming and Select the Nedit editor. The Icon looks like a dolphin leaping.

The choice of editor is only to write the document plus the commands to format your document. It does not matter which editor you use. The only restriction is that you can not use the open office editor, as it can not save in the correct format.

You will also want to start a terminal window. Using TeX or LaTeX consists of a few basic commands in the terminal after writing your document. Latexing the document means running the latex compiler that the computer uses to read the commands you typed and then process the commands into a typesetted document. Basically LaTex decides the correct formatting, spacing and how to write the mathematical equations in a pretty format.

Writing the document is normally easy, you just write your text exactly as you want it. The hard part is learning the commands to get the mathematical characters to display, and then debugging your commands. You will learn that best by doing. It takes practice and patience, as you need to learn the syntax and how to recognize what the error messages mean.

After you have LaTex’d the document, you will get a dvi file which can be viewed by typing xdvi filenam.dvi, and then proofread and printed. Alternately, you can convert the dvi file to a pdf file and view and print. This is sometimes necessary with graphics (pictures and other figures).

2 Basic LaTex Procedure

1. Create tex file in Nedit, save as a tex file by saving the file as emphname.tex.

2. Type latex filename in the terminal. The filename should be of the form name.tex. Debug any errors in the code.

3. Type xdvi filename in the terminal to view the dvi file and print the dvi file. The filename should be of the form name.dvi

4. Type dvipdf filename in the terminal. The filename should be of the form name.dvi

5. Type ggv filename in the terminal. The filename shoud be of the form name.pdf This launches a pdf viewer from which you can view and print your document.

I have placed a basic latex file on the REU - Information part of my webpage, consisting of the start of a paper describing the model for the shape of a cookie. Copy this file into a directory. Open it in Nedit, look at the structure of it. You should see certain words bold face in purple, other words in blue and other words in green along with normal text. This is a feature of Nedit it recognizes that this is a tex file and uses a color code to help you format your typing and debug errors while typing.

The file consists of a header section containing commands to format the look of the file. Then there is a title/abstract section containing the beginning of the article. Then finally there is the start of the article containing mostly text (unformatted) . Blank lines signify the start of a new paragraph. There is no rhyme or reason to where lines end as it has nothing to do with how the document will look. At the start of each new paragraph, there is a command \newpar which I use to start a new paragraph and force a line skip between paragraphs. Every once in a while you will see commands sectionned off by dollar signs. This is how you insert mathematical typesetting into a lines of text. Other times you will see commands sectioned off by \begin{equation} and \endequation or \[ and \]. These are methods to display mathematical equations on their own line in the middle of a paragraph.

Compile the file from the terminal, convert it to a pdf file and view it by following the directions above. Look at the pdf file as compared to the tex file.

3 Creating Your Own LaTex Document

I would suggest you start with the file I wrote. Leave the header section alone, and alter the title information and abstract. Delete all the text after the \maketitle and before the \end{document} commands. At the moment, just type text and simple mathematics. Then compile and view.

3.1 Some Useful Mathematical LaTex Commands

All of the following commands must be placed inside dollar signs to display mathematics.

• \partial = ∂ = partial derivative symbol

• \frac\{num\}\{den\} = \frac{num}{den} = fraction

• \int = ∫ = integral sign

• \nabla = ∇ = gradient symbol

• \sqrt\{root\} = \sqrt{root} = square root

• \cos(t) = cos(t) = cosine of t

– Standard function names are known such as cos, sin, tan, arctan, ln, log, cosh, sinh, et cetera.

– To get exponential function it is e∧t though the e will be in italics.

– Subscripts are done by a 1

• \lim\limits {x \to 0} f(x) = lim_{x→0} f(x) = limits

• \delta = δ = Greek letter

– Greek letters are given in two forms uppercase and lowercase by spelling the letter and starting with the first letter in uppercase to get the capital greek letter or lowercase to get the small Greek letter.

3.2 Importing Pictures and Figures

To import pictures easily you will need to modify the header or pre-amble part of the document (if you are not using the one I provided). You need to add a line to the pre-amble such as

• \usepackage{amsmath,amssymb,amsthm,graphics}

The important part is the last word graphics, this allows the command \includegraphics for inserting figures and pictures.

Where you want to include graphics, you then write

\begin{figure}[h]

\scalebox{1.0}{\includegraphics{filename.ext}} \caption{Whatever wording you want for the figure}

The file that you include should be either have extensions ps, eps, pdf, ai. I have not yet been able to include a jpg or a gif file into a L^{A}TEXfile, but that does not mean it can not be done. The [h] should force L^{A}TEXto try to place the figure exactly at the location where you place it in the tex file. You may have to scale the figure appropriately so it fits.

3.3 Other Hints

I will periodically update this file and place other files on my website with additional information, like how to include pictures in your file.