Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
LaTeX Cookbook
LaTeX Cookbook

LaTeX Cookbook: Over 100 practical, ready-to-use LaTeX recipes for instant solutions , Second Edition

eBook
€15.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Colour book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Table of content icon View table of contents Preview book icon Preview Book

LaTeX Cookbook

Exploring Various Document Classes

Documents vary in shape and size, with distinct formats, sections, and designs. You can use LaTeX for any kind of document type. This chapter is packed with recipes suitable for an assortment of document types.

Specifically, we will cover the following:

  • Preparing your LaTeX tools
  • Writing a short text
  • Developing a thesis
  • Designing a book
  • Creating a presentation
  • Designing a curriculum vitae (CV)
  • Writing a letter
  • Producing a leaflet
  • Building a large poster

Throughout this chapter, you will get step-by-step instructions, tips, and tricks to help you create each document type easily. By the end of this chapter, you’ll have a solid foundation in creating a wide range of documents using LaTeX.

All example code is available on GitHub for download. You can find all examples of this chapter at https://latex-cookbook.net/chapter-01, where you can also compile them online.

Preparing your LaTeX tools

LaTeX has been around for many years. Over time, developers and authors contributed numerous extensions to its code base.

Such an extension could be one of the following:

  • Document class: A base file that is the frame of your document. It provides various formatting styles and usually comes with meaningful default settings, which can be changed via options when loading it. It often provides commands for authors to modify settings.
  • Package: A style file with a specific purpose that you can load in addition to the document class. Packages can be combined. Most of the time, we load many of them by executing the \usepackage command.
  • Bundle: A set of closely related packages or classes. In our next recipe, Writing a short text, we will get to know some bundles.
  • Template: A document with dummy text that you can take as a starting point and fill in your headings, texts, formulas, and images. We will look at templates in another recipe, Developing a thesis.

Those add-ons are incredibly valuable. They are one reason for the enduring success of LaTeX. We all agree that learning LaTeX can be challenging with its steep learning curve. However, if you don’t reinvent the wheel and start with a good template or class and a quality set of packages, you can quickly achieve great results.

The purpose of this book is to assist you in this regard.

Getting ready

To be able to work with LaTeX, you need to have the following installed on your computer:

  • TeX and LaTeX software, called a TeX distribution
  • A LaTeX editor, though you could use any text editor
  • A PDF viewer for seeing the final output

If you already have those installed, great! In that case, you can skip the following paragraphs and immediately proceed to the first recipe.

A PDF reader is probably already installed on your computer, such as Adobe Reader or the Preview app on the Mac. Furthermore, most editors come with an integrated PDF previewer. So, let’s have a look at TeX software and editors.

TeX and LaTeX distributions

There are TeX and LaTeX software collections ready to use and easy to install. Their websites provide install and update information. You may choose the download site for your system:

  • TeX Live: On https://tug.org/texlive, you can find download information and installation instructions for the cross-platform TeX distribution, which runs on Windows, Linux, Mac OS X, and other Unixes. It is supported by the TeX Users Group (TUG).
  • MacTeX: This is based on TeX Live and has been significantly customized for Mac OS X. Essential information is available at https://tug.org/mactex.
  • MiKTeX: A download and documentation for the Windows-specific distribution can be found at https://miktex.org.

If you own a Mac, I suggest selecting MacTeX. Otherwise, I recommend using TeX Live because the TUG provides excellent development and support.

Describing the setup is outside the scope of this book. For TeX Live, you can find a step-by-step explanation with screenshots in the LaTeX Beginner’s Guide by Packt Publishing. Generally, you can find detailed setup instructions when you visit the aforementioned internet addresses.

Finally, on Linux systems, such as Ubuntu, Debian, Red Hat, Fedora, and SUSE versions, a TeX Live-based software package is usually available via the operating system repositories. While it’s usually not as up to date as an installation via the TeX Live website or a TeX Live DVD, it’s straightforward to install using the Linux package manager you deploy to install any software there.

I strongly recommend choosing a complete LaTeX installation containing all available software, packages, and fonts. At the time of writing, it typically requires around 8 GB of disk space, but it guarantees you won’t encounter any missing packages or dependencies later.

LaTeX editors

There are many LaTeX editors, from small and quick to feature-rich editors. The TeX distributions already provide the fine editor TeXworks, which I use myself. You set it up with TeX or a package manager on Linux, and it can be downloaded from https://tug.org/texworks.

You can find a collection of LaTeX editors and additional software at https://latex.net/software. You may look for alternative editors running on your operating system there.

Using LaTeX online

A complete online cloud solution for LaTeX saves you from installing LaTeX software yourself. The most advanced one is called Overleaf and comes with an online LaTeX editor that runs in a web browser, so you can use it even on tablets and smartphones for storing, editing, and compiling even large LaTeX projects. You can find it at https://www.overleaf.com. While registration is necessary, basic access to the platform is free. Some advanced features require purchasing a subscription, but it’s worth noting that many universities and institutions partner with Overleaf and provide enhanced licenses for their students and employees.

The LaTeX Beginner’s Guide explores Overleaf in more detail; you can find this section online at https://latexguide.org/overleaf.

If you need help setting up and using LaTeX or an editor, you can visit a LaTeX web forum such as https://latex.org. In Chapter 12, Getting Support on the Internet, you can find their addresses and how to use them. You can also meet me there and ask me and our fellow forum users any LaTeX-related questions.

Once you have done the installation or online setup, you can start with a LaTeX recipe from the following sections.

See also

Many LaTeX tutorials available on the internet can help you with the first steps. I recommend looking at the following:

  • https://learnlatex.org covers the most essential LaTeX basics in short lessons in 10 languages. It is very modern and comes with an online compiler for its examples.
  • https://texdoc.org/pkg/lshort is the web link for The not so short introduction to LaTeX2e, a famous introductory text. It has been translated into more than 20 languages, available at https://ctan.org/pkg/lshort.
  • https://www.overleaf.com/learn takes you to the Overleaf knowledge base with various guides and many articles about LaTeX.
  • https://en.wikibooks.org/wiki/LaTeX takes you to the LaTeX Wikibook, a collaboratively created extensive guide.
  • https://www.dickimaw-books.com/latex/novices contains the free introductory book LaTeX for Complete Novices by Nicola L. C. Talbot. It is somewhat dated but OK for the first steps.
  • https://latex2e.org hosts the Unofficial reference manual for LaTeX, an excellent resource whenever you need to know how to use specific LaTeX commands, environments, arguments, and syntax in general.
  • https://latexguide.org is the website for the LaTeX Beginner’s Guide, with a sample chapter, all code examples by chapter, reviews, and additional information in case you’re considering buying a modern book on paper or in electronic format.

If you still need to learn LaTeX, read one of the guides, and you will then be well prepared to get the best out of this book.

Writing a short text

While LaTeX is excellent for large documents, it’s as useful for smaller ones, and you get all the features to work with. Writing down homework or producing a seminar handout, for example, doesn’t need book-like chapters, and the layout would not be very spacy. So, we will choose a document class that suits it best.

Class bundles cover commonly used document types. Every LaTeX installation contains a base bundle with standard classes. There is a class file for articles, one for books, one for reports, one for letters, and more. It is stable stuff; it has stayed the same for many years. It can be sufficient if you don’t care about the latest style. It would run even on a 10-year-old LaTeX installation.

In this recipe, we will use a class of the KOMA-Script bundle. This is a set of document classes and packages designed initially to replace the standard classes and provide more features. In contrast to the stable base bundle, KOMA-Script has been extensively developed in recent years. It has become feature-rich and has an excellent user interface. Parts of its functionality are provided in packages that can be used together with other classes as well. You can identify KOMA-Script classes and packages by the scr prefix. This prefix stands for Script, which was the initial name of this bundle.

How to do it...

We will start with a complete small document, already using various features. This can be your template, where you can fill in your own text later.

While we go through the document step by step, you may open the complete code directly with your editor, so you don’t need to type it. It is contained in the code bundle available on the book’s page at https://www.packtpub.com and https://latex-cookbook.net:

  1. Create a .tex document in the editor of your choice. Start with a document class. We will use the scrartcl KOMA-Script class with A4 paper size, a base font size of 12 pt, and inter-paragraph space instead of default paragraph indentation:
    \documentclass[paper=a4,oneside,fontsize=11pt,
      parskip=full]{scrartcl}
  2. Begin the document:
    \begin{document}
  3. By running this command, you let LaTeX print a table of contents:
    \tableofcontents
  4. Start a section without numbering:
    \addsec{Introduction}
  5. Add some text:
    This document will be our starting point for simple
    documents. It is suitable for a single page or up to
    a couple of dozen pages.
    The text will be divided into sections.
  6. Start an automatically numbered section with some text:
    \section{The first section}
    This first text will contain
  7. Add a bulleted list using an itemize environment. Each list item starts with an \item command. Using the \ref{label} command, we will already refer to labels we will create later:
    \begin{itemize}
      \item a table of contents,
      \item a bulleted list,
      \item headings and some text and math in section,
      \item referencing such as to section
        \ref{sec:maths} and equation (\ref{eq:integral}).
    \end{itemize}
  8. Continue with the text, and start another numbered section:
    We can use this document as a template for filling
    in our own content.
    \section{Some maths}
  9. Set a label so that we can refer to this point when we would like to refer to this section:
    \label{sec:maths}
  10. Continue with the text. We start using some math expressions in the text. We mark them by enclosing them in parentheses with a prefixing backslash as follows:
    When we write a scientific or technical document, we
    usually include math formulas. To get a brief glimpse
    of the look of maths, we will look at an integral
    approximation of a function \( f(x) \) as a sum with
    weights \( w_i \):
  11. Write a math equation using the equation environment. Again, place a label:
    \begin{equation}
    \label{eq:integral}
      \int_a^b f(x)\,\mathrm{d}x \approx (b-a)
      \sum_{i=0}^n w_i f(x_i)
    \end{equation}
  12. End the document:
    \end{document}
  13. Compile the document. Do it twice so that the references work. The first page of the output will be as follows:
