LaTeX: Introduction to LaTeX

TeX is a document preparation system for high-quality typesetting. It is most often used for scientific documents but it can be used for almost any form of publishing.

TeX was designed with two main goals in mind: first, to allow anybody to produce high-quality books using a reasonable amount of effort, and, second, to provide a system that would give the exact same results on all computers, now and in the future.

was developed by Leslie Lamport, which makes document preparation much easier; LaTeX is so popular that nowadays a lot of people say TeX when they are thinking of LaTeX. In this tutorial we will use both TeX and LaTeX interchangeably to point to the same thing.

is a document preparation system for high-quality typesetting. It is most often used for scientific documents but it can be used for almost any form of publishing.

is based on the idea that it is better to leave document design to document designers, and to let authors get on with writing documents (You will see how in the next tutorial). In most typesetting or word-processing systems, the author would have to decide what layout to use. This has two results: authors wasting their time with designs; and a lot of badly designed documents!

is totally free.

is portable and runs on virtually any operating system in existence. MS Word only works on Windows, and even OpenOffice does not run on all Unixes (though that is improving).

is the de facto standard for the communication and publication of scientific documents, since it produces high quality documents (much better than typical, popular word processors).

was originally designed for mathematics-related writers so it is no problem to typeset nice-looking mathematics.

If you still don't see any advantages for over wordprocessors, please go ahead and try to write a more than 10 pages document on your beloved word processor and let us know if you can manage the bullets, numbering, justification, alignmnet, layout, tables, figures, table of contents, indices and others just the way you want. One more thing, don't forget to print out your document and check whether what you got is what you saw in the print preview.... or ? Will your document still have the same layout on the new version of your word processor that is claimed to have fixed all "bugs" in the previous version? Now what about the formulas, graphs, charts and... ? What about writing a thesis of a minimum of 100 pages, can you still manage?

If you can, then skip this tutorial package and enjoy your word processor with a cup of coffee. If you can't, don't worry, we will show you how to TeX it in 1/10 of the time you would need on a costly word processor, even before you finish your cup of coffee!

The next step is to find a TeX distribution and install it on your system. In this series of tutorials, we will be demonstrating on a windows platform. Nevertheless, for Linux or Mac you don't need any changes within the documents, you just need to find the right TeX source. This shouldn't be a problem, go ahead Google it, or use TeXLive.

TeX and LaTeX are rather small programs, that can be extended by external packages. Therefore, they are usually offered as distributions. Some of the most popular are MiKTeX and TeXLive. For windows, and along this tutorial we will be using MikTeX.

To download MikTeX for windows, go to and download the "Basic MiKTeX" Installer ( around 44 MB).

You should have downloaded something like basic-miktex-2.5.2471.exe. Run the installer, it's pretty straight forward. Proceed as it suggests and now you should have MikTeX up and running on your system.

It is a good idea that you test your MikTeX after restarting the computer. Just for the moment, open any text editor (e.g. Notepad, Wordpad) type the following text and save the file as mikTest.tex .

\documentclass{article} \begin{document} My first \TeX~document. \end{document}

Now go to your console (command prompt) and change directory to where you have your mikTest.tex and execute the following command. Here we're assuming mikTest.tex is on the root of D:

D:\>latex mikTest.tex

You should have obtained few files (never mind for now) and mikTest.dvi. The DVI file is viewable with Yap that comes with the TeX distribution and should look like this:

Although DVI files are portable, the defacto standard for document formats is PostScript (which allows the file to be printed by simply copying it to a PostScript printer) and PDF.

To obtain the PostScript file from dvi:

D:\>dvips mikTest.dvi

To be able to view PostScript, you need an interpreter. The most popular is GhostScript.

To obtain the PDF file from dvi:

D:\>dvipdfm mikTest.dvi

You need to download a pdf reader to view your pdf file, the most popular is Adobe Reader.

Most probably you will need to obtain the PDF directly from the .tex file without an intermediate dvi:

D:\>pdflatex mikTest.tex

>> Download mikTest.tex , , mikTest.pdf .

You are now already ready to start TeXing. Nevertheless, it is highly recommended that you use an editor and also encouraged to pick the editor you are most comfortable with. There are lots of editors out there, but take care a lot of them are demolishing the idea of LaTeX and making it more like word processors. Throughout the next few steps, we will be using LEd LaTeX Editor, which is quite simple and only provide assistance with basic techniques as parenthesis matching and code folds. Again, you are highly encouraged to look for an editor which most comforts you, for example a lot of hackers would prefer to use the primitive emacs.

To download LEd for windows, go to and for convenience download the "Installer Version" ( around 4.6 MB).

You should have downloaded something like LEdBeta(0.52)Build(6300)Std.exe. Run the installer, it's pretty straight forward. Proceed as it suggests and now you should have LEd up and running on your system.

For a bug fix, please download dvi_miktex25.dll, copy the file to the bin directory of your MikTeX distribution. It should look something like 'D:\Program Files\MiKTeX 2.5\miktex\bin'

When running LEd for the first time, you can select which file extensions should be associated with LEd. Then, you should select from the menu the option Configuration\Options. This dialog window contains most of the configuration options.

In the section Application\Directories, you can choose the directories used by LEd. You should change them only in special cases, when you know what you want to do. The only directory which you would probably want to change is Projects. This is the default directory, in which LEd's projects will be stored.

In the section Application\DVI Viewer:

  1. Set the "TeX executables": to the miktex\bin directory of your MikTeX distribution. It should look something like 'D:\Program Files\MiKTeX 2.5\miktex\bin' This should be the directory where you copied dvi_miktex25.dll.
  2. Choose the "TeX distribution" to be: 'based on MikTeX'.
  3. The "Font searching library" should be set to: 'dvi_miktex25.dll' (you should type the name, not select from the list).
  4. The "Font making script " should be set to: 'makepk.exe'.
  5. The "Fallback font " should be set to: 'cmr10'.
  6. The "mode" should be set to: 'ljfour'.
  7. The "resolution" should be set to: '600 dpi'.
  8. The value of "Temporary files" should point to any directory which can be used for temporary files, something like 'C:\Documents and Settings\acer\Local Settings\Temp'
  9. The value of both "GSDLL32.DLL library" & "PostScript Fonts" should point to a directory containing the Ghostscript binaries, i.e, the file gsdll32.dll, e.g., 'C:\Program Files\GPLGS'.
  10. You also need to check the option 'Show EPS figures'.

To sum up, here's a snapshot of a sample LEd Configuration.

Congrats! Now you're ready to start TeXing and produce state-of-the art documents, papers and even books. It is a fact that the installation has taken a bit of your time, but it is 100% guaranteed to save you hours and hours of work. This tutorial series will continue to offer you assistance with your vey first steps and even more advanced typesetting in LaTeX.

The next tutorial, will take you a in a tour with the basic features of LaTeX. How to start writing simple documents with lists, unordered lists, paragraphs, definitions and others. The tutorial provides also the source code and the final output so that you can always make sure it's correct.