MA 303, Mathematical Modeling - Introduction to LaTeX

Thanks to John Bukowski and Cathy Stenson for sharing previous versions of this document.

As mentioned in the course syllabus, we will use the mathematical typesetting program LaTeX (“lay-tech” or “lah-tech”) for our projects and other work. LaTeX is the “standard” program that serious mathematicians use to produce their documents. We will use a free version of the program called MiKTeX, which is on the appserver. You may also wish to download it to your own computer. LaTeX is different from anything you have used before – it is not like Word, where “what you see is what you get.” It may be confusing at first, but once you get the hang of it, it is relatively easy to use – and the resulting documents are definitely worth it!

The general procedure is as follows: First, we type the .tex file in Notepad (or some other editor to create an ASCII text file) – this is the file containing all the text, figures, tables, etc., in LaTeX’s special code. Then, we convert this file (via LaTeX) to a .pdf file, which we can then view.

Now we will step through the process:

First, connect to the Appserver. Then find the file P:\Kruse\ma303\latex\inclass.tex, and copy it to your U drive. Do the same with the files template.tex and curve01.jpg. Open inclass.tex in Notepad. Now, open a DOS window by either locating “Command Prompt” under Programs Accessories, or by Start > Run, then entering cmd.exe. If you put the file inclass.tex in your “MA303” folder, then you would type cd MA303 at the DOS prompt to get to this folder/directory. Type dir to display the contents of the current (sub)directory.

Command Line (as opposed to TeXnic Center) Instructions

Now, to compile the TeX file and turn it into a pdf document, type pdflatex inclass.texat the prompt. Usually when you “latex” a file, you get several error messages – this is normal! Often they can be fixed easily – many times, you type a “{” without a “}” or a “begin{something}” without an “end{something}”. To fix the errors, simply go back to Notepad, edit the .tex file and save it again. Then retype the pdflatex inclass.tex command. Hopefully, our inclass.tex file will survive the latex process and won’t have any errors. We should now have a file called inclass.pdf (along with .aux and .log files, which we don’t need).

If you are logged into a computer with an Adobe viewer, you can simply double-click on the inclass.pdf icon to view it. Another option to view inclass.pdf is with Foxit Reader on appserver. Start Foxit, and then open your file from there. Each time you make changes to your .tex file and re-compile it, you will need to close the pdf and re-open it again to see the changes.

There are a few ways to get help with LaTeX. One way is to use the on-line book, which is very good – all the commands you will need in this course are in there. Another way is to consult the built-in help at Start > Programs > MiKTeX > Help. I am also willing to help you, but only after you consult the on-line book and the MiKTeX help.

TeXnic Center(as opposed toCommand Line) Instructions

TeXnic Center is a GUI-based development environment for creating, editing, and compiling LaTex documents. It generally opens with three windows, a larger one in the upper left that keeps track of all files in a project, an editing window (like Notepad) on the upper right, and console along the bottom of the screen which displays messages when “compiling” your file. The user experience in TeXnic is very similar to that in a software development environment like Eclipse.

To begin, assuming from above you are already on the Appserver and have copied the files to your U: drive,

Start > Programs > TeXnic. You may be asked to go through the Configuration Wizard the first time you run it, which may prompt for the paths of some files (the prompt for the PDF viewer should already have Foxit, entered).

The executable files on the Appserver for TeX are located in:

D:/Program Files (x86)/MiKTeX 2.8/miktex/bin

and the file to open Postscript files are located in:

D:/Program Files/Ghostgum/gsview64.exe

Open your .tex file (using Open, NOT Open Project) from the File menu, edit it as needed, and then save it. Note that below the Tools menu is an option for the type of file to create, you should select LaTex => PDF. To create the .pdf, go to Build  Current File  Build and View. The compile/build messages will display in the console, and if there are no errors, your .pdf will appear. If you make changes, be sure to close the .pdf before rebuilding.
Old Instructions – Backup Plan

To convert the .tex file to a .dvi file, type latex inclass.tex .

Usually when you “latex” a file, you get several error messages – this is normal! Often they can be fixed easily – many times, you type a “{” without a “}” or a “begin{something}” without an “end{something}”. To fix the errors, simply go back to Notepad, edit the .tex file and save it again. Then retype the latex filename.tex command. Hopefully, our inclass.tex file will survive the latex process and won’t have any errors. We should now have a file called inclass.dvi (along with .aux and .log files).

To view inclass.dvi, try double-clicking on it in File Manager or Windows Explorer – or type
yap inclass.dvi in the DOS window. You might be able to print from Yap, although the output may not be exactly as you expect.

To create a postscript (.ps) file from the .dvi file, type dvips inclass –o inclass.ps in the DOS window. To view inclass.ps, try double-clicking on it in File Manager or Windows Explorer – or open GSview by Start > Programs > Ghostgum > GSview . You can print .ps files from here – they will look good. (Note: If you double-click on the .ps file, you might get sent to Acrobat Distiller, which will create a .pdf for you! You can then view this file and print it from Acrobat Reader – it will look very good!).