This lesson is about what LaTeX is and how to use it.

What is LaTeX?

LaTeX is used to typeset scientific documents. It is based on the programming language TeX, which is designed for writing mathematical texts. There are fundamental differences between LaTeX and other word processors such as MS Word and Pages.

Pros
Cons

The approach LaTeX used is called What You See Is What You Mean; when writing the document you can’t see the final result. Instead you see the structure of the document.

Using LaTeX

In this course you will learn to work with TeXworks. However, everything you learn about LaTeX itself is independent of your LaTeX editor.

TeXworks
A simple editor which is included in the LaTeX distributions MikTeX and TeX Live.
Overleaf
An online editor where you can collaborate with others. It is convenient to use this on computers where LaTeX isn’t installed. Nowadays lots of students use Overleaf, but to learn LaTeX we start using TeXworks. Afterwards students are free to use Overleaf.

In the first exercise we will assume that you use TeXworks. To install this, see Installing LaTeX

Exercise 1

  • Open ‘TeXworks’ on your computer.
  • Paste the following code in an empty document and save it as ‘helloworld.tex’. The extension of a TeX file always is ‘.tex’.
    \documentclass[a4paper]{article}
    \begin{document}
    Hello world!
    \end{document}
    
  • Select ‘pdfLaTeX’ in the menu to the right of the green button and press the green button afterwards. We call this typesetting. LaTeX turns your code into a PDF document which you will see in a new window.
  • Useful: Select ‘Format -> Line Numbers’ to make it easier to find and refer to specific lines of code.
  • Useful: To jump from the code to the output in TeXworks you can right-click and choose ‘Jump to PDF’. In the same way it is possible to switch from the pdf to the code.

Exercise 2

  1. On your computer create a folder LaTeX (a subfolder of the Programmeren en Experimenteren-folder).
  2. Place the example file created above in this folder.
  3. Do the same with all the LaTeX-files you will use in this course.

Exercise 3

  1. Download this (https://ctan.org/tex-archive/macros/latex/base/small2e.tex) introductory LaTeX document.
  2. Open this file in TeXworks.
  3. Typeset the document.
  4. Compare the input with the output.

From now on we start using TeXworks. Any homework exercises you are asked to hand in have to be functional in TeXworks. Be aware that files that work correctly in overleaf do not always work correctly in TeXworks, due to overleaf automatically ignoring some errors. Always make sure to check your work if you have been using Overleaf.

Resources

This website is only indended to teach LaTeX through exercises, it is not a reference for LaTeX. Please consult:

LaTeX Wikibooks
An up-to-date collection of articles about LaTeX. In this course, it is the standard LaTeX reference.
Detexify
A tool to find the LaTeX command that produces some symbol.
TeX - LaTeX Stack Exchange
A question and answer site with many active users. For the students who want to know more.

Remember

  • How to open TeXworks (or Overleaf)?
  • How to compile a LaTeX file?
  • Don’t be afraid to explore the web!