Before asking, I have checked Centered box, text inside it flushed right?, Questions about \fbox, and Any way to center text within a \parbox?.
Here I have tested various centering methods (my intention is to use \centering
only) on \framebox
and \makebox
alike.
\framebox{This is a sentence of text.}\par
\makebox{This is a sentence of text.}\par
{\indent \centering\framebox{This is a sentence of text.}}\par
{\indent \centering\makebox{This is a sentence of text.}}\par
\framebox{\centering This is a sentence of text.}\par
\makebox{\centering This is a sentence of text.}\par
\framebox[5cm]{\centering This is a sentence of text.}\par
\makebox[5cm]{\centering This is a sentence of text.}\par
\framebox[\linewidth]{This is a sentence of text.}\par
\makebox[\linewidth]{This is a sentence of text.}\par
\framebox[5cm]{\centering This is a sentence of text.}\par
\makebox[5cm]{\centering This is a sentence of text.}\par
\framebox{\centering\parbox{5cm}{This is a sentence of text.}}\par
\makebox{\centering\parbox{5cm}{This is a sentence of text.}}\par
\parbox{5cm}{\centering\framebox{This is a sentence of text.}}\par
\parbox{5cm}{\centering\makebox{This is a sentence of text.}}\par
\begin{center}
\framebox{This is a sentence of text.}\par
\makebox{This is a sentence of text.}
\end{center}
The only standard LaTeX method (no packages) I can achieve is using the center environment (the last one). Is that so, and why?
An image is shown below.
\par
inside the group, not outside and you'll see something different. For example{...\centering...\par}
.