4.1 Text alignment

A LaTex document is fully justified by default. This means the text is flush-aligned on the left edge and on the right edge. LaTex manages this internally by adjusting the micro-spaces between letters and words. However, it is possible to overwrite the default behaviour. The \flushleft, \flushright and \center commands will produce chunks of text (or even the whole document if the command is invoked in the preamble) aligned appropriately. The\center command (\begin{center} will center the text avoiding the micro-justification. This means the text chunk will have ragged left and right edges

The code snippet below produces the Figure 4.1 to illustrate these points.

1. \documentclass[12pt]{article}
2. \usepackage[margin=1in]{geometry}
3. \usepackage{lipsum}
4. \pagenumbering {arabic}
5. \begin{document}
6. \section*{Fully justified text as the default option}
7. \lipsum[1]
8. \section*{Left justified text}
9. \begin{flushleft}
10. \lipsum[2]
11. \end{flushleft}
12. \section*{Right justified text}
13. \begin{flushright}
14. lipsum[3]
15. \end{flushright}
16. \section*{Centered text}
17. \begin{center}
18. \lipsum[4]
19. \end{center}
20. \end{document}

Figure 4.1 Text alignment options