Figure 1.1 – A document with sections, math, and referencing

Figure 1.1 – A document with sections, math, and referencing

How it works...

In the first line, we loaded the scrartcl document class. In square brackets, we set options for specifying an A4 paper size with the oneside option for one-sided printing and a font size of 11 pt. Finally, we chose to have a full line between paragraphs in the output to distinguish paragraphs easily by adding the parskip=full option.

The default setting is no space between paragraphs but a small indentation at the beginning of a paragraph. Remove the parskip option to see it. We chose a paragraph skip because many people are used to it when working with emails, while indentation costs line space, a precious resource on small electronic devices.

Without further ado, we began the text with a table of contents.

While the \section command starts numbered sections, we can have an unnumbered section by the starred \section* version. However, we used the \addsec KOMA-Script command for the first unnumbered section. That’s because contrary to \section*, the \addsec command generates an entry in the table of contents.

The empty line in step 5 tells LaTeX to make a paragraph break. Note that a simple line break in the LaTeX code doesn’t cause a line break or paragraph break in the output.

As bulleted lists are an excellent way to present points clearly, we used an itemize environment in step 7. Environments start with a \begin command and are finished by an \end command.

Note

If you want a numbered list, use the enumerate environment.

An equation environment has been used to display an automatically numbered formula. We used a \label command to set an invisible anchor mark so that we could refer to it using its label name by the \ref command and get the equation number in the output.

Choosing label identifiers

It is a good practice to use prefixes to identify kinds of labels, such as eq:name for equations, fig:name for figures, tab:name for tables, and so on. Avoid special characters in names, such as accented characters.

In step 10, small formulas within text lines have been enclosed in \( ... \), which provides inline math mode. Dollar symbols, such as $ ... $, can be used instead, making typing easier. However, the parentheses clarify where the math mode starts and ends, which may be beneficial when many math expressions are scattered in the text, and the “dollar syntax” is old TeX syntax.

Why did we have to compile it twice? When you use the \label command, LaTeX writes that position to the .aux file. In the next compiler run, the \ref command can read this and put the correct reference into the text.

For further information on math typesetting, refer to Chapter 10, Writing Advanced Mathematics, specifically to the Fine-tuning a formula recipe.

See also

The part of the document before \begin{document} is called the preamble. It contains global settings. Adding a few lines to our document preamble can improve and modify our document’s general appearance. Chapter 2, Tuning the Text, starts with beneficial additions to the preamble that are also useful with small documents.

In Chapter 3, Adjusting Fonts, you can find recipes for changing an entire document’s fonts or specific elements.

For further customization tasks, such as modifying page layout, adding headers and footers, and changing sectioning title font, refer to the Designing a book recipe in the current chapter. We will look at such settings on the occasion of a book example.

Developing a thesis

When you write a large document such as a thesis, you have two main choices: choose a ready-made template or set up your own document environment. If you have little time and need to start your thesis fast, a template can come to the rescue.

Beware of outdated and questionable templates found somewhere on the internet. Look first at the date and at user opinions, such as in web forums. The age of a template is not a problem in itself, as LaTeX can run it the same way when it’s been written. However, LaTeX developed, and better solutions came up over time. Legacy code may not benefit from it.

Some universities provide their own template. That may be OK because requirements would be met for sure; just check if it can be improved – for example, by replacing obsolete packages with recommended successors.

An excellent source for checking the quality of a template is the guide to obsolete commands and packages in LaTeX2e; people call it l2tabu. You can open the English version by typing texdoc l2tabuen at Command Prompt or at https://texdoc.org/pkg/l2tabuen.

To be clear, the LaTeX base is stable and solid, but there are changes in community-contributed packages.

In the previous recipe, Writing a short text, we took a bottom-up approach and built a document from scratch, adding what we desired. Now, we will go top-down: let’s use and understand a complete template, removing what we don’t need.

As we need to choose a template now, let’s take a real gem. The ClassicThesis package by Prof. André Miede is a thesis template of excellent quality. The design follows the book classic The Elements of Typographic Style by Robert Bringhurst; we will see some particular points later in this recipe. Its implementation is thoughtful and modern. Initially written in 2006, it’s also maintained today and shipped with TeX distributions.

Getting ready

Though the ClassicThesis package may already be installed on your TeX system, named classicthesis.sty, the whole template is an archive of files that should go into your working directory.

Download the ClassicThesis archive from the following Comprehensive TeX Archive Network (CTAN) address: https://ctan.org/pkg/classicthesis.

Instead of fetching single files, choose to download them as a .zip file. Unzip it to where you keep your personal documents in its own directory. This directory will be your thesis directory.

This package provides a ready-made structured filesystem of the main document, style file, settings file, and document parts such as abstract, foreword, and chapters in dedicated files. You can edit all files and fill in your own text.

The ClassicThesis.tex file is the main document. Its filler text is the template’s manual; this allows us to compile it immediately to look at the output design. Also, you can verify that your TeX installation can handle it if you need to install additional packages.

How to do it...

After unzipping, your directory will have this structure:

Figure 1.2 – The directory structure of the ClassicThesis template

Figure 1.2 – The directory structure of the ClassicThesis template

Now, follow these steps:

  1. Rename or copy the ClassicThesis.tex file and choose your own name, such as MyThesis.tex, but keep it in the same directory.
  2. Open the main document, MyThesis.tex, and look around to get a feeling of the structure. Compile it for testing at least twice to get correct referencing so that you know that this starting point works.
  3. You can review and edit the settings in the main file, MyThesis.tex, and in the classicthesis-config.tex configuration file. On the following pages, we will examine that content.
  4. Open the existing .tex files, such as Abstract.tex and Chapter01.tex, with your editor. Remove the filler text and type in your own text. Add extra chapter files as needed, and include them in the main file, MyThesis.tex, as well. The structure is given; the technical part of the editing is like cloning files and copying lines; all you need to focus on is the actual thesis content now.

Don’t worry if the font or margins don’t please you yet. You can change the layout at any time. Let’s take a closer look now, and then you will know how.

How it works...

We will now look at the functional lines of the main file, MyThesis.tex.

The document preamble starts as follows:

\documentclass[ twoside,openright,titlepage,                numbers=noenddot,headinclude,                footinclude,cleardoublepage=empty,                abstract=on,BCOR=5mm,paper=a4,                fontsize=11pt                ]{scrreprt}\input{classicthesis-config}

The template is built on the scrreprt KOMA-Script class. KOMA-Script as a LaTeX bundle is described in the first recipe of the current chapter, Writing a short text.

You can change the pre-set options to those you need, such as font size or BCOR binding correction. There are many class options for adjusting the layout. You can read about them in the KOMA-Script manual, such as by running texdoc koma-script at the command line or at https://texdoc.org/pkg/koma-script. In our next recipe, Designing a book, we will discuss some of them in more depth.

Loading of packages and all the remaining settings is done in a single file, classicthesis-config.tex. We will look at it later in this recipe.

The document body starts with the following text:

\begin{document}\frenchspacing\raggedbottom\selectlanguage{american}\pagenumbering{roman}\pagestyle{plain}

The \frenchspacing command means that there’s only a single space following the punctuation after a sentence. LaTeX puts extra space between sentences by default, or if you enter the \nonfrenchspacing command.

The language is set to American English, which is essential for American hyphenation. Actually, you would need the \selectlanguage command only if you need to switch between languages.

We start with Roman page numbers. The plain page style means we have no page headers for now, while page numbers are centered in the page footer.

Then, we see the front matter, which is the part of the document where the formal parts before the actual content go:

\include{FrontBackmatter/DirtyTitlepage}\include{FrontBackmatter/Titlepage}\include{FrontBackmatter/Titleback}\cleardoublepage\include{FrontBackmatter/Dedication}%\cleardoublepage\include{FrontBackmatter/Foreword}\cleardoublepage\include{FrontBackmatter/Abstract}\cleardoublepage\include{FrontBackmatter/Publication}\cleardoublepage\include{FrontBackmatter/Acknowledgments}\cleardoublepage\include{FrontBackmatter/Contents}

Each commonly required part of the front matter has its own file. Just edit the file as needed, comment out using a % sign at the beginning of a line, or remove what you don’t need. The \cleardoublepage command ends a page but also ensures that the next page starts on the right-hand side. This can mean inserting an empty page if necessary – that is, a double-page break. It would not happen if you changed the twoside option to oneside, so you could keep that \cleardoublepage command, which would act like a \clearpage command when the oneside option was set.

Finally, we get the main matter:

\cleardoublepage\pagestyle{scrheadings}\pagenumbering{arabic}\cleardoublepage\part{Some Kind of Manual}\label{pt:manual}\include{Chapters/Chapter01}\cleardoublepage\ctparttext{You can put some informational part  preamble text here...}\part{The Showcase}\label{pt:showcase}\include{Chapters/Chapter02}\include{Chapters/Chapter03}

In the main matter, the page style is set to scrheadings, and we use Arabic page numbers. The \pagenumbering command resets the page number to 0.

