Book Image

LaTeX Beginner's Guide - Second Edition

By : Stefan Kottwitz
4 (1)
Book Image

LaTeX Beginner's Guide - Second Edition

4 (1)
By: Stefan Kottwitz

Overview of this book

LaTeX is high-quality open source typesetting software that produces professional prints and PDF files. It's a powerful and complex tool with a multitude of features, so getting started can be intimidating. However, once you become comfortable with LaTeX, its capabilities far outweigh any initial challenges, and this book will help you with just that! The LaTeX Beginner's Guide will make getting started with LaTeX easy. If you are writing mathematical, scientific, or business papers, or have a thesis to write, this is the perfect book for you. With the help of fully explained examples, this book offers a practical introduction to LaTeX with plenty of step-by-step examples that will help you achieve professional-level results in no time. You'll learn to typeset documents containing tables, figures, formulas, and common book elements such as bibliographies, glossaries, and indexes, and go on to manage complex documents and use modern PDF features. You'll also get to grips with using macros and styles to maintain a consistent document structure while saving typing work. By the end of this LaTeX book, you'll have learned how to fine-tune text and page layout, create professional-looking tables, include figures, present complex mathematical formulas, manage complex documents, and benefit from modern PDF features.
Table of Contents (16 chapters)

Displaying quotes

Imagine your text contains a quotation from another author. It might be hard to read if it's just embedded in your text. A common way to improve the readability is setting the text off by indenting both margins. To do this, we will quote thoughts of famous physicists in our example:

  1. Create a new document with some introductory text:
    \documentclass{article}
    \begin{document}
    \noindent Niels Bohr said: ``An expert is a person
    who has made all the mistakes that can be made in
    a very narrow field.''
    Albert Einstein said:
  2. Display the quote:
    \begin{quote}
        Anyone who has never made a mistake has never
        tried anything new.
    \end{quote}
  3. Add some more body text, and finish:
    Errors are inevitable. So, let's be brave
    trying something new.
    \end{document}
  4. Click on Typeset to see the result:
Figure 2.21 – A quote

Figure 2.21 – A quote

Firstly, we quoted inline, that is, within the text flow in the paragraph. ` produces a left quotation mark, also called a backtick, and ' provides a right quotation mark. To get double quotes, we just typed two such symbols. We call this inline quoting.

Then, we used the quote environment to display a quotation separated from the surrounding text. We did not begin a new paragraph for it, because the quotation is already set a bit off in its own paragraph. That's called displayed quoting.

Quoting longer text

When writing short quotations, the quote environment looks very good. But when you would like to quote text containing several paragraphs, you might wish to have the same paragraph indentation as in your surrounding text. The quotation environment will do this for you.

Let's quote some of the benefits of TeX and LaTeX found on a web page on CTAN:

  1. Start a new document and add this text:
    \documentclass{article}
    \usepackage{url}
    \begin{document}
    The authors of the CTAN team listed ten good reasons
    for using \TeX. Among them are:
    \begin{quotation}
      \TeX\ has the best output. What you end with,
      the symbols on the page, is as useable, and beautiful,
      as a non-professional can produce.
      \TeX\ knows typesetting. As those plain text samples
      show, TeX's has more sophisticated typographical
      algorithms such as those for making paragraphs
      and for hyphenating.
      \TeX\ is fast. On today's machines \TeX\ is very fast.
      It is easy on memory and disk space, too. 
      \TeX\ is stable. It is in wide use, with a long
      history. It has been tested by millions of users,
      on demanding input.
      It will never eat your document. Never.
    \end{quotation}
    The original text can be found on
    \url{https://www.ctan.org/what_is_tex.html}.
    \end{document}
  2. Click on Typeset and look at the output:
Figure 2.22 – A long section of quoted text

Figure 2.22 – A long section of quoted text

This time, we used the quotation environment to display some paragraphs. As in normal text, blank lines separate the paragraphs; they are left-indented at their beginning just like in all our body text.

But what if we don't like that paragraph indentation? Let's check out an alternative.

In this example, we want to avoid paragraph indentation and instead, we shall separate the paragraphs with some vertical spacing. As filler text, we will use a few sentences of the previous example about quoting, as shown here:

  1. Create a small document with the following code (make sure the highlighted code is included):
    \documentclass{article}
    \usepackage{parskip}
    \usepackage{url}
    \begin{document}
    The authors of the CTAN team listed ten good reasons
    for using \TeX. Among them are:
    \TeX\ has the best output. What you end with,
    the symbols on the page, is as useable, and beautiful,
    as a non-professional can produce\ldots
    The original text can be found on
    \url{https://www.ctan.org/what_is_tex.html}.
    \end{document}
  2. Click on Typeset and see the effect:
Figure 2.23 – Vertical spacing between paragraphs

Figure 2.23 – Vertical spacing between paragraphs

Here, we loaded the parskip package—its only purpose is to remove the paragraph indentation completely. At the same time, this package introduces a skip between paragraphs. But this package doesn't affect the definition of the quotation environment; you still could use the quote environment.

Visualizing paragraph breaks

In order to distinguish paragraphs, there are two common ways. One is to indent the beginning of each paragraph; this is the default LaTeX style. The other way is to insert vertical space between paragraphs while omitting the indentation, which is suitable for narrow columns where indenting would cost too much width.