Reader small image

You're reading from  LaTeX Beginner's Guide - Second Edition

Product typeBook
Published inOct 2021
PublisherPackt
ISBN-139781801078658
Edition2nd Edition
Tools
Right arrow
Author (1)
Stefan Kottwitz
Stefan Kottwitz
author image
Stefan Kottwitz

Stefan Kottwitz studied mathematics in Jena and Hamburg. He works as a network and IT security engineer both for Lufthansa Industry Solutions and for Eurowings Aviation. For many years, he has been providing LaTeX support on online forums. He maintains the web forums LaTeX and goLaTeX and the Q&A sites TeXwelt and TeXnique. He runs the TeX graphics gallery sites TeXample, TikZ, and PGFplots, the TeXlive online compiler, the TeXdoc service, and the CTAN software mirror. He is a moderator of the TeX Stack Exchange site and matheplanet. He publishes ideas and news from the TeX world on his blogs LaTeX and TeX. Before this book, he authored the first edition of LaTeX Beginner's Guide in 2011, and LaTeX Cookbook in 2015, both published by Packt.
Read more about Stefan Kottwitz

Right arrow

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.

Previous PageNext Page
You have been reading a chapter from
LaTeX Beginner's Guide - Second Edition
Published in: Oct 2021Publisher: PacktISBN-13: 9781801078658
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at ₹800/month. Cancel anytime

Author (1)

author image
Stefan Kottwitz

Stefan Kottwitz studied mathematics in Jena and Hamburg. He works as a network and IT security engineer both for Lufthansa Industry Solutions and for Eurowings Aviation. For many years, he has been providing LaTeX support on online forums. He maintains the web forums LaTeX and goLaTeX and the Q&A sites TeXwelt and TeXnique. He runs the TeX graphics gallery sites TeXample, TikZ, and PGFplots, the TeXlive online compiler, the TeXdoc service, and the CTAN software mirror. He is a moderator of the TeX Stack Exchange site and matheplanet. He publishes ideas and news from the TeX world on his blogs LaTeX and TeX. Before this book, he authored the first edition of LaTeX Beginner's Guide in 2011, and LaTeX Cookbook in 2015, both published by Packt.
Read more about Stefan Kottwitz