First Edition

Here you can find all code examples from the first edition of the LaTeX Cookbook. The code for the second edition is at

Click a section to open the example, click a chapter heading to see all examples of that chapter.

1. The Variety of Document Types

  1. Writing a short text
  2. Writing a thesis
  3. Designing a book
  4. Creating a presentation
  5. Designing a curriculum vitae
  6. Writing a letter
  7. Building a large poster

2. Tuning the Text

  1. Easier input of accented characters and Unicode symbols
  2. Improving justification and hyphenation
  3. Starting a paragraph with an over-sized letter
  4. Converting numbers to words
  5. Putting text into a colorful box
  6. Visualizing the layout
  7. Visualizing boxes of letters and symbols
  8. Typesetting in a grid
  9. Absolute positioning of text
  10. Fitting text to a shape
  11. Creating a pull quote

3. Adjusting Fonts

  1. Choosing a document font
  2. Locally switching to a different font
  3. Importing just a single symbol of a font
  4. Writing bold mathematical symbols
  5. Getting sans-serif mathematics
  6. Writing double stroke letters like on a blackboard
  7. Enabling searching and copying of ligatures
  8. Suppressing ligatures
  9. Adding a contour

4. Working With Images

  1. Including images with optimal quality
  2. Aligning images
  3. Adding a frame to an image
  4. Cutting an image to get rounded corners
  5. Shaping an image like a circle
  6. Drawing over an image
  7. Arranging images in a grid

5. Beautiful Designs

  1. Adding a background image
  2. Beautiful ornaments
  3. Pretty headings
  4. Printing a calendar
  5. Mimicking keys and menu items

6. Designing Tables

  1. Creating a legible table
  2. Merging cells
  3. Splitting a cell diagonally
  4. Adding footnotes to a table
  5. Aligning numeric data
  6. Coloring a table
  7. Adding shape, shading and transparency
  8. Reading in data from an external file

7. Contents, Lists and Bibliographies

  1. Tuning table of contents, lists of figures and tables
  2. Creating a bibliography
  3. Adding a glossary
  4. Creating a list of acronyms
  5. Generating an index

8. Getting the Most out of the PDF

  1. Adding hyperlinks
  2. Adding metadata
  3. Adding copyright information
  4. Inserting comments
  5. Producing fillable forms
  6. Optimizing the output for ebook readers
  7. Removing white margins
  8. Combining PDF files

9. Creating Graphics

(click for full sample chapter)

  1. Building smart diagrams
  2. Constructing a flowchart
  3. Growing a tree
  4. Building a bar chart
  5. Drawing a pie chart
  6. Drawing a Venn diagram
  7. Putting thoughts into a mind map
  8. Generating a timeline

10. Advanced Mathematics

  1. Quick-start for beginners
  2. Fine-tuning a formula
  3. Automatic line-breaking in equations
  4. Highlighting in a formula
  5. Writing theorems and definitions
  6. Drawing a commutative diagram
  7. Plotting functions in two dimensions
  8. Plotting in three dimensions
  9. Drawing geometry pictures
  10. Doing calculations

11. Science and Technology

  1. Typesetting an algorithm
  2. Printing code listings
  3. Application in graph theory
  4. Using scientific units
  5. Writing chemical formulae
  6. Drawing molecules
  7. Constructing electrical circuits

12. Getting Support on the Internet

  1. Exploring online LaTeX resources
  2. Using web forums
  3. Stating a really good question
  4. Creating a minimal example