I want to calculate the ideal size of figures that I export from R and include in LaTeX documents (so the text size of the figure labels is in a known proportion to the font size of the resulting document). However, for twocolumn documents I don't know how LaTeX calculates \linewidth. Is there a formula on how to calculate this? I would need something like:

(paperwidth - margins)/2 - distance_of_the_columns_as_a_function_of_font_size

Of course, I could compile the pdf and include


to get the linewidth of the current document (which I could then provide manually to R), but I want to write a R script that I can run "blindly" and that calculates the required values from the plain .tex file automatically.

Edit: I tested


for 8pt, 10pt, 11pt and 12pt article and scrartcl documents and always got 10pt, hence I assume the value is constant for regular cases. This will make things fairly easy, since \columnwidthwill then be:

(\paperwidth - margins - 10pt)/2```
  • 2
    \linewidth doesn't have a fixed value: it changes if you're in a list environment, for instance. What you want is \columnwidth. – egreg Aug 29 at 10:32
  • Thanks, yes I think with the answer of David I'll get the correct results when I implement a calculation of \columnsep. Then I'll just use (paperwidth - margins - columnsep)/2 for \columnwidth. I think the number of font sizes and paper formats I use is limited, so I can just include the respective \columnsep-values in an if then else statement (y) – Manuel Popp Aug 29 at 10:39

The calculation is

\def \twocolumn {%

That is \linewidth is \columnwidth which is half of \textwidth after subtracting the column sep (10pt in article class).

\textwidth is set in each document class in different ways (and is often re-set by packages such as geometry) by default, in article class with the default 10pt option it is set by


which is more or less 345pt or 2in less than \paperwidth

| improve this answer | |

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.