LaTeX Tutorial


What is LaTeX?

It is a typesetting program. It is different from Word as the page settings, alignments are fixed in the template itself with little user control over it (unless you know how to create a template). One needs to fit his/her content in a pre-created template. This is advantageous in many ways as LaTeX itself takes care of alignment of text, new paragraphs, equations, figures etc. The procedure of typesetting is similar to programming.


What do I need to install LaTeX?

Similar to working in any programming language, we need three programs, an editor, a compiler and an output viewer. LaTeX code is written in the editor. Compiler makes sense of the code and produces the document in various formats (DVI, PostScript, PDF). The output viewer views this document.

  • Editor - There are many user friendly editors available, e.g. WinEdt.
  • Compiler – The most commonly used LaTeX compiler is MikTeX.
  • Viewer – Yap (for DVI), Adobe Reader, Foxit Reader (for PDF).

Some softwares pack editor and viewer in single application. Texmaker is free and I find it most user friendly of the lot. I have used Texmaker for this tutorial.

Here’s what you need to start using LaTeX.

Installation procedure

  • Download MikTeX and TexMaker.
  • First install MikTex (preferably the complete version).
  • Install TexMaker.

Working with LaTeX

It's easier (and quicker) to learn by making small modifications in a working LaTeX code and compiling it to see output.

  • Download the file edit_me.zip.
  • Extract and find three files in it named edit_me.tex, database.bib and demo.pdf.
    edit_me.tex uses IEEE conference template. database.bib is a BibTeX file used for adding citations in your document. demo.pdf is what your document looks like when 'edit_me.tex' is compiled.
  • Open edit_me.tex in Texmaker.
  • Click on Tools and do the following.
    BibTeX -> PDFLaTeX -> PDFLaTeX -> View PDF
    Screenshot is attached below for reference.

    LaTeX screenshot

    BibTeX command compiles citations that have been added in database.bib file. PDFLaTeX command compiles the LaTeX code in edit_me.tex and generates PDF file of the same name.
  • Play around with the tex file and observe the changes in final document.

Tips


  • Most of the commands like \abstract{}, \section{}, \subsection{} are common for different document types. Thus though provided example code uses IEEE template, the code that lies between \begin{document} and \end{document} can be used in other templates as well.
  • If you get an error 'Package "xyz" not found', go to Start menu -> MikTeX -> Package Manager (Administrator). In the Package Manager, search for keyword "xyz". Install all packages in returned searches.
  • For more info, refer this wiki.