You are previewing LaTeX Cookbook.
O'Reilly logo
LaTeX Cookbook

Book Description

Over 100 hands-on recipes to quickly prepare LaTeX documents of various kinds to solve challenging tasks

About This Book

  • Work with modern document classes, such as KOMA-Script classes

  • Explore the latest LaTeX packages, including TikZ, pgfplots, and biblatex

  • An example-driven approach to creating stunning graphics directly within LaTeX

  • Who This Book Is For

    If you already know the basics of LaTeX and you like to get fast, efficient solutions, this is the perfect book for you. If you are an advanced reader, you can use this book's example-driven format to take your skillset to the next level. Some familiarity with the basic syntax of LaTeX and how to use the editor of your choice for compiling is required.

    What You Will Learn

  • Choose the right document class for your project to customize its features

  • Utilize fonts globally and locally

  • Frame, shape, arrange, and annotate images

  • Add a bibliography, a glossary, and an index

  • Create colorful graphics including diagrams, flow charts, bar charts, trees, plots in 2d and 3d, time lines, and mindmaps

  • Solve typical tasks for various sciences including math, physics, chemistry, electrotechnics, and computer science

  • Optimize PDF output and enrich it with meta data, annotations, popups, animations, and fill-in fields

  • Explore the outstanding capabilities of the newest engines and formats such as XeLaTeX, LuaLaTeX, and LaTeX3

  • In Detail

    LaTeX is a high-quality typesetting software and is very popular, especially among scientists. Its programming language gives you full control over every aspect of your documents, no matter how complex they are. LaTeX's huge amount of customizable templates and supporting packages cover most aspects of writing with embedded typographic expertise.

    With this book you will learn to leverage the capabilities of the latest document classes and explore the functionalities of the newest packages.

    The book starts with examples of common document types. It provides you with samples for tuning text design, using fonts, embedding images, and creating legible tables. Common document parts such as the bibliography, glossary, and index are covered, with LaTeX's modern approach.

    You will learn how to create excellent graphics directly within LaTeX, including diagrams and plots quickly and easily.

    Finally, you will discover how to use the new engines XeTeX and LuaTeX for advanced programming and calculating with LaTeX.

    The example-driven approach of this book is sure to increase your productivity.

    Style and approach

    This book guides you through the world of LaTeX based on over a hundred hands-on examples. These are explained in detail and are designed to take minimal time and to be self-compliant.

    Downloading the example code for this book. You can download the example code files for all Packt books you have purchased from your account at http://www.PacktPub.com. If you purchased this book elsewhere, you can visit http://www.PacktPub.com/support and register to have the code file.

    Table of Contents

    1. LaTeX Cookbook
      1. Table of Contents
      2. LaTeX Cookbook
      3. Credits
      4. About the Author
      5. About the Reviewers
      6. www.PacktPub.com
        1. Support files, eBooks, discount offers, and more
          1. Why Subscribe?
          2. Free Access for Packt account holders
      7. Preface
        1. What this book covers
        2. What you need for this book
        3. Who this book is for
        4. Sections
          1. Getting ready
          2. How to do it…
          3. How it works…
          4. There's more…
          5. See also
        5. Conventions
        6. Reader feedback
        7. Customer support
          1. Downloading the example code
          2. Errata
          3. Piracy
          4. Questions
      8. 1. The Variety of Document Types
        1. Introduction
          1. Getting ready
            1. TeX and LaTeX distributions
            2. LaTeX editors
        2. Writing a short text
          1. How to do it...
          2. How it works...
          3. See also
        3. Writing a thesis
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
            1. Changing the input encoding
            2. Getting a right-justified table of contents
            3. Changing the margins
            4. Modifying the layout of captions
            5. Centering displayed equations
          5. See also
        4. Designing a book
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Changing the page layout
            2. Designing a title page
            3. Adding a cover page
            4. Changing the document class
          4. See also
        5. Creating a presentation
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Using short titles and names
            2. Uncovering information piecewise
            3. Splitting frames in columns
            4. Showing an outline for each section
            5. Removing the navigation symbols
            6. Changing the font
            7. Changing the color
            8. Loading a theme from the Internet
            9. Providing a handout
          4. See also
        6. Designing a curriculum vitae
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. See also
        7. Writing a letter
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Separating paragraphs
            2. Changing the signature
            3. Adding enclosures
        8. Producing a leaflet
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Fold marks and cut lines
            2. Adjusting the margins
            3. Adding a background image
            4. Changing the sectioning font
        9. Creating a large poster
          1. How to do it...
          2. How it works...
          3. There's more...
      9. 2. Tuning the Text
        1. Introduction
        2. Inputting accented characters
          1. How to do it...
          2. How it works...
          3. There's more...
        3. Improving justification and hyphenation
          1. How to do it...
          2. How it works...
        4. Converting numbers to words
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Multilingual support
            2. Gender
            3. Enumerated lists
        5. Putting text into a colorful box
          1. How to do it...
          2. How it works...
          3. There's more...
        6. Visualizing the layout
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Using geometry
            2. Examining the page layout details
        7. Visualizing boxes of letters and symbols
          1. How to do it...
          2. How it works...
        8. Typesetting in a grid
          1. How to do it...
          2. How it works...
          3. There's more...
        9. Absolute positioning of text
          1. How to do it...
          2. How it works...
          3. There's more...
        10. Starting a paragraph with an over-sized letter
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Changing the drop cap size
            2. Coloring the initial
        11. Fitting text to a shape
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Further shapes
            2. Cutting out shapes
        12. Creating a pull quote
          1. How to do it...
          2. How it works...
          3. There's more...
      10. 3. Adjusting Fonts
        1. Introduction
          1. Basic font commands
          2. There's more...
        2. Choosing a font for a document
          1. Getting ready
          2. How to do it...
          3. There's more...
            1. Latin Modern
            2. Kepler fonts
            3. Font combinations
        3. Locally switching to a different font
          1. How to do it...
            1. A command for changing the font
            2. An environment for changing the font
          2. How it works...
          3. There's more...
        4. Importing just a single symbol from a font family
          1. Getting ready
          2. How to do it...
          3. How it works...
        5. Writing bold mathematical symbols
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Standard LaTeX
            2. AMS-LaTeX and amsmath
            3. Comparing bm and amsmath
        6. Getting the sans serif mathematics font
          1. How to do it...
          2. How it works...
          3. There's more...
            1. An alternative approach
            2. Sans serif fonts with direct math support
            3. Arev Sans
            4. Kepler fonts
        7. Writing double stroke letters as if on a blackboard
          1. How to do it...
          2. How it works...
          3. There's more...
        8. Enabling the searching and copying of ligatures
          1. How to do it...
          2. How it works...
          3. There's more...
        9. Suppressing ligatures
          1. How to do it...
          2. How it works...
        10. Adding a contour
          1. How to do it...
          2. How it works...
          3. See also
      11. 4. Working with Images
        1. Introduction
        2. Including images with optimal quality
          1. Getting ready
          2. How to do it...
          3. How it works...
        3. Automating image positioning
          1. How to do it...
          2. How it works...
            1. There's more
            2. Limiting the floating figures and tables
            3. Fixing the position of a figure
          3. See also
        4. Manipulating images
          1. How to do it...
        5. Adding a frame to an image
          1. How to do it...
          2. How it works...
        6. Cutting an image to get rounded corners
          1. How to do it...
          2. How it works...
          3. There's more...
        7. Shaping an image like a circle
          1. How to do it...
          2. How it works...
          3. There's more...
        8. Drawing over an image
          1. How to do it…
          2. How it works...
        9. Aligning images
          1. How to do it...
          2. How it works...
        10. Arranging images in a grid
          1. How to do it...
          2. How it works...
        11. Stacking images
          1. How to do it...
          2. How it works...
      12. 5. Beautiful Designs
        1. Introduction
        2. Adding a background image
          1. How to do it...
          2. How it works...
          3. There's more...
        3. Creating beautiful ornaments
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        4. Preparing pretty headings
          1. How to do it...
          2. How it works...
        5. Producing a calendar
          1. How to do it...
          2. How it works...
        6. Mimicking keys and menu items
          1. How to do it...
          2. How it works...
      13. 6. Designing Tables
        1. Introduction
        2. Creating a legible table
          1. How to do it...
          2. How it works...
          3. There's more...
        3. Adding footnotes to a table
          1. How to do it...
          2. How it works...
        4. Aligning numeric data
          1. How to do it...
          2. How it works...
          3. There's more...
        5. Coloring a table
          1. How to do it...
          2. How it works...
        6. Merging cells
          1. How to do it...
          2. How it works...
          3. There's more...
        7. Splitting a cell diagonally
          1. How to do it...
          2. How it works...
        8. Adding shape, shading, and transparency
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Numbering table rows automatically
            2. Adding styles to rows and columns
        9. Importing data from files
          1. How to do it...
          2. How it works...
      14. 7. Contents, Indexes, and Bibliographies
        1. Introduction
        2. Tuning a table of contents, lists of figures, and tables
          1. How to do it...
            1. Automatic correction of widths
            2. Printing a flat table of contents
            3. Getting KOMA-Script like-sans-serif headings
          2. How it works...
          3. There's more...
        3. Creating a bibliography
          1. How to do it...
          2. How it works...
          3. There's more...
        4. Adding a glossary
          1. How to do it...
          2. How it works...
        5. Creating a list of acronyms
          1. How to do it...
          2. How it works...
        6. Producing an index
          1. How to do it...
          2. How it works...
          3. There's more...
      15. 8. Getting the Most out of the PDF
        1. Introduction
        2. Adding hyperlinks
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Inserting custom hyperlinks
              1. Linking to a place within the document
              2. Linking to labeled objects
              3. Linking to the Internet
            2. Changing the color and shape of the hyperlinks
            3. Getting backreferences in the bibliography
            4. Hyperlinking index entries
        3. Adding metadata
          1. How to do it...
          2. How it works...
          3. There's more...
        4. Adding copyright information
          1. How to do it...
          2. How it works...
          3. There's more...
        5. Inserting comments
          1. How to do it...
          2. How it works...
        6. Producing fillable forms
          1. How to do it...
          2. How it works...
        7. Optimizing the output for e-book readers
          1. How to do it...
          2. How it works...
          3. There's more...
        8. Removing white margins
          1. Getting ready
          2. How to do it...
          3. How it works...
          4. There's more...
        9. Combining PDF files
          1. How to do it...
          2. How it works...
        10. Creating an animation
          1. How to do it...
          2. How it works...
      16. 9. Creating Graphics
        1. Introduction
          1. Getting ready
        2. Building smart diagrams
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Circular diagrams
            2. Bubble diagrams
            3. Constellation diagrams
            4. Descriptive diagrams
            5. Priority descriptive diagrams
            6. Animating a diagram
            7. Further customization
        3. Constructing a flowchart
          1. How it works...
        4. Building a tree
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Creating a decision tree
        5. Building a bar chart
          1. How to do it...
          2. How it works...
        6. Drawing a pie chart
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Square charts
            2. Polar area charts
            3. Cloud charts
        7. Drawing a Venn diagram
          1. How to do it...
          2. How it works...
        8. Putting thoughts in a mind map
          1. How to do it...
          2. How it works...
        9. Generating a timeline
          1. Getting ready
          2. How to do it...
          3. How it works...
      17. 10. Advanced Mathematics
        1. Introduction
        2. Quick-start for beginners
          1. How to do it...
          2. How it works...
            1. Math styles
            2. Greek letters
            3. Math symbols
            4. Squares and fractions
          3. There's more...
            1. Subscripts and superscripts
            2. Operators
            3. Numbering and referencing equations
            4. Writing multiline formulas with alignment
              1. Aligning at the relation symbol
              2. Centering a block of equations
            5. Adjusting numbering
        3. Fine-tuning math formulas
          1. Getting ready
          2. How to do it...
          3. How it works...
        4. Automatic line-breaking in equations
          1. How to do it...
          2. How it works....
        5. Highlighting in a formula
          1. How to do it...
          2. How it works...
          3. There's more...
        6. Stating definitions and theorems
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Adjusting the numbering
            2. An alternative theorem package
            3. Additional theorem tools
        7. Drawing commutative diagrams
          1. How to do it...
          2. How it works....
          3. There's more...
        8. Plotting functions in two dimensions
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Adding ticks and grids
            2. Reducing axes
            3. Plotting in polar coordinates
        9. Plotting in three dimensions
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Reducing axes
        10. Drawing geometry pictures
          1. How to do it...
          2. How it works....
            1. Defining points
            2. Calculating points
            3. Drawing objects
            4. Printing labels
          3. There's more...
        11. Doing calculations
          1. How to do it...
          2. How it works....
          3. See also
      18. 11. Science and Technology
        1. Introduction
        2. Typesetting an algorithm
          1. How to do it...
          2. How it works...
          3. There's more...
        3. Printing a code listing
          1. How to do it...
          2. How it works...
          3. There's more...
        4. Application in graph theory
          1. How to do it...
          2. How it works...
        5. Writing physical quantities with units
          1. How to do it...
          2. How it works...
        6. Writing chemical formulae
          1. How to do it...
          2. How it works...
          3. There's more...
        7. Drawing molecules
          1. How to do it...
          2. How it works...
          3. There's more...
            1. Drawing rings
            2. Naming molecules
            3. Using building blocks
            4. Applying TikZ options
            5. Using ready-drawn carbohydrates
        8. Representing atoms
          1. How to do it...
          2. How it works...
        9. Drawing electrical circuits
          1. How to do it...
          2. How it works...
          3. See also
      19. 12. Getting Support on the Internet
        1. Introduction
        2. Exploring online LaTeX resources
          1. How to do it...
            1. Software archives and catalogues
            2. User groups
            3. Web forums and discussion groups
            4. Frequently Asked Questions
          2. There's more...
        3. Using web forums
          1. How to do it...
          2. How it works...
          3. There's more...
        4. Framing a really good question
          1. How to do it...
        5. Creating a minimal example
          1. How to do it...
          2. There's more...
      20. Index