Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletter Hub
Free Learning
Arrow right icon
timer SALE ENDS IN
0 Days
:
00 Hours
:
00 Minutes
:
00 Seconds
LaTeX Cookbook
LaTeX Cookbook

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

eBook
€20.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 copy whilst your Print order is Shipped
Product feature icon Colour book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
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.

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 Switzerland

Standard delivery 10 - 13 business days

€11.95

Premium delivery 3 - 6 business days

€16.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 copy whilst your Print order is Shipped
Product feature icon Colour book shipped to your preferred address
Product feature icon Redeem a companion digital copy on all Print orders
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 Switzerland

Standard delivery 10 - 13 business days

€11.95

Premium delivery 3 - 6 business days

€16.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 Cookbook
€29.99
LaTeX Graphics with TikZ
€33.99
LaTeX Beginner's Guide
€35.99
Total 99.97 Stars icon

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 digital copy I get with my Print order? Chevron down icon Chevron up icon

When you buy any Print edition of our Books, you can redeem (for free) the eBook edition of the Print Book you’ve purchased. This gives you instant access to your book when you make an order via PDF, EPUB or our online Reader experience.

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 customercare@packt.com 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 customercare@packt.com 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 customercare@packt.com 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 customercare@packt.com 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 customercare@packt.com 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 customercare@packt.com 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