tags:

views:

6859

answers:

2

For sizing figures in LaTeX it's helpful to know how wide the text is so that figures can be sized to match without rescaling. LaTeX provides \textwidth for reference by other commands, e.g.
\includegraphics[width=\textwidth]{figure}
but including \textwidth "raw" in the document produces errors.

Is there a way to determine what this value is?

+4  A: 

The printlen package:

\documentclass{article}
\usepackage{printlen}
\begin{document}
\printlength\textwidth
\end{document}

produces "345.0pt". It can print in units other than pt, too.

jleedev
`printlen` isn't included by default in teTeX which makes this solution a bit harder, but I'm impressed by the quick response!
Just use \the, it's built into TeX itself.
jleedev
teTeX is unsupported for a couple of years now. You should be using TeXLive instead.
Will Robertson
Thanks for the heads up about teTeX. Once TeXLive makes it into fink's repository I'll gladly move to it.
+5  A: 

From http://www.latex-community.org/forum/viewtopic.php?f=5&t=2712

Using \the\textwidth will allow you to see the value LaTeX is using. However, the default unit of measurement is probably points, not a likely option for your graphics software.

Fortunately, the conversion function is available in the standard layouts package: \usepackage{layouts}
...
textwidth in cm: \printinunitsof{cm}\prntlen{\textwidth}
will print the value in cm. All the usual LaTeX units of measurement are also available if cm aren't what you want.