Any way to center text within a \parbox?
just use \centering
inside the box.
\parbox{2cm}{\centering
one two three four five six}
I assume you are using this package, so with some limitations you can do this:
\documentclass{article}
\usepackage{pbox}
\begin{document}
\parbox{2cm}{\centering
one two three four five six eight nine ten
aaaaaa\\
bbb}
\bigskip
\pbox{5cm}{\relax\ifvmode\centering\fi
one two three four five six eight nine ten\\
aaaaaa\\
bbb}
\end{document}
There is the varwidth
environment from the package with the same name, which is an auto-sizing version of minipage
. You only need to give a maximal width.
The text centering inside it or inside \parbox
can and should be done using \centering
.