Setting a page in LaTeX
(Text) Fonts in LaTeX*
Margins in LaTeX*
Paragraphs in LaTeX
Paragraph Alignment
Paragraphs in LaTeX are usually fully justified, i.e. flush with both the left and right margins. For whatever reason, should you wish to alter the justification of a paragraph, there are three environments at hand, and also LaTeX command equivalents.
| Alignment | Environment | Command |
|---|---|---|
| Left justified | flushleft | \raggedright |
| Right justified | flushright | \raggedleft |
| Center | center | \centering |
All text between the \begin and \end of the specified environment will be justified appropriately. The commands listed are for use within other environments. For example, p (paragraph) columns in tabular.
Paragraph indent
By default, the first paragraph after a heading follows the standard Anglo-American publishers' practice of no indentation. The size of subsequent paragraph indents is determined by a parameter called \parindent. The default length that this constant holds is set by the document class that you use. It is possible to override it by using the \setlength command. This will set paragraph indents to 1cm:
\setlength{\parindent}{1cm} % Default is 15pt.
Whitespace in LaTeX can also be made flexible (what Lamport calls "rubber" lengths). This means that values such as extra vertical space inserted before a paragraph \parskip can have a default dimension plus an amount of expansion minus an amount of contraction. This is useful on pages in complex documents where not every page may be an exact number of fixed-height lines long, so some give-and-take in vertical space is useful. You specify this in a \setlength command like this:
\setlength{\parskip}{1cm plus 4mm minus 3mm}
If you want to indent a paragraph that is not indented, you can use
\indent
at the beginning of the paragraph. Obviously, this will only have an effect when \parindent is not set to zero. If you want to indent the beginning of every section, you can use the indentfirst package: once loaded, the beginning of any chapter/section is indented by the usual paragraph indentation.
To create a non-indented paragraph, you can use
\noindent
as the first command of the paragraph. This might come in handy when you start a document with body text and not with a sectioning command.
Be careful, however, if you decide to set the indent to zero, then it means you will need a vertical space between paragraphs in order to make them clear. The space between paragraphs is held in \parskip, which could be altered in a similar fashion as above. However, this parameter is used elsewhere too, such as in lists, which means you run the risk of making various parts of your document look very untidy by changing this setting. If you want to use the style of having no indentation with a space between paragraphs, use the parskip package, which does this for you, while making adjustments to the spacing of lists and other structures which use paragraph spacing, so they don't get too far apart. If you want both indent and break, use \usepackage{parskip} \setlength{\parindent}{15pt} To indent subsequent lines of a paragraph, use the TeX command \hangindent. (While the default behaviour is to apply the hanging indent after the first line, this may be changed with the \hangafter command.) An example follows. \hangindent=0.7cm This paragraph has an extra indentation at the left. The TeX commands \leftskip and \rightskip add additional space to the left and right sides of each line, allowing the formatting for subsequent paragraphs to differ from the overall document margins. This space is in addition to the indentation added by \parindent and \hangindent. To change the indentation of the last line in a paragraph, use the TeX command \parfillskip.