×
Clique aqui e veja a página ShareLaTeX em Inglês

[edit] ShareLaTeX guides

[edit] LaTeX Basics

[edit] Mathematics

[edit] Figures and tables

[edit] References and Citations

[edit] Languages

[edit] Document structure

[edit] Formatting

[edit] Fonts

[edit] Presentations

[edit] Commands

[edit] Field specific

[edit] Class files

Even though the default formatting in LaTeX is fine, sometimes we need to change some elements. In this article is explained how to format paragraphs, change the text alignment and insert blank spaces.

Contents

[edit] Introduction

Let's start with an example:

\begin{center}
Example 1: The following paragraph (given in quotes) is an 
example of Center Alignment using the center environment. 
 
``LaTeX is a document preparation system and document markup 
language. LaTeX uses the TeX typesetting program for formatting 
its output, and is itself written in the TeX macro language. 
LaTeX is not the name of a particular editing program, but 
refers to the encoding or tagging conventions that are used 
in LaTeX documents".
\end{center}

ParagraphsEx1.png

This two paragraphs are written inside a center environment, which causes them to be centred. Notice that to start a new paragraph you have to insert a blank line in between them. This is quite natural, but not the only way declare a new paragraph.

  Open the examples in ShareLaTeX.

[edit] New Paragraph

To start a new paragraph in LaTeX, as said before, you must leave a blank line in between. There's another way to start a new paragraph, look at the following code snippet.

This is the text in first paragraph. This is the text in first 
paragraph. This is the text in first paragraph. \par
This is the text in second paragraph. This is the text in second 
paragraph. This is the text in second paragraph.

Paragraph-blank line.png

As you can see, the \par command also starts a new paragraph.

By default, the paragraphs are indented by 1.5 times the point size of the current font. Also, there is no extra blank space inserted between the paragraphs. In the sections below is described how to change that.

  Open the examples in ShareLaTeX.

[edit] Paragraph Alignment (Text Justification)

Paragraphs in LaTeX are fully justified, i.e. flush with both the left and right margins. If you would like to change the justification of a paragraph, LaTeX has the following three environments: center, flushleft and flushright (see an example of center at the introduction).

\begin{flushleft}
``LaTeX is a document preparation system and document markup 
language. LaTeX uses the TeX typesetting program for formatting 
its output, and is itself written in the TeX macro language. 
LaTeX is not the name of a particular editing program, but refers 
to the encoding or tagging conventions that are used in LaTeX documents".
\end{flushleft}

ParagraphsEx3.png

The flushleft environment left-justifies the paragraph. To right-justify use flushright instead.

The aforementioned environments are based upon the switch commands: \raggedright (equivalent to flushleft), \raggedleft (equivalent to flushright) and centering (equivalent to center). A switch command switches the alignment from the point where it's inserted down to the end of the document, unless another switch command is inserted.

For more detailed information and examples on text alignment see the article Text alignment.

  Open the examples in ShareLaTeX.

[edit] Paragraph Indentation

By default, LaTeX does not indent the first paragraph of a section. The size of the subsequent paragraph indents is determined by the parameter. \parindent

\setlength{\parindent}{10ex}
This is the text in first paragraph. This is the text in first 
paragraph. This is the text in first paragraph. \par
\noindent %The next paragraph is not indented
This is the text in second paragraph. This is the text in second 
paragraph. This is the text in second paragraph.

ParagraphsEx5.png

The default length of this parameter is set by the document class used. It is possible to change the indent size of the paragraph by using the command \setlength. In the example the paragraphs below \setlength{\parindent}{10ex} will be indented 10ex (an "ex" equals the lenght of the "x" in the current font)

If you want to create a non-indented paragraph, like the second one in the example, you can use the command \noindent at the beginning of the paragraph.

If you want to indent a paragraph that is not indented you can use \indent above it. It should be noted that this command will only have an effect when \parindent is not set to zero.

Detailed information and further examples can be found at Paragraph formatting.

  Open the examples in ShareLaTeX.

[edit] Further Reading

For more information check