[Tex/LaTex] Measuring height of fixed-width text box

boxescalculations

Suppose some text is put inside a fixed width box. The text will then continue in vertical direction. How can you measure the total height of that text?

Original text:

text text text text text 

Text in a box constrained to width of text text

text text
text text
text

How long is this?

+
|
+

Best Answer

You can make such a box and measure it directly.

\documentclass{article}
\usepackage{calc}
\newlength\foo
\begin{document}
\settototalheight\foo{\parbox{3cm}{text text text text text text text text text}}
\the\foo
\end{document}