4 Formatting

4.1 Alignment

As with all text, there are times when you want to change how it is aligned. By default Latex justifies all your text so that it lines up on both the left and right margins.

Left

Any text in between \begin{flushleft}...\end{flushleft} will be aligned with the left-hand margin, but have a ragged right-hand edge. This is another case of a LaTeX environment. If you are already in an environment you can switch this style of alignment on in a different way using \raggedright.

Right

The environment \begin{flushright}...\end{flushright} does the opposite of flushleft, and the text will be aligned with the right-hand margin, and have a ragged left-hand edge. If you are already in an environment you can switch this style of alignment on in a different way using \raggedleft.

Centre ("Center")

The environment \begin{center}...\end{center} is used to centre the text (note the American spelling). Each line is centred individually. This tends to make the paragraph look ugly and hard to read, but it is useful for centring figures, tables etc. Inside another environment you can use \centering. Sometimes the command \centerline{} can be useful; this command centres everything in its argument.

Exercise 4

Try changing the alignment of different parts of your text.

Summary


Previous page Next page