How to Use LaTeX Paragraphs and Sections

How to Use LaTeX Paragraphs and Sections

LaTeX is a great software for creating professional-looking documents with mathematical formulas and symbols. These documents contain paragraphs and sections like on other document creation software. Let’s look at how to use LaTeX paragraphs and sections.

Why You Need to Format LaTeX Paragraphs and Sections

LaTeX generally does a great job of formatting different bodies of text. However, you may need to change some elements to make your LaTeX paragraphs appear right in the final document.

Starting a New Paragraph in LaTeX

It is possible to start a new paragraph in LaTeX using multiple methods. The easiest is to simply leave a blank line in between paragraphs. Another way is to use the command \par to create a second paragraph.

For example:

This is the example text for this document’s first paragraph. Each sentence in this sequence belongs to the first paragraph. \par

This is the example text for this document’s second paragraph. This sentence is also part of the document’s second paragraph.

The final document text will resemble the following:

Centering a LaTeX Paragraph

If you would like to align the text in LaTeX paragraphs with the middle of your page, you can use the command /begin{center} and /end{center}. For example:

\begin{center}

This paragraph uses the Center Alignment command. It keeps the text centered on the page and gives the paragraph a symmetrical layout.

\end{center}

The final document text will resemble the following:

Changing the Paragraph Alignment

The paragraphs in LaTeX are generally fully justified. This means they are flush within the right and left margins of the page. It is possible to change the justification of your LaTeX paragraphs by setting the right environment. These are:

  • center
  • flushleft
  • flushright

The following example illustrates how to make LaTeX paragraphs flush with the left margin of your page:

 \begin{flushleft}

This is sample text to illustrate how to make your paragraph flush with the left margin of the page.

\end{flushleft}

The text in the finished document will resemble the following:

Similarly, you can use flushright to right-justify your paragraphs.

Changing the Paragraph Indentation

LaTeX doesn’t indent the first paragraph of a document section. This is the default setting on the program. However, it is possible to set the indent for the next paragraph in your document using the command \parindent. For example:

\setlength{\parindent}{10ex}

This is the example text in the document’s first paragraph. This text is indented according to the command mentioned earlier. \par

\noindent 

This is the example text in the document’s second paragraph that is not indented.

The text in the final document resembles:

The default indentation size is typically set through the document class being used. In the above example, we set a custom indentation size using the \setlength command. All the paragraphs underneath the \setlength{\parindent}{10ex} are then indented to 10ex.

Adding Verbatim Text

LaTeX’s compiler tends to interpret text in its own manner. This means any text with special spacing such as “E x a m p l e” will show up as “Example” in the final document. You can get around this problem by setting a verbatim environment. With this approach, any text between the \begin{verbatim} and /end{verbatim} commands will be shown with the spacing they were originally set with.

For example:

\begin{verbatim}

This verbatim environment lets you reproduce

    each character as intended,

          including all  s p a c e s.

\end{verbatim}

The text in the output document will resemble:

Adding Chapters and Sections

LaTeX allows you to break up your document into different chapters and sections easily. It is recommended to break up long documents into chapters, and then break up these chapters into separate sections.

Some common chapter and section commands include:

  • \chapter{}: This lets you start a new chapter that is automatically numbered. If you wanted to name your chapter “The Beginning”, the command would be \chapter{The Beginning}.
  • /part{}: This lets you define the beginning of a major part of a book or report class.
  • /section{}: This defines the beginning of a new section. They are typically numbered. So section 2.4 would denote the fourth section of the second chapter.
  • /subsection{}: This defines the start of a subsection. These are also numbered automatically, so 2.4.3 would denote the third subsection of the fourth section of the second chapter.

Changing the Line Spacing 

It is possible to change the line spacing in the entire document using the command \linespread. Alternatively, users can use the following commands:

  • \doublespace: Setting lines to be double-spaced.
  • \onehalfspace: Setting lines for one-and-half spacing.
  • \singlespace: Setting normal line spacing.
  • \spacing: Setting a custom line spacing. For example: \begin{spacing}{\baselinestretch} … \end{spacing}

Adding Manual Breaks

It is possible to add manual breaks to your document. However, this isn’t generally recommended as LaTeX usually takes care of the formatting itself, and because doing it manually may harm your document formatting.

Some manual break commands include:

\newline: This breaks the line after the command.

\\: This also breaks the line after the command. It is essentially the shortened version of the \newline command.

\\[extra-space]: This command includes a special argument for specifying how much vertical space you would like before the next line starts.

Final Thoughts

As you can see, there are plenty of options for the lines, paragraphs, and sections in your LaTeX document. This software can help you prepare some fantastic-looking documents using the right combination of commands. So consider trying out some of the techniques mentioned above on your next LaTeX document.

Frequently Asked Questions

Some frequently asked questions related to using paragraphs and sections in LaTeX are shown below.

Q1. How do you write a paragraph in LaTeX?

You can start a new paragraph in LaTeX by leaving a blank line in between paragraphs. Another way is to use the command \par.

Q2. How do you put a space between paragraphs in LaTeX?

The command that defines the paragraph spacing is \parskip.  For example, the  command \setlength{\parskip}{1em} will set the paragraph separation to 1em.

Q3. How do you indent the first paragraph in LaTeX?

You can indent the first paragraph after a section using the indentfirst package. An example of the code for this is:
You can indent the first paragraph after a section using the indentfirst package. An example of the code for this is:
\documentclass{article}
\usepackage{indentfirst}
\usepackage{lipsum}
\begin{document}
\section{Section title}
\lipsum[1-3]
\end{document}


Photo of author
Author
Joannah W.
Joannah has been a science publisher with close to 20 years of experience. She wants to help students and researchers stay ahead of the trends and developments in the science community by making science more accessible to everyone.

Leave a Comment