Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
LaTeX Beginner's Guide - Second Edition

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

Product type Book
Published in Oct 2021
Publisher Packt
ISBN-13 9781801078658
Pages 354 pages
Edition 2nd Edition
Languages
Author (1):
Stefan Kottwitz Stefan Kottwitz
Profile icon Stefan Kottwitz

Table of Contents (16) Chapters

Preface 1. Chapter 1: Getting Started with LaTeX 2. Chapter 2: Formatting Text and Creating Macros 3. Chapter 3: Designing Pages 4. Chapter 4: Creating Lists 5. Chapter 5: Including Images 6. Chapter 6: Creating Tables 7. Chapter 7: Using Cross-References 8. Chapter 8: Listing Contents and References 9. Chapter 9: Writing Math Formulas 10. Chapter 10: Using Fonts 11. Chapter 11: Developing Large Documents 12. Chapter 12: Enhancing Your Documents Further 13. Chapter 13: Troubleshooting 14. Chapter 14: Using Online Resources 15. Other Books You May Enjoy

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.

You have been reading a chapter from
LaTeX Beginner's Guide - Second Edition
Published in: Oct 2021 Publisher: Packt ISBN-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.
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 $15.99/month. Cancel anytime}