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.
but including \textwidth "raw" in the document produces errors.

Is there a way to determine what this value is?


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.

  • 10
    textwidth in inches: \printinunitsof{in}\prntlen{\textwidth} – Sean Oct 14 '13 at 11:10
  • 2
    For the article class, this gives the result 4.7747 inches. – musarithmia Sep 21 '15 at 15:48

The printlen package:


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

  • printlen isn't included by default in teTeX which makes this solution a bit harder, but I'm impressed by the quick response! – blahdiblah Apr 2 '09 at 1:27
  • 1
    Just use \the, it's built into TeX itself. – Josh Lee Apr 2 '09 at 1:28
  • 1
    teTeX is unsupported for a couple of years now. You should be using TeXLive instead. – Will Robertson Apr 2 '09 at 2:34
  • Thanks for the heads up about teTeX. Once TeXLive makes it into fink's repository I'll gladly move to it. – blahdiblah Apr 3 '09 at 23:15
  • report class appears to be 390pt in case anyone needs to know in the future – Hanmyo May 27 '17 at 2:34

I encountered the same challenge. However, I did not manage to use the abovementioned options. My LaTeX distribution did not recognized \printinunitsof as a valid statement.

What worked perfectly fine for me was to take a screen shot of the PDF and measure the width of the text and the width of the document in pixels using a programme like Paint. As the total document width in cm is known, you can calculate:

textwidth_cm = documentwidth_cm*textwidth_pixels/document_pixels

The textwidth is also equal to the documentwidth minus the left and right margins. If you explicitly specify the margins (e.g. with the geometry package), the textwidth is also easily calculated.


Here is an option with pgf

% !Mode:: "TeX:UTF-8"

\the\textwidth \\
\pgfmathresult pt \\

where \pgfmathparse returns \textwidth in points but without unit to \pgfmathresult, so you have to manually add unit to it


however you know it is always in points.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.