Align Contents in LaTeX — Environments center, Center, flushleft, FlushLeft, flushright, FlushRight, and commands \centering, \Centering, \raggedleft, \RaggedLeft, \raggedright, \RaggedRight

Oct. 28, 2025 in Buffalo, United States • Updated Oct. 28, 2025

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
\documentclass[a5paper]{article}
\usepackage[x11names]{xcolor}
\pagecolor{AntiqueWhite1}
\usepackage{lipsum}
\usepackage{ragged2e}

\pagestyle{empty}
\begin{document}

\textbf{plain}: \lipsum[1][1-5]

\begin{center}
	\textbf{center environment}: \lipsum[1][1-5]
\end{center}

\begin{Center}
	\textbf{Center environment of ragged2e package}: \lipsum[1][1-5]
\end{Center}

{\centering \textbf{\textbackslash centering command}: \lipsum[1][1-5] \par} % \par and curly brackets are needed

{\Centering \textbf{\textbackslash Centering command of ragged2e package}: \lipsum[1][1-5] \par} % \par and curly brackets are needed

\newpage
\begin{flushleft}
	\textbf{flushleft environment}: \lipsum[1][1-5]
\end{flushleft}

\begin{FlushLeft}
	\textbf{FlushLeft environment of ragged2e package}: \lipsum[1][1-5]
\end{FlushLeft}

{\raggedleft \textbf{\textbackslash raggedleft command}: \lipsum[1][1-5] \par} % \par and curly brackets are needed

{\RaggedLeft \textbf{\textbackslash RaggedLeft command of ragged2e package}: \lipsum[1][1-5] \par} % \par and curly brackets are needed

\newpage
\begin{flushright}
	\textbf{flushright environment}: \lipsum[1][1-5]
\end{flushright}

\begin{FlushRight}
	\textbf{FlushRight environment of ragged2e package}: \lipsum[1][1-5]
\end{FlushRight}

{\raggedright \textbf{\textbackslash raggedright command}: \lipsum[1][1-5] \par} % \par and curly brackets are needed

{\RaggedRight \textbf{\textbackslash RaggedRight command of ragged2e package}: \lipsum[1][1-5] \par} % \par and curly brackets are needed
\end{document}

png-1

png-2

png-3

  • It seems that there is not a standard environment called centering, although I used it a lot before — I remember it works without errors or warnings ……
  • Environments will create additional vertical distance.
  • When using commands, instead of environments, remember to use \par and {} to isolate the content, which prevents influencing subsequent contents.
  • Those commands and environments (with capitalization) from the ragged2e package are built upon those original ones, and they avoid “the text looks too ragged” by using hyphenation somewhere if needed12.


References