LaTeX Lessons

Lesson Two: Writing your First LaTeX File

LaTeX files are generally written by copying existing files and modifying to suit. As you already have the file latsam1.tex, open it in your text editor.

In this example, the file has been opened in WinEdt (see Figure 2.1). Alter the text inbetween the \begin{document} and \end{document} using the mouse, arrow keys, and backspace or delete keys. Example: alter the document to:

\documentclass[12pt]{article}
\begin{document}
Gosh I am now writing my first
LaTeX document.
\end{document}

Save the file by clicking on the icon with a picture of a floppy disk.

You will now need to LaTeX, and dvips as mentioned in lesson 1. You can save the file under a different name by clicking on the "File" menu and selecting "Save As".

WinEdt window displaying first latsam1.tex file
Figure 2.1 - WinEdt Window

There are macro buttons built in to WinEdt for calling the latex-related commands (see Figure 2.2). The "Latex" button is currently assigned to the PDFLatex command, rather than latex command. Unless you are inserting images, in most cases this should be fine. The DVI -> PDF button will convert the resulting .dvi file into a PDF file and then open it for viewing.

WinEdt window displaying first latsam1.tex file
Figure 2.2 - WinEdt Window

This concludes lesson 2.


Next >>