LaTeX Beginner's Guide - Second Edition

4 (1 reviews total)
By Stefan Kottwitz
    What do you get with a Packt Subscription?

  • Instant access to this title and 7,500+ eBooks & Videos
  • Constantly updated with 100+ new titles each month
  • Breadth and depth in over 1,000+ technologies
  1. Free Chapter
    Chapter 2: Formatting Text and Creating Macros
About this book

LaTeX is high-quality open source typesetting software that produces professional prints and PDF files. It's a powerful and complex tool with a multitude of features, so getting started can be intimidating. However, once you become comfortable with LaTeX, its capabilities far outweigh any initial challenges, and this book will help you with just that!

The LaTeX Beginner's Guide will make getting started with LaTeX easy. If you are writing mathematical, scientific, or business papers, or have a thesis to write, this is the perfect book for you. With the help of fully explained examples, this book offers a practical introduction to LaTeX with plenty of step-by-step examples that will help you achieve professional-level results in no time. You'll learn to typeset documents containing tables, figures, formulas, and common book elements such as bibliographies, glossaries, and indexes, and go on to manage complex documents and use modern PDF features. You'll also get to grips with using macros and styles to maintain a consistent document structure while saving typing work.

By the end of this LaTeX book, you'll have learned how to fine-tune text and page layout, create professional-looking tables, include figures, present complex mathematical formulas, manage complex documents, and benefit from modern PDF features.

Publication date:
October 2021


Chapter 1: Getting Started with LaTeX

You are familiar with word processing software: you type something, and the software prints it as it is on screen. In contrast, LaTeX, as typesetting software, receives instructions and text from you, and then creates the output. It produces high-quality output based on sophisticated algorithms for justification, text alignment, whitespace balancing, figure placement, and more, such as predefined formatting styles for headings and general page layout, which you can customize.

Are you ready to leave those "what you see is what you get" word processors behind and to enter the world of accurate, reliable, and high-quality typesetting? Yes? Then let's go together!

It's great that you decided to learn LaTeX. This book will guide you along the way to help you get the most out of it. Let's speak briefly about LaTeX's benefits and the challenges, and then we shall prepare our tools.

In this chapter, we will get to...


Technical requirements

We will focus on the Windows operating system here, but you can also install LaTeX on Mac OS X, Linux, and other systems.

A complete installation takes about 8 GB of disk space.

If you have an internet connection, you don't have to install LaTeX. You can use online LaTeX software, such as Overleaf. We will look at Overleaf at the end of this chapter.

All code examples of this book are available on GitHub at

On the book's website,, you can read, edit, and compile every code example in this book online without installing anything. An internet browser with JavaScript enabled is all you need for this, and a PC, laptop, tablet, or smartphone.


What is LaTeX?

LaTeX is free, open source software for typesetting documents. In other words, it's a document preparation system. LaTeX is not a word processor, but it's a document markup language.

It was initially written by Leslie Lamport and is based on the TeX typesetting engine by Donald Knuth. People often refer to it as just TeX, meaning LaTeX. It has a long history; you can read about it at

For now, let's continue by looking at how we can make the most of LaTeX.

Benefits of LaTeX

LaTeX is especially well suited for scientific and technical documents. LaTeX's superior typesetting of mathematical formulas is legendary. Suppose you are a student or a scientist. In that case, LaTeX is by far the best choice, and even if you don't need its scientific capabilities, there are other uses—it produces very high-quality output and is incredibly stable. It handles complex documents easily, no matter how large they...


Installing and using LaTeX

Let's start with the installation of the LaTeX distribution, TeX Live. This distribution is available for Windows, Linux, Mac OS X (MacTeX), and other Unix-like operating systems. TeX Live is well maintained, and it is actively developed.

Alternative LaTeX distribution

Another excellent and user-friendly LaTeX distribution for Windows is MiKTeX. It's easy to install, like any other Windows application. You can download it from Visit for a detailed, up-to-date comparison.

You can install TeX Live for a single user (that's you) or as a shared installation for all users on a computer. The latter is called admin mode. It requires running the installation as an administrator: either log in with an administrator account or right-click on the install program and choose Run as administrator.

It is recommended to install in single-user mode.

First, we will visit the TeX Live homepage...


Working with LaTeX online using Overleaf

Installing LaTeX on your computer is recommended, but it can take up about 8 GB on your hard drive and two hours to install it.

How about simply using LaTeX in your internet browser? Here comes Overleaf. It's a pure online LaTeX service that mathematicians enthusiastic about TeX started in 2011. You can access it through this link:

In this section about Overleaf, we will do the following:

  • Check the Overleaf requirements
  • Look at the benefits of Overleaf
  • Evaluate possible caveats
  • Use the Overleaf editor
  • Try out Writefull

Let's go online now.

What Overleaf requires and delivers

To use Overleaf, you need the following:

  • Any internet browser, such as Firefox, Chrome, Opera, or Edge.
  • You don't need any other local software such as a LaTeX compiler, editor, or PDF viewer.

It is free for basic usage, and that covers a lot. It provides a complete TeX...


Accessing documentation

There are many hundreds of LaTeX classes and packages available. No book could ever explain all its features on its own. But most of those packages offer good documentation that you can easily open and read. If you work your way through this book and supplement it with the documentation of the packages mentioned, you're on the right track to becoming a LaTeX power user.

In the following chapters, you will learn about many LaTeX packages that provide additional capabilities. To be prepared, you should just know how to access package documentation.

You can open a package manual directly on your computer after you have installed LaTeX:

  • On Windows computer: In the Start menu, choose the TeX Live folder, and click TeX Live command-line. Alternatively, just run the Windows cmd app.
  • On a Mac or any Linux computer: Start a Terminal app.

Then, just type texdoc packagename and press Enter. For example, typing texdoc geometry opens a PDF document...



We learned in this chapter about the benefits of LaTeX; soon, it will be our turn to use the virtues of LaTeX to achieve the best possible results. Furthermore, we covered installing, editing, and using LaTeX, both locally on your computer and online in the cloud.

Now that we've got a functional and tested LaTeX system, we're ready to write our own LaTeX documents. In the next chapter, we will talk about formatting text in detail.

About the Author
  • Stefan Kottwitz

    Stefan Kottwitz studied mathematics in Jena and Hamburg. He works as a network and IT security engineer both for Lufthansa Industry Solutions and for Eurowings Aviation. For many years, he has been providing LaTeX support on online forums. He maintains the web forums LaTeX and goLaTeX and the Q&A sites TeXwelt and TeXnique. He runs the TeX graphics gallery sites TeXample, TikZ, and PGFplots, the TeXlive online compiler, the TeXdoc service, and the CTAN software mirror. He is a moderator of the TeX Stack Exchange site and matheplanet. He publishes ideas and news from the TeX world on his blogs LaTeX and TeX. Before this book, he authored the first edition of LaTeX Beginner's Guide in 2011, and LaTeX Cookbook in 2015, both published by Packt.

    Browse publications by this author
Latest Reviews (1 reviews total)
Just started, but book reads pleasant and contents look quite usable
LaTeX Beginner's Guide - Second Edition
Unlock this book and the full library FREE for 7 days
Start now