The thesis is divided into parts. Each one is split into chapters. You can omit the \part lines if your highest sectioning level should be the chapter level.

Each chapter gets its own .tex file in the Chapters subdirectory, so you can easily handle a massive text. Furthermore, you could use the \includeonly command to typeset just selected chapters to speed up writing.

Finally, the main document ends with the back matter:

\appendix\cleardoublepage\part{Appendix}\include{Chapters/Chapter0A}\cleardoublepage\include{FrontBackmatter/Bibliography}\cleardoublepage\include{FrontBackmatter/Declaration}\cleardoublepage\include{FrontBackmatter/Colophon}\end{document}

The \appendix command resets the sectioning counters and changes to alphabetic numbering; the following chapters will be numbered by A, B, and so on. As with the front matter, the appendix parts are divided into several files.

Let’s take a look at the configuration file. Open classicthesis-config.tex. It would take too much space in the book, so let’s just see some sample lines:

\newcommand{\myTitle}{A Classic Thesis Style\xspace}\newcommand{\myName}{Andr\'e Miede\xspace}\newcommand{\myUni}{Put data here\xspace}\newcommand{\myLocation}{Darmstadt\xspace}\newcommand{\myTime}{January 2024\xspace}

Here, you can fill in your own data. Besides being printed on the title page, this data will be used as metadata for the generated PDF document. There are more supported macros at this place, such as \mySubtitle, \myProf, and many more. The \xspace command takes care of proper spacing after such a macro, inserting a space when there’s no punctuation mark following it.

There’s more...

As mentioned, this template contains design decisions inspired by the book The Elements of Typographical Style by Robert Bringhurst. The most notable are as follows:

  • It doesn’t use bold fonts – small caps or italics elegantly emphasize what’s important.
  • The text body is not very wide, allowing reading comfortably without the eyes jumping too wide from the right back to the left. So, we have wide margins, which can be used for notes.
  • The table of contents is not stretched to get right-aligned page numbers. To quote the author: “Is your reader interested in the page number, or does she want to sum the numbers up?” That’s why the page number follows the title.

Explore the classicthesis-config.tex file further to make modifications. As in the previous recipe, we apply document-wide changes within the preamble; this file is the place for doing it.

We will take a look at the selected lines of that configuration file.

Getting a right-justified table of contents

The design is not set in stone; you may adjust a lot. Look at the very beginning of classicthesis-config.tex:

\PassOptionsToPackage{  drafting=true,  tocaligned=false,  dottedtoc=false,  eulerchapternumbers=true,  linedheaders=false,  floatperchapter=true,  eulermath=false,  beramono=true,  palatino=true,  style=classicthesis}{classicthesis}

Here, you can find the options for the actual classicthesis package. For example, if you would like to see the page numbers in the table of contents right aligned, set the dottedtoc option to true. These and further options are documented in the template’s manual available by executing the texdoc classicthesis command or at https://texdoc.org/pkg/classicthesis.

Changing the margins

To fulfill requirements on page margins or implement your layout ideas, you can specify exact page dimensions by loading the geometry package. Here’s an example:

\usepackage[inner=1.5cm,outer=3cm,top=2cm,bottom=2cm,  bindingoffset=5mm]{geometry}

Here, you can also provide a value for the space you may lose by the binding and all margins you would like. It’s a good practice to have a visible inner margin set to half the value of the outer one because margins would be added in the middle. For single-sided printing, with oneside options, call the margins left and right.

Place such a line at the end of classicthesis-config.tex so that it will override previously made original settings.

Modifying the layout of captions

In the classicthesis-config.tex file, you can also change the appearance of captions of figures and tables. This is the default setup in that file:

\RequirePackage{caption}\captionsetup{font=small}

Here, the template loads the caption package. The \RequirePackage command is similar to the \usepackage command except that it can be used before the \documentclass command. The caption package provides many features for fine-tuning captions. With this setting, captions have a smaller font than regular text. By adding simple options, you can further adjust the appearance; for example, by adding the option labelfont=it, you would get italic caption labels. Refer to the caption package manual at https://texdoc.org/pkg/caption to learn more.

Note

While the caption package is a general solution working with most classes, including KOMA-Script, the latter now offers extended integrated caption features.

Centering displayed equations

Another option is responsible for the alignment of displayed equations:

\PassOptionsToPackage{fleqn}{amsmath}\usepackage{amsmath}

With ClassicThesis, displayed equations will be left aligned. The fleqn option is switching to this alignment. If you want to restore the default behavior centering the equations, remove that first line that passes the option or comment it out. But keep the second line, which loads the amsmath package, as this is the de facto standard package for typesetting mathematics in LaTeX.

See also

You can find many recipes for content elements in the following chapters for your thesis. Especially for a beautiful thesis, elegant tables are of great value, so you may look at the Designing a legible table recipe in Chapter 4, Creating Tables.

At https://latextemplates.com, you can find a collection of excellent templates, including thesis templates.

Overleaf provides hundreds of thesis templates at https://www.overleaf.com/latex/templates/tagged/thesis, including templates of universities, so check out descriptions and tags for your university’s name.

Designing a book

A book can be a large document, so we can take a similar approach to the previous recipe. Refer to that recipe to see how to split your document into handy files and how to organize the directory structure.

Commonly, books are printed two-sided. In contrast to articles, they are divided into chapters, which start on right-hand pages, have pretty spacy headings, and often a page header showing the current chapter title. Readability and good typography are essential, so you would hardly find books with an A4 paper size, double line space, and similar specs, which some institutes expect of a thesis. That’s why we got dedicated book classes with meaningful default settings and features.

How to do it...

As the Writing a short text recipe explains, our choice will be a KOMA-Script class; this time, it has the name scrbook.

Follow these steps:

  1. Start with the scrbook class and suitable options for paper and font size:
    \documentclass[fontsize=11pt,paper=a5,
      pagesize=auto]{scrbook}
  2. Choose a font encoding with the following command; use T1, which is good for European, English, or American texts:
    \usepackage[T1]{fontenc}
  3. If you want a non-default font, load it; here, we chose Latin Modern:
    \usepackage{lmodern}
  4. We will load the blindtext package for getting English dummy texts; it also requires loading the babel package with English settings:
    \usepackage[english]{babel}
    \usepackage{blindtext}
  5. Load the microtype package for better text justification:
    \usepackage{microtype}
  6. By running the following command, you can switch off additional space after sentence punctuation:
    \frenchspacing
  7. Begin the document:
    \begin{document}
  8. Provide a title, a subtitle, an author name, and a date. You can also set an empty value if you don’t want to have something in that titling field:
    \title{The Book}
    \subtitle{Some more to know}
    \author{The Author}
    \date{}
  9. Let LaTeX print the title page:
    \maketitle
  10. Print out the table of contents:
    \tableofcontents
  11. In addition to chapters, we will divide this book into parts, so start one:
    \part{First portion}
  12. Start a chapter with a heading. Having text before another heading comes is nice, so let’s have some:
    \chapter{The beginning}
    Some introductory text comes here.
  13. As in our first recipe, add a section and text and another part with a chapter and sections. Using the \Blindtext command, you can generate long dummy text; use the \blindtext command to get shorter dummy text. The \appendix command switches to alphabetic numbering:
    \section{A first section}
    Dummy text will follow.
    \blindtext
    \section{Another section}
    \Blindtext
    \appendix
    \part{Appendix}
    \chapter{An addendum}
    \section{Section within the appendix}
    \blindtext
  14. End the document:
    \end{document}
  15. Let your editor compile the text to PDF. You will get a 13-page book document with A5 paper size, a title page, part pages, chapter, section headings, and filler text.

    Take a look at a sample page:

Figure 1.3 – Page 7 of the sample book with chapter and section headings

Figure 1.3 – Page 7 of the sample book with chapter and section headings

Note the headings in a sans-serif font. This is an intentional default setting in KOMA-Script classes, which makes the headings lighter than the standard LaTeX big, bold, and serif headings. You know – the traditional look.

Now, you can fill in your own text, add chapters and sections, and add features described later in this recipe.

How it works...

At first, we loaded the scrbook class, made explicitly for writing books. So, it is ready for two-sided printing with meaningful margins and pleasing proportions of headings and text.

Besides the class’s default settings, we chose a font size of 11 pt and A5 paper size, which is handy for a book. The pagesize=auto option is essential here: it ensures that the A5 printing area will be taken over to the PDF page size.

Then, we did the following things, which will be explained in more detail at the beginning of Chapter 2, Tuning the Text:

  • Chose the T1 font encoding when loading the fontenc package
  • Selected the high-quality Latin Modern T1 supporting font set by loading the lmodern package
  • Loaded the babel package with support for English
  • Used the microtype package for getting finer typography

The last package we loaded was blindtext. You don’t need it in your final document; here, it will serve us to provide filler text. Using such dummy text, we can get a better idea of the final result already before writing the actual content.

Finally, we switched to the so-called French spacing, which we already saw in the thesis recipe. Remember – this means that after ending a sentence, we will get a standard interword space, not a wider space.

There’s more...

You can change the layout of the book in many ways. Choose your settings at the beginning, or even better: don’t hesitate and start writing your content – once you get a decent amount of text, you can better see the effect of layout changes. You can do that at any time. Let’s take a look at some design ideas.

Changing the page layout

When a book is bound after printing, this binding can cost space; less of the inner margin may be visible. You can specify a binding correction to compensate for and preserve layout proportions. So, if you see 5 mm less of the inner margin after binding, add BCOR=5mm as a class option at the beginning. A similarly produced book may give you an idea about a good value.

The actual text area has the same ratios as the page itself. This is automatically done by a dividing construction, described in the KOMA-Script manual. That’s really worth reading. You can open it by typing texdoc scrguien at Command Prompt or online at https://texdoc.org/pkg/scrguien. This abbreviation comes from scr for the original package name (Script), gui for guide, and en for English, and obviously from the ancient limit of 8 characters per filename in older filesystems.

Besides those page and text area ratios, the result shows a bottom margin twice as high as the top margin, and an outer margin with the double width of the inner margin. Imagine an opened book: the inner margins together appear with the same space as an outer margin. Sometimes, people make the mistake of thinking that the inner margin should be much bigger because of the binding, but that’s done by raising BCOR as previously. In Chapter 2, Tuning the Text, you can use the Visualizing the layout recipe to inspect and understand the margins.

If you want a more extensive text area, which means narrower margins, you can keep the ratios as described. Just raise the division factor of the mentioned internal construction and take a look to see if it would suit you. For example, set the DIV=10 class option. Higher values are possible. That’s a safe and easy way to preserve sane layout proportions.

To sum up, our example with 5 mm binding loss and pretty narrow margins could start like this:

\documentclass[fontsize=11pt,paper=a5,pagesize=auto,  BCOR=5mm,DIV=12]{scrbook}

Alternatively, you could freely choose text and margin dimensions when requirements by the publisher or institute need to be met. This can be done by loading the classic geometry package with the desired measurements, as we saw in the Writing a thesis recipe:

\usepackage[inner=1.5cm,outer=3cm,top=2cm,bottom=4cm,  bindingoffset=5mm]{geometry}

Designing a title page

You can create your own title page to present more information in a style you desire. Let’s look at an example that shows some handy commands for it.

Remove the \maketitle command. You can do the same with the \title, \subtitle, \author, and \date commands. Instead, put this titlepage environment right after \begin{document}:

\begin{titlepage}  \vspace*{1cm}  {\huge\raggedright The Book\par}  \noindent\hrulefill\par  {\LARGE\raggedleft The Author\par}  \vfill  {\Large\raggedleft Institute\par}\end{titlepage}

The titlepage environment creates a page without a page number on it. We started with some vertical space using the \vspace* command. The \vspace command adds vertical space, which can be of a positive or a negative value. Here, note the star at the end: this way of calling \vspace also works at the beginning of a page, where a simple \vspace instance would be ignored. That default behavior prevents undesired vertical space at the top of a page, which initially may have been intended as space between texts.

We enclosed each line in curly braces. This is also called grouping, and it is used to keep the effect of changes, such as the font size, local within the braces. In each line, we did the following:

  • Switched to a specific font size
  • Chose left or right alignment
  • Wrote out the text
  • Ended with a paragraph break

The \par command is equivalent to an empty line in the input. Sometimes, people use it to keep the code compact, such as here. We must end the paragraph before the font size changes because that size defines the space between lines. Hence, we ended the paragraph before we closed the brace group. It’s good to keep this in mind for when texts are longer.

Our only non-text design element is a modest horizontal line with the \hrulefill command. The preceding \noindent command just prevents an undesired paragraph indentation, so the line really starts at the very left.

\vfill inserts stretching vertical space, so we got the last line pushed down to the title page bottom. If you used several \vfill commands on the same page, the available vertical space would be divided and distributed equally between them.

We took this scenario to show some commands for positioning text on a page. You can experiment with the \vspace and \vfill commands and their horizontal companions, \hspace and \hfill. Just avoid using such commands to “fix” local placement issues in the document when it would be better to adjust a class or package setting document-wide. If at all, don’t make such tweaks until the final stage.

Note

The titlepages package provides 40 example title pages in various designs with complete LaTeX source code. You could choose one, use it, and customize it.

Adding a cover page

The title page, which we produced previously, is an inner page. That’s why it follows the standard page layout with the same inner and outer margins as the body text.

The cover is different; for example, it should have symmetric margins and can be designed individually. To get that deviating layout, it’s recommended to use a separate document for it. Another reason is that it will usually be printed on different paper or cardboard.

So, you can start with an article-like class as in our first recipe, Writing a short text, then use options such as twoside=false or the equivalent oneside option to get symmetric margins. Then, you can position your text as we did with the title page.

Changing the document class

A very well-designed book class is memoir. It is pretty complete in itself, so you don’t need to load many packages: it already integrates many features of other packages, providing similar interfaces. memoir has a monolithic, easy-to-use approach, but it needs to take care of package conflicts. It is not as flexible as choosing the package set by yourself. KOMA-Script, in contrast, provides its features mostly in packages that can also be used with other classes.

  1. Start with memoir by changing the first line to the following:
    \documentclass[11pt,a5paper]{memoir}
  2. Remove the \subtitle command, which is not supported.
  3. To have the title on its own page, surround \maketitle with a titlingpage environment:
    \begin{titlingpage}
    \maketitle
    \end{titlingpage}
  4. Typeset and compare.

The memoir class provides an extensive manual that can help you to customize your document. It’s split into two parts. Type texdoc memman at Command Prompt to read the actual manual and texdoc memdesign to read the part on book design, which is an excellent resource independent of the class. Alternatively, you can find these manuals at https://texdoc.org/pkg/memman and https://texdoc.org/pkg/memdesign, respectively.

Another great start with a unique beauty is the tufte-latex class. It comes with a sample-book.tex file, which you can also download from https://ctan.org/tex-archive/macros/latex/contrib/tufte-latex. You could open this book file containing some dummy content and fill in your text. One of its outstanding features is a wide margin for extensive use of side notes and small figures in the margin.

See also

A book may contain additional elements such as an index, a glossary, and a bibliography. Refer to Chapter 8, Producing Contents, Indexes, and Bibliographies, which includes such recipes.

The Overleaf book templates collection at https://www.overleaf.com/latex/templates/tagged/book can also give you a head start.

Creating a presentation

At a conference or a seminar, speakers often use a projector or screen to present written information in addition to the talk. Such a presentation document requires a specific kind of layout and features.

In our recipe, we will use the beamer class, which has been designed specifically for this purpose and provides the following features:

  • A typical landscape slide format, here 128 mm x 96 mm
  • Structured frames with dynamic information, such as sectioning
  • Support for overlays and transition effects
  • Pre-designed themes for easily changing the look
  • An intelligent interface for customizing

How to do it...

We will start with a sample presentation document, which we can extend. Follow the next steps:

  1. Start with the beamer document class:
    \documentclass{beamer}
  2. Choose a theme. Here, we take the theme called Warsaw:
    \usetheme{Warsaw}
  3. Begin the document:
    \begin{document}
  4. Provide a title, a subtitle, the author’s name, the institute, and a date:
    \title{Talk on the Subject}
    \subtitle{What this is about}
    \author{Author Name}
    \institute{University of X}
    \date{June 24, 2015}
  5. Make a slide using the frame environment. The first one will contain the title page:
    \begin{frame}
      \titlepage
    \end{frame}
  6. Make a frame for the table of contents titled Outline. Add the pausesections option so that the table of contents will be shown stepwise, section by section:
    \begin{frame}{Outline}
      \tableofcontents[pausesections]
    \end{frame}
  7. Start a section and a subsection within:
    \section{Introduction}
    \subsection{A subsection}
  8. All visible content goes into a frame environment. So also do lists, which are visually better than normal text in a presentation:
    \begin{frame}{Very Informative Title}
      \begin{itemize}
        \item First thing to say.
        \item There is more.
        \item Another short point.
      \end{itemize}
    \end{frame}
  9. This frame will show an emphasized block with a title:
    \begin{frame}{Another Title With Uppercased Words}
      Text
      \begin{alertblock}{A highlighted block}
        Some important information put into a block.
      \end{alertblock}
    \end{frame}
  10. We add another subsection, with a frame with another titled block, and another section with a slide containing a list. We highlight some words using the \alert command. Finally, end the document:
    \subsection{Another subsection}
    \begin{frame}{Informative Title}
      \begin{exampleblock}{An example}
        An example within a block.
      \end{exampleblock}
      Explanation follows.
    \end{frame}
    \section{Summary}
    \begin{frame}{Summary}
      \begin{itemize}
        \item Our \alert{main point}
        \item The \alert{second main point}
      \end{itemize}
      \vfill
      \begin{block}{Outlook}
        Further ideas here.
      \end{block}
    \end{frame}
    \end{document}
  11. Compile and have a look at the produced slides:
Figure 1.4 – Presentation slides

Figure 1.4 – Presentation slides

Now, you can adjust the title, author, and date and edit the text in the frames. Then, you can add your own frames with titles and text.

How it works...

We loaded the beamer class and chose the theme with the name Warsaw. You could easily replace it with another theme’s name, compile, and cycle through the themes until you find the best for your occasion. Pre-installed themes are as follows:

  • AnnArbor
  • Antibes
  • Bergen
  • Berkeley
  • Berlin
  • Boadilla
  • boxes
  • CambridgeUS
  • Copenhagen
  • Darmstadt
  • default
  • Dresden
  • EastLansing
  • Frankfurt
  • Goettingen
  • Hannover
  • Ilmenau
  • JuanLesPins
  • Luebeck
  • Madrid
  • Malmoe
  • Marburg
  • Montpellier
  • PaloAlto
  • Pittsburgh
  • Rochester
  • Singapore
  • Szeged
  • Warsaw

We specified the title, subtitle, author, and talk date, which is then printed by \titlepage. We used a frame environment, which we will do for each slide.

The next frame contains the table of contents. We provided an Outline frame title as an argument to the frame in curly braces. For the \tableofcontents command, we added the pausesections option. By doing this, section titles are printed individually with a pause in between. This allows us to explain what the auditory will hear before they read further.

As in a standard LaTeX document, we used the \section and \subsection commands. The heading is not directly printed. The sections and subsections are printed in the frame margin with the current position highlighted.

We used an itemize environment as in a standard LaTeX document to get a bulleted list. The enumerate environment for numbered lists and description environment for descriptive lists also work in beamer frames.

To highlight information, we used so-called block environments. Besides the standard block environment, we can use exampleblock and alertblock to get a different style or color. The chosen theme determines the appearance of those blocks.

A more subtle kind of emphasizing is achieved using the \alert command, as seen in the last frame.

Now, you have a template and tools to build up your presentation.

Here are some more quick tips:

  • Keep time constraints in mind; a frame per minute is a good rule of thumb
  • Use a few sections, logically split into subsections; it’s better to avoid sub-subsections
  • Use self-explaining titles for sectioning and frames
  • Bulleted lists help to keep things simple
  • Consider avoiding numbering things; one rarely cares about a reference to theorem 2.6 during a talk
  • Don’t disrupt the reading flow by footnotes
  • Graphics, such as diagrams, help the auditory in visualizing

Note

Slides should support your talk, not the other way around. Did you already bear up with a presentation where the speaker just read out aloud text from the slides and used fancy transition effects? You can do it better by focusing on well-crafted content.

There’s more...

The beamer class has unique capabilities and extraordinary design. We will explore it further.

Using short titles and names

Besides the title page, the title of the presentation and the author’s name are additionally printed at the bottom of each frame. The exact position depends upon the chosen theme.

However, the space might need to be increased for long titles or names. You can give short versions used at such places, such as by specifying the following text:

\title[Short title]{Long Informative Title}\author[Shortened name]{Author's Complete Name}\date[2024/01/24]{Conference on X at Y, January 24, 2024}

The same is possible for the \institute and \subtitle commands if used.

In the same way, you can provide short names for sections and subsections so that they better fit into their field within the frame margin. Just use the optional argument in square brackets. The \part and \subsubsection commands work similarly if needed.

Uncovering information piecewise

Showing a complete slide at once may be distracting. People may read ahead instead of listening to you. You can take them by the hand by showing the content step by step.

The simplest way is by inserting a \pause command. It can go between anything, such as text, graphics, and blocks. It also works between two \item commands in a bulleted list, though consider not to pause between items but between whole lists. Use it as in the following line of code:

Text\pause more text\pause\includegraphics{filename}

Such a frame is then layered – that is, divided into overlays. They are internally numbered. If you would like to show something at a certain overlay, you can tell the beamer class when to uncover it:

\uncover<3->{Surprise!}

This shows your text on slide 3 of the current frame, and it will stay on the following slides on that frame. Omit the dash for restricting it only to slide 3. You could also list slides (for example, <3,5>), give ranges such as <3-5>, and mix slides (<3,5->).

That syntax works with overlay specification-aware commands. Among them, there are \item, \includegraphics, and even \renewcommand, so you can use them with an overlay specification such as the following:

\includegraphics<3->{filename}

It should not be too fancy. A presentation still needs a linear structure. Complicated overlays may be handy for showing and hiding annotation to an object while you explain that.

Refer to the beamer manual for further information about using overlays.

Splitting frames into columns

You can arrange text and images in multiple columns on a frame. It’s convenient for images with explaining text. Let’s take a look at a sample:

\begin{frame}  Some text which can use whole frame width  \begin{columns}[t]    \begin{column}{0.45\textwidth}      Sample text in\\      two lines    \end{column}    \begin{column}[T]{0.45\textwidth}      \includegraphics[width=3cm]{filename}    \end{column}  \end{columns}\end{frame}

We started the multi-column area using the columns environment. You can specify t, b, or c alignment options for the column’s top, bottom, or centered alignment. Centered is the default. While t aligns at the baseline of the first line, as usual in LaTeX, there’s a handy additional option, T, which aligns at the very top.

Each column has been made with the column environment. The column width has been given as an argument. It understands the same positioning options, so you can override what you set in the surrounding columns environment. We added [T] here because an image has its baseline at its bottom, and we wanted to change it to the very top.

Showing an outline for each section

You can tell the beamer class to give an outline at the beginning of each section by specifying the following code:

\AtBeginSection{  \begin{frame}{Outline}    \tableofcontents[currentsection]  \end{frame}}

You can also use the \AtBeginSection command for inserting different code. If something should happen for a starred \section* command too, you can insert the corresponding code within an optional argument in square brackets.

Removing navigation symbols

By default, every slide shows small navigation symbols; here, at the bottom of a frame. If you don’t need them, you can save that space and reduce distraction by specifying the following line of code:

\setbeamertemplate{navigation symbols}{}

Changing the font

The default font set with the beamer class is Computer Modern. You can change it to other fonts, as explained in the Writing a short text recipe.

The default shape is sans-serif. Even the math formulas are sans-serif. It can be more readable with a low projector resolution or at some distance than with a serif font.

However, if you would like to change to a serif font, you can load the corresponding font theme in the preamble:

\usefonttheme{serif}

Another available font theme is professionalfonts, which doesn’t change fonts but simply uses the set you bought. Furthermore, there are structurebold, structureitalicserif, and structuresmallcapsserif, which change the font in the structure – that is, in headlines, footlines, and sidebars – to such a shape combination.

Changing the color

The quickest way to change colors is by loading a theme with a thoughtful selection of colors for the various structural elements. Use a single command, such as the following:

\usecolortheme{dolphin}

Outer color themes provide a color set for the headline, footline, and sidebar. The author then gave sea-animal names: dolphin, whale, and seahorse. Then, there are inner color themes for elements such as color blocks with names of flowers: lily, orchid, and rose. Combine inner and outer color themes as you like.

Finally, there are complete themes covering all structure aspects: albatross, beaver, beetle, crane, dove, fly, monarca, seagull, spruce, and wolverine. They are named after flying animals, except beaver and spruce as external additions.

That’s a lot of names; just cycle through them using the \usecolortheme command to find the color set you like most.

Loading a theme from the internet

With some labor, you can create your very own theme. The extensive beamer manual will guide you. However, you may save much time: beamer is very popular among academic users who already use LaTeX for their papers. So, you can find many themes prepared for universities and institutes but also designed by various beamer users.

You can find an overview at https://latex-beamer.net.

Explore the gallery there, download a theme you like, add your logo, and tweak it. Instructions are on that website.

Providing a handout

You can give your auditory a printed version of slides. Just create a version of your document with the handout option so that no overlays will be used:

\documentclass[handout]{beamer}

Slides are commonly small, so it’s good to print several slides on a single page:

\usepackage{pgfpages}\pgfpagesuselayout{4 on 1}[a4paper,  border shrink=5mm, landscape]

This prints four slides on one A4 page in landscape. You can get bigger prints, two slides on each page, in portrait mode by specifying the following line of code:

\pgfpagesuselayout{2 on 1}[a4paper,border shrink=5mm]

We used the pgfpages package, a utility package coming with the pgf package.

See also

For best quality with included graphics, refer to Chapter 5, Working with Images. In Chapter 6, Creating Graphics, you can find recipes for quickly creating diagrams and charts, which are excellent tools for visualizing data in a presentation.

Beyond common academic documents such as a thesis, papers, books, and slides, you may need to present yourself in the working world. The following recipe will prepare you for applying for a job with style.

Designing a CV

Tabular layouts are prevalent today for a CV. When applying for a job, inform yourself about typical requirements for the content of a CV. You can then create a simple document with tables that are consistent and readable.

You can use a template if it needs to be quick or you would like to base it upon a proven modern layout. We will use the moderncv class and its template in this recipe to quickly produce a CV.

Getting ready

If it’s not already installed on your computer, download and install the moderncv class from CTAN at https://ctan.org/pkg/moderncv. The easiest is to download it as a .zip file from https://mirrors.ctan.org/macros/latex/contrib/moderncv.zip.

If your TeX installation provides a package manager, use it for the installation.

There’s a directory of examples containing templates that you can use. Either locate it in the documentation branch of your TeX directory tree or visit the preceding CTAN link: https://ctan.org/tex-archive/macros/latex/contrib/moderncv.

How to do it...

We will start using a sample file provided by the moderncv bundle. Follow these steps:

  1. Copy the template.tex file into your document directory, rename it, and choose your own name, such as MyCV.tex.
  2. Open that document, MyCV.tex, and look around to understand the template. Luckily, it is full of comments on how to use it. Compile it to ensure that this document works.
  3. Review and edit the class and package options in MyThesis.tex.
  4. Remove the filler text and type in your own data. At the beginning, your document may look like this:
    \documentclass[11pt,a4paper,sans]{moderncv}
    \moderncvstyle{classic}
    \moderncvcolor{blue}
    \usepackage[scale=0.75]{geometry}
    \name{John}{Doe}
    \title{CV title}
    \address{street and number}{postcode city}{country}
    \phone[mobile]{+1~(234)~567~890}
    \phone[fixed]{+2~(345)~678~901}
    \email{[email protected]}
    \homepage{www.johndoe.com}
    \photo[64pt][0.4pt]{picture.jpg}
    \begin{document}
    \makecvtitle
    \section{Education}
    \cventry{year--year}{Degree}{Institution}{City}%
      {\textit{Grade}}{Description}
    \cventry{year--year}{Degree}{Institution}{City}%
      {\textit{Grade}}{Description}
    \section{Experience}
    \subsection{Vocational}
    \cventry{year--year}{Job title}{Employer}{City}{}%
      {General description\newline{}%
      Detailed achievements:%
    \begin{itemize}%
      \item Achievement 1;
      \item Achievement 2, with sub-achievements:
        \begin{itemize}%
        \item Sub-achievement (a)
        \item Sub-achievement (b)
      \end{itemize}
    \item Achievement 3.
    \end{itemize}}
    \cventry{year--year}{Job title}{Employer}{City}{}
      {Description line 1\newline{}Description line 2}
    \subsection{Miscellaneous}
    \cventry{year--year}{Job title}%
      {Employer}{City}{}{Description}
    \section{Languages}
    \cvitemwithcomment{Language 1}{Skill level}{Comment}
    \cvitemwithcomment{Language 2}{Skill level}{Comment}
    \end{document}
  5. Compile and have a look at the following result:
Figure 1.5 – A CV

Figure 1.5 – A CV

How it works...

We loaded the moderncv package. We used an 11 pt base font size; 10 pt and 12 pt are also supported. We selected A4 paper; further paper size options are a5paper, b5paper, letterpaper, legalpaper, and executivepaper. You can also add landscape as an option. We chose a sans-serif font, which is fine for such a kind of list; alternatively, you could write roman for a serif font.

We selected the classic style. Other available styles are casual, oldstyle, and banking.

Our color style is blue. Other color options are orange, green, red, purple, gray, and black.

We loaded the geometry package with a scaling factor for reducing the margins.

Using commands such as \name and \address, we entered our personal data.

The \photo command includes our photo; the size options are the height to which it is scaled and the thickness of the frame around the photo. In this recipe, we used the picture.jpg dummy photo contained in the moderncv bundle.

The document body is divided into sections and subsections with a unique design.

Then, the \cventry command makes a typical resume entry for a job or education. Use it as follows:

\cventry[spacing]{years}{job title}  {employer}{localization}{detail}{job description}

You can alternatively use this:

\cventry[spacing]{years}{degree}  {institution}{localization}{grade}{comment}

You can leave the last four arguments empty if you don’t need them.

A simpler line is done using the \cvitem command as follows:

\cvitem[optional spacing length{header}{text}

The \cvitemwithcomment command works similarly, just with another argument printed at the right.

Some more commands and options are explained in the well-documented template.tex file and the moderncv.cls class file itself if you look for deeper information beyond this quick start guide.

Writing a letter

Letters have a specific structure. Commonly, they have an addressee field at a fixed position, which should be visible in the envelope window. It also should show a back address of yourself as the sender. An opening text and a closing phrase are usual elements; you may add fold marks and enclosures.

How to do it...

We will use a KOMA-Script class specifically designed for letters named scrlttr2. Follow the following steps:

  1. Use the scrlttr2 class, activate the address field and fold marks via an option, and align the sender’s address to the right:
    \documentclass[addrfield=true, foldmarks=true,
      fromalign=right]{scrlttr2}
  2. Provide your name and your address using the \setkomavar command:
    \setkomavar{fromname}{Thomas Smith}
    \setkomavar{fromaddress}{123 Blvd \\ City, CC 12345}
  3. Write a date, either \today for today or any date as text:
    \date{\today}
  4. Begin the document:
    \begin{document}
  5. Open a letter environment with the recipient’s address as an argument:
    \begin{letter}{Agency \\ 5th Avenue \\
                   Capital City, CC 12345}
  6. Start with an opening, and let your letter text follow:
    \opening{Dear Sir or Madam,}
    the actual content of the letter follows.
  7. End with closing words:
    \closing{Yours sincerely}
  8. End the letter environment and the document:
    \end{letter}
    \end{document}
  9. Compile the document. Here is the upper part of the output:
Figure 1.6 – A letter template

Figure 1.6 – A letter template

That was pretty easy! You got fully fledged formal letter addressing information, envelope window support, today’s date, phrases, signature, and even fold marks.

Now, you can enter real addresses and actual letter text.

How it works...

When loading the scrlttr2 letter class, we activated the address field, switched on fold marks, and set the options for right aligning the sender’s address.

The scrlttr2 class is quite different from others, so it has a unique interface. Using the \setkomavar command, we set the content of class variables, similar to \renewcommand. Here, we put names and addresses. The KOMA-Script manual explains all available variables. As mentioned in the Developing a thesis recipe, you can open it by executing texdoc koma-script at Command Prompt or online at https://texdoc.org/pkg/koma-script.

We used a letter environment for the actual content, including the opening and closing phrases. The address is a mandatory argument for that environment. You can have several letter environments in a single document.

There’s more...

To improve input and hyphenation and change the font, look at the first recipes in Chapter 2, Tuning the Text.

Let’s take a look at some letter-specific options.

Separating paragraphs

Instead of indenting the beginning of paragraphs, you can visualize a paragraph break with an empty line. For this, add the parskip=full option to the comma-separated list of class options at the beginning.

Use parskip=half for less space.

Changing the signature

If you would like to use a signature different from your specified name for the address, you can modify the corresponding variable content in the preamble:

\setkomavar{signature}{Thomas}

It would be indented. You can get it left aligned by specifying the following code:

\renewcommand{\raggedsignature}{\raggedright}

The code just shown also belongs to the preamble.

Adding enclosures

If you would like to add enclosures to your letter, it’s common to mention them. You can do this by inserting an \encl command right before \end{letter}:

\encl{Curriculum vitae, certificates}

You can change the default encl: option if you like by modifying the corresponding variable before calling the \encl command:

\setkomavar*{enclseparator}{Attached}

We used the \setkomavar* starred version, which modifies the description of a variable instead of its content, which actually is : – that is, a colon followed by a space.

Producing a leaflet

Flyers are a common way to promote an event or to inform about a product. A folded leaflet is particularly handy as a giveaway and to carry around, so let’s see how to produce one.

How to do it...

The intended layout is very different compared to the already shown document types. Fortunately, there’s a document class for it, with the name leaflet. We will use this one now. Let us start filling it with some content:

  1. Start with the leaflet document class. Choose a base font size of 10 pt, and set the notumble option, which keeps the back side printed in the same direction:
    \documentclass[10pt, notumble]{leaflet}
  2. Use an extended font encoding:
    \usepackage[T1]{fontenc}
  3. If you want a non-default font, load it. This time, we chose the Linux Libertine font:
    \usepackage{libertine}
  4. Switch to sans-serif as the default font family:
    \renewcommand{\familydefault}{\sfdefault}
  5. For better text justification, load the microtype package:
    \usepackage{microtype}
  6. Load the graphicx package for including a picture:
    \usepackage{graphicx}
  7. Switch off the page numbering:
    \pagenumbering{gobble}
  8. Begin the document:
    \begin{document}
  9. Set title, author, and date. Then, print the title:
    \title{\textbf{\TeX\ Live Install Party}}
    \author{\Large\textbf{Your \TeX\ team}}
    \date{\textbf{August 11, City Hall Cellar}}
    \maketitle
  10. Include a centered image. For a demonstration, we chose the CTAN lion, which you can download at https://ctan.org/lion and convert to PDF:
    \begin{center}
      \includegraphics[width=\linewidth]{ctanlion.pdf}
    \end{center}
  11. Add some text:
    We'd like to welcome you to our famous yearly
    \TeX\ install party! Bring your laptop and have free
    cold soft drinks while we assist you in installing
    the latest \TeX\ version on your computer.
    We will provide
  12. A bulleted list can be a good idea for a catchy text. Use an itemize environment for it; each list item starts with an \item command:
    \begin{itemize}
      \item a fast internet connection for downloading,
      \item media such as DVDs and USB sticks with
            the latest \TeX,
      \item \TeX\ books for buying with a discount,
      \item chat with \TeX\ experts.
    \end{itemize}
  13. End the page. Fill in more text on the next leaflet pages, which will be printed on the back side of the paper, next to each other:
    \clearpage
    Fill in text for page 2 (on the back side)
    \clearpage
    Fill in text for page 3 (on the back side)
    \clearpage
    Fill in text for page 4 (on the back side)
    \clearpage
  14. Now, pages 5 and 6 of the leaflet come to the front side of the paper. Use \section to get a heading:
    \section{Schedule}
  15. You can add a timetable using a tabular environment. By inserting @{} in the column format options, we suppress spacing at the left and right:
    \begin{tabular}{@{}rl@{}}
      6 pm    & Welcome \\
      7:30 pm & Live install presentation \\
      8 pm    & Book authors available for talks
                and signing \\
      9:30 pm & Bar closing
    \end{tabular}
  16. End the paragraph using an empty line, continue with writing text, and finally, end the document:
    From 6pm to 10pm: install support
    and free \TeX\ copies on DVD on our welcome desk.
    \section{Accomodation}
    Hotel, Meals, Travel information here
    \section{Sponsors}
    Information about our local \TeX\ user group
    and Open Source projects sponsor
    \clearpage
    \section{Contact}
    Names, Phone numbers, email addresses
    \end{document}
  17. Compile and have a look at the first page:
Figure 1.7 – A foldable leaflet

Figure 1.7 – A foldable leaflet

The back side still contains just some dummy text, helping to identify the position where the text finally lands on the page.

How it works...

In the first line, we loaded the leaflet class with a font size of 10 pt. The tumble option enables printing the back side upside down, which can be helpful for double-sided printing. This is the default. We used the notumble option instead, which suppresses that default behavior so that the output is better readable on the screen.

The next three lines contain our font settings. We used the Linux Libertine font. We specified T1 font encoding. You can read more about encodings in Chapter 2, Tuning the Text, specifically in the Improving justification and hyphenation recipe. Furthermore, we set the default font family to be sans-serif. I prefer the clean look of sans-serif on a flyer or a leaflet, which usually contains little text in narrow columns.

The remaining part of the preamble is as follows:

  • We loaded the microtype package, which improves the justification capabilities by tiny font adjustments. This is especially useful in a situation with narrow columns, such as in this case.
  • We loaded the graphicx package to include images such as a logo or a geographic map.
  • We hid page numbers. The gobble option stands for \gobble, which is a TeX command that removes the following command or control sequence so that the page number will be absorbed.

Our document body shows the usual sectioning commands and text. You can see that we added an explicit space after the TeX logo with a backslash and a following space. That’s because a space after a macro, such as \TeX, indicates the end of the macro. It doesn’t produce a space in print because punctuation may follow.

To have an image in our template, we used the CTAN lion drawn by Duane Bibby; simply replace it with your own image – a geographic map or a logo, for example.

The remaining text is straightforward and shows some useful layout details, such as the following:

  • Centering using the center environment:
    \begin{center}
      ...
    \end{center}
  • Arranging points in a bulleted list by using an itemize environment
  • Setting up a tabular environment for text, which should be aligned in columns

In the \begin{tabular}{@{}rl@{}} line, the rl characters stand for two columns, where the first one is right-aligned and the second one is left-aligned. The @{code} expression inserts a piece of code instead of a space before or after a column, so @{} replaces it with nothing, which means removing it. We’ve got two columns without additional whitespace on the left or the right, saving our previous line space.

There’s more...

The leaflet class provides some options and commands for customization.

Adding fold marks and cut lines

By default, a small folding mark is printed on the backside. If you would like to omit it, add the nofoldmark option when loading the class:

\documentclass[10pt,notumble,nofoldmark]{leaflet}

You can draw a vertical dotted line with scissor symbols using the \CutLine command in the preamble with a page number as an argument. The line will go between this one and the preceding page, which is as follows:

\CutLine{3}

It would print a dotted line with two scissor symbols on the back side, between pages 2 and 3, where a folding mark would be placed by default. The \CutLine* starred command version would not print the scissors.

Adjusting the margins

Similar to standard classes, you could use page headers and footers. There are none by default here. Standard commands such as \setlength{\headheight}{...} and \pagestyle could be used. leaflet provides an additional command to declare the margins:

\setmargins{top}{bottom}{left}{right}

Adding a background image

You can add an image to the background of a certain page:

\AddToBackground{pagenumber}{\includegraphics{filename}}

Use the \AddToBackground* starred version to let it be printed onto the background of the combined page.

Instead of using the \includegraphics command, you could use another positioning, including or drawing code. Here, the Absolute positioning of text recipe in Chapter 2, Tuning the Text, may be helpful.

Changing the sectioning font

The font size of the section headers is already a bit smaller than with standard classes. If you want to change the headings’ size, shape, or color, you can redefine the \sectfont macro. For example, if we also enabled using color by \usepackage{xcolor}, we could write the following code:

\renewcommand{\sectfont}{%  \large\sffamily\bfseries\color{blue}}

This would give a large sans-serif font in bold and with blue color.

For further information regarding fonts, refer to Chapter 3, Adjusting Fonts.

Building a large poster

We know, for example, informational or scientific posters seen at conferences or on walls in universities or institutes.

They mostly have specific characteristics in common:

  • They are large, such as A2, A1, or even A0
  • People may look at them from far away but also very close

In consequence, we have some requirements for typesetting:

  • Page layout dimensions should work with such an enormous size.
  • We need a wide range of font sizes. We should be able to read while standing close, but we also need large, catchy headings.
  • The poster should be partitioned into digestible blocks. Specifically, each block should be at most the usual line width we know from body texts. Too wide lines would make it hard to focus and skip back to the start of the following line. So, block lines should not be much wider than 40 or 50 characters long.
  • Blocks should have distinct headings.
  • Graphic elements such as colors and lines can divide the text into parts.
  • Images should be vector graphics or should have a high resolution.

In this recipe, we would like to create a poster of A0 size in landscape orientation. It will show some blocks containing dummy text as a placeholder, math, and images. As sample images, we will take a flowchart from Chapter 6, Creating Graphics, and a plot from Chapter 10, Writing Advanced Mathematics. There, you can find the source code. You can later replace the dummy text and other parts with your own content.

How to do it...

We will use the tikzposter class. The document is structured in columns and blocks. Follow these steps:

  1. Begin with the document class. A0 is the default paper size. We state landscape orientation as an option:
    \documentclass[landscape]{tikzposter}
  2. Choose a theme that provides a set of colors and decorations. We chose the blue Wave theme:
    \usetheme{Wave}
  3. Load the lipsum package to generate dummy text:
    \usepackage{lipsum}
  4. For dividing wider blocks into text columns, we load the multicol package. Because of the large paper, we set the column separation and the separation line width to high values:
    \usepackage{multicol}
    \setlength{\columnsep}{4cm}
    \setlength{\columnseprule}{1mm}
  5. Start the document:
    \begin{document}
  6. Declare the author and title, and print it out:
    \title{\LaTeX\ in Use}
    \author{John Doe}
    \maketitle
  7. Begin a set of columns:
      \begin{columns}
  8. Start a column with a width of 65% of the available text width:
      \column{.65}
  9. Define a block with the title Workflow in the first argument; the second argument contains dummy text and an image with a caption:
      \block{Workflow}{
        \lipsum[1]
        \begin{tikzfigure}[\LaTeX\ workflow]
          \includegraphics[width=\linewidth]{flowchart}
         \end{tikzfigure}
      }

    The tikzposter package provides the tikzfigure environment as a replacement for the figure environment. The optional argument will be the caption of the figure.

  10. We are still in the first column and start a set of subcolumns:
      \begin{subcolumns}
  11. The first subcolumn will take half of the available width – in this case, the width of the left column:
        \subcolumn{.5}
  12. Create a block with a bulleted list and a mathematical equation to see how it looks on a poster. We will also use a colored box and an inner block with a title for the equation:
        \block{Mathematics}{
          Take a coffee, then:
          \bigskip
          \coloredbox{\begin{itemize}
            \item State
            \item Proof
            \item Write in \LaTeX
          \end{itemize}}
          \bigskip
          \innerblock{Integral approximation}{
            \[
              \int_a^b f(x) dx \approx (b-a)
                \sum_{i=0}^n w_i f(x_i)
            \]
          }
        }
  13. Add a note that will have a callout shape, pointing into the formula:
        \note[targetoffsetx = 4.5cm, targetoffsety = -5cm,
          angle = -30, connection]{Weight function}
  14. Make another subcolumn, talking the other half of the available width. Insert a block filled with text, and then end the subcolumns environment:
        \subcolumn{.5}
        \block{Text}{\lipsum[1]}
      \end{subcolumns}
  15. Now that we are back in our primary column environment, make another column, print a block with an image and some text, and then end the columns environment:
      \column{.35}
      \block{Plotting functions}{
        \includegraphics[width=\linewidth]{plot}
        \lipsum[4]
      }
    \end{columns}
  16. As we ended the columns, a block would use the whole available width. To keep text readable, we will now use the multicol package. We divide the text itself into columns using a multicolumn environment with four columns:
    \block{Conclusion and outlook}{
      \begin{multicols}{4}
        \lipsum[10-11]
      \end{multicols}
    }
  17. End the document:
    \end{document}
  18. Compile, and take a look:
Figure 1.8 – A colorful poster with a block layout

Figure 1.8 – A colorful poster with a block layout

How it works...

The tikzposter class supports huge paper sizes and large fonts and handles block heights and spacing between columns. We, as the users, just decided about the relative column width.

Several class options are provided. You can add them to the \documentclass command as we did with the preceding landscape option:

  • The paper size can be chosen by a0paper, a1paper, or a2paper. a0paper is the default.
  • Available font sizes are 12pt, 14pt, 17pt, 20pt, and 25pt. The last one is the default.
  • With either landscape or portrait, you can select the orientation. portrait is the default.
  • The standard fleqn option for flush-left equations is supported.
  • The standard leqno option for equation numbering at the left side is also supported.

You can adjust several lengths. Give them as class options in the key=value form with a measurement unit such as mm or cm:

  • margin: The distance between the edge of the poster area and the edge of the paper
  • innermargin: The distance from the outermost edge of the blocks to the edge of the poster
  • colspace: The horizontal distance between consecutive columns
  • subcolspace: The horizontal distance between consecutive columns in a subcolumn environment
  • blockverticalspace: The distance between the bottom of a block and the top of the next block below

A sample call using the exact defaults would be:

\documentclass[a0paper, portrait, 25pt, margin=0mm,  innermargin=15mm, colspace=15mm, subcolspace=8mm,  blockverticalspace=15mm]{tikzposter}

The package makes use of the very capable graphics language, TikZ. We will see more of TikZ in Chapter 6, Creating Graphics. For now, the main benefit is that tikzposter provides a lot of predefined styles and color schemes.

You can use a main layout style with \usetheme{name}. At the time of writing, there were nine themes available:

  • Wave: As seen in this recipe
  • Default (left) and Basic (right):
  • Rays (left) and Simple (right):
  • Envelope (left) and Board (right):
  • Autumn (left) and Desert (right):

Furthermore, predefined styles for color, title, background, notes, blocks, and inner blocks can be chosen and composed. There’s support for creating further styles.

The commands you have seen previously can be used immediately without further options. However, they can be customized via several options.

A complete reference is available by executing texdoc tikzposter at Command Prompt and online at https://texdoc.org/pkg/tikzposter. You can find a style guide, a feature guide, and more at https://bitbucket.org/surmann/tikzposter/downloads.

There’s more...

One of the first poster classes is the a0poster class. It supports A0, A1, A2, and A3 paper sizes. It provides font sizes from 12 pt up to 107 pt. Math formulas are printed in a suitable size. There’s no specific support for graphics, color, or text placement. For this, you would need additional packages such as TikZ.

In a previous recipe, you already saw beamer as a presentation class. The beamerposter package can be used together with it for producing presentations in poster size. It combines the beamer class with a0poster code. So, you can produce large posters with a wide range of font sizes together with beamer’s color and graphics capabilities, such as beamer boxes with titles.

As noted before, you can use the texdoc command or the https://texdoc.org website to access the documentation of the mentioned classes and packages.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Work with ready-to-use document templates to write articles, books, a thesis, and more
  • Refine text, fonts, formulas, and tables, and optimize PDF properties
  • Create captivating graphics directly within LaTeX in 2D and 3D
  • Purchase of the print or Kindle book includes a free PDF eBook

Description

The second edition of LaTeX Cookbook offers improved and additional examples especially for users in science and academia, with a focus on new packages for creating graphics with LaTeX. This edition also features an additional chapter on ChatGPT use to improve content, streamline code, and automate tasks, thereby saving time. This book is a practical guide to utilizing the capabilities of modern document classes and exploring the functionalities of the newest LaTeX packages. Starting with familiar document types like articles, books, letters, posters, leaflets, and presentations, it contains detailed tutorials for refining text design, adjusting fonts, managing images, creating tables, and optimizing PDFs. It also covers elements such as the bibliography, glossary, and index. You’ll learn to create graphics directly within LaTeX, including diagrams and plots, and explore LaTeX’s application across various fields like mathematics, physics, chemistry, and computer science. The book’s website offers online compilable code, an example gallery, and supplementary information related to the book, including the author’s LaTeX forum, where you can get personal support. By the end of this book, you’ll have the skills to optimize productivity through practical demonstrations of effective LaTeX usage in diverse scenarios.

Who is this book for?

If you're a LaTeX user in school, academia, or industry with a foundational understanding of LaTeX basics, this book offers efficient solutions to expedite your tasks. Tailored to students, teachers, authors, and engineers, its example-driven format enables quick access to solutions. Familiarity with basic LaTeX syntax and using LaTeX with your preferred editor for compiling is recommended to make the most of this book.

What you will learn

  • Utilize various document classes and incorporate bibliography, glossary, and index sections
  • Handle arranging and annotating images with ease
  • Create visually appealing tables and learn how to manage fonts efficiently
  • Generate diverse and colorful graphics, including diagrams, flow charts, bar charts, trees, and both 2D and 3D plots
  • Solve writing and drawing tasks across various scientific disciplines
  • Optimize PDF output, enhancing it with metadata, annotations, popups, animations, and fill-in fields
  • Leverage ChatGPT to improve content and code
Estimated delivery fee Deliver to France

Premium delivery 7 - 10 business days

€10.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Feb 29, 2024
Length: 424 pages
Edition : 2nd
Language : English
ISBN-13 : 9781835080320
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Colour book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to France

Premium delivery 7 - 10 business days

€10.95
(Includes tracking information)

Product Details

Publication date : Feb 29, 2024
Length: 424 pages
Edition : 2nd
Language : English
ISBN-13 : 9781835080320
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 99.97
LaTeX Beginner's Guide
€35.99
LaTeX Graphics with TikZ
€33.99
LaTeX Cookbook
€29.99
Total 99.97 Stars icon
Banner background image

Table of Contents

15 Chapters
Chapter 1: Exploring Various Document Classes Chevron down icon Chevron up icon
Chapter 2: Tuning the Text Chevron down icon Chevron up icon
Chapter 3: Adjusting Fonts Chevron down icon Chevron up icon
Chapter 4: Creating Tables Chevron down icon Chevron up icon
Chapter 5: Working with Images Chevron down icon Chevron up icon
Chapter 6: Creating Graphics Chevron down icon Chevron up icon
Chapter 7: Creating Beautiful Designs Chevron down icon Chevron up icon
Chapter 8: Producing Contents, Indexes, and Bibliographies Chevron down icon Chevron up icon
Chapter 9: Optimizing PDF Files Chevron down icon Chevron up icon
Chapter 10: Writing Advanced Mathematics Chevron down icon Chevron up icon
Chapter 11: Using LaTeX in Science and Technology Chevron down icon Chevron up icon
Chapter 12: Getting Support on the Internet Chevron down icon Chevron up icon
Chapter 13: Using Artificial Intelligence with LaTeX Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.9
(26 Ratings)
5 star 92.3%
4 star 7.7%
3 star 0%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Amazon Customer Mar 23, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is an outstanding resource. LaTeX is a complex program with a large number of features, options and packages and so a reference such as this greatly simplifies obtaining the background through ready usable, understandable and tailorable examples. The text is clear, comprehensive and applicable to a wide range of needs where a professional typeset quality product is required or desired. It is relevant to all levels of LaTeX users including first time users new to the program. The first chapter provides an overview and roadmap for the specific applications that are then developed fully in the other chapters. In addition, it includes content about how to assemble an environment – all available open source -- and identifies links to additional online resources. I am a relatively advanced user having used LaTeX since the late 80’s for its incomparable utility for producing reports, articles and presentations with advanced mathematics. In going through the portions most relevant and interesting to me, I learned of several advanced features, packages, etc., that I have now adopted and incorporated as part of my environment. From the PDF version (free as part of the print version purchase), the examples can be cut-and-pasted to provide a foundation to build from. Many advanced features for integrating graphics use the TikZ package and so I recommend also getting the author’s other outstanding book: "LaTeX Graphics with TikZ" that will serve as a highly useful companion.
Amazon Verified review Amazon
Markus Strobel May 27, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Das Buch ist in seiner neuen Auflage noch besser geworden. Es eignet sich optimal um sein vorhandenes LaTeX - Wissen zu vertiefen und vorhandenes Wissen wieder aufzufrischen.Didaktisch gelingt es dem Autor die Inhalte sehr klar, treffend und präzise auf den Punkt zu bringen und mit passend gewählten Beispielen zu verdeutlichen.Eines der besten Bücher auf dem Markt zum Thema LaTeX.Klare Kaufempfehlung!
Amazon Verified review Amazon
Nicholas Bennett Jun 13, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I have been fortunate enough to have Stefan help me with many different LaTeX issues over the years. His support has helped me more than I can describe. He asked me for a third time to write an honest review of his LaTeX Cookbook (2ed), which had been on my Amazon Wishlist already. I have used all three of his books and although I do not use this book as much as the other two, it is no less useful and is filled with so much material. I think what struck me first about the Cookbook was the content. It was like he took many of the most common questions from the Latex Community forum and made a simple easy to follow guide. My first use of this book came with the cool ways you can manipulate an image (provide a border, shaping and cutting the image) was particularly useful. There are some nice uses with bar and pie charts (which I could have used about 14 years ago when I was creating files for a text). These guides are easy to follow and understand.There is some overlap with the other features, but this book, like his others is easy to follow and will help with any fear of trying to code using LaTeX. So if you're looking for help with images, diagrams, tables or even resumes, Stefan has you covered. This is a great addition to any TeX fan and I am truly glad that I have this in my library.
Amazon Verified review Amazon
Julia Feld Mar 29, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This is the book I needed during the last couple of years, as an author struggling to master LaTeX.Not being a noob with LaTeX, I'm still struggling with formatting, tables, fonts, bibliography, and setting it all up in general.This book helps me solve all my problems, so I fell in love with it. Yes, there is another book, over 1000 pages, really almost impossible to navigate. This one, navigation is a breeze.The book is well-structured, so that one can use it as a reference, or read chapter after chapter,learning and mastering the language.I found especially helpful the chapters covering building an index and a table of contents; then, the chapters that teach you how to include graphics, especially diagrams, both commutative diagrams and Feynman diagrams.The last chapter give you a pretty timely advice on how to use AI (e.g. chatGPT) to build well-formed LaTeX content, both stylistically and graphically.In short, if you produce a rich content: technical books, articles, presentations, you will need this book.
Amazon Verified review Amazon
Andreas Taudte Apr 17, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Just finished exploring the LaTeX Cookbook by Stefan Kottwitz, and I must say, it's a treasure trove for anyone looking to master LaTeX. This book isn't just another guide; it's a hands-on journey into the vast world of LaTeX, offering over 100 practical recipes for a wide range of tasks. Whether you're aiming to create precise documents, craft elegant presentations, or even design your CV, this book has got you covered. Stefan’s expertise shines through every page, making complex concepts accessible and engaging. What truly sets this book apart is its example-driven approach, allowing you to apply what you've learned immediately. And with LaTeX being my favorite typesetting system, this book feels like a dialogue with a fellow enthusiast - highly recommended!
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact [email protected] with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at [email protected] using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on [email protected] with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on [email protected] within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on [email protected] who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on [email protected] within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela