[Tex/LaTex] I can’t use `\width` as the argument for `\parbox` or `minipage`

dimensionsminipageparboxwidth

I can't use \width as the argument for \parbox or minipage.

MWE:

\documentclass{article}

\begin{document}
Bla \begin{minipage}{\width}{test}\end{minipage}
\end{document}

To my understanding, everything I've read says that this should work (for instance Wikibooks and tag wiki).

Why is this not working?

Best Answer

\width is a command which is only locally defined in boxes that have a natural width, so

\makebox[2\width]{test}

makes a box twice as wide as would normally be the case.

However the content of a \parbox or minipage has no natural width in that sense, it is set in vertical mode so broken into lines to a width that must be specified in advance.

Related Question