I am drawing my graphics for an article with tikz. For reasonable compilation speed I always draw the graphs as a standalone document and then include the graphic.

My question is now, how to figure out the right size in standalone. Of course, I don't want my graphic to be to big for my pages. Scaling it always messes up the layout to some degree. Is there a recommended way to do it? Or at least the possibility to show some A4 box to be able to ``guess'' the proper size?

Minimum example:


    \draw (0,0) circle (10);

How do I e.g. know how big I can make this circle, before I have to re-scale my picture to fit it on a page?

  • 1
    There is a similar question here. – berkus Nov 26 '17 at 13:54
  • If you don't crop it, you can set the page to, say, A4 or whatever and use showframe or geometry or whatever package you're using. Then use cropping only when including the image. I always just look at the PDF properties, myself, but that is likely not the most efficient strategy. – cfr Nov 26 '17 at 14:26
  • Thanks @cfr, geometry and not cropping looks like a good start. It seems like standalone crops by default, removing the option doesn't change anything. I am using scrarticle, so I don't exactly know what to pass to geometry but a4page should be a good start. Is there also a possibility do draw a rectangle over the whole page to get an impression? – DerWeh Nov 26 '17 at 15:18
  • You can use \rule{\textwidth}{\textheight} to fill the text area. You can also use \the\textwidth and \the\textheight (then convert pt to in or cm). Note that PDF is not rasterized, so you lose no resolution by scaling with \includegraphics. Just zoom in on the picture. – John Kormylo Nov 26 '17 at 16:14
  • @JohnKormylo Scaling fonts is not recommended, though. – cfr Nov 26 '17 at 17:17

You could use option class=scrartcl to change the underlying class to your neeeds. Then add all options needed by KOMA-Script package typerarea to calculate the page layout, e.g. DIV, BCOR, headinclude, fontsize etc.

Note that class standalone changes \textheight. So you have to use \storeareas and \recalculatetypearea to get the KOMA-Script \textheight. This must be saved in a macro before the standalone layout settings are restored.

Then it is possible to add e.g. a red rectangle showing the size of the text area of the KOMA-Script document. In the following example the upper left corners of the TiKZ picture and the red rectangle are aligned.

  class=scrartcl,% underlying class which is loaded by standalone
  headinclude,fontsize=12pt,% options used by typearea

\storeareas\standalonelayout% save the standalone layout
\recalctypearea% recalculate the typearea layout
\edef\savedtextheight{\the\textheight}% save the text height of the typearea layout
\standalonelayout% restore the standalone layout

% draw a red rectangle aligned with the upper left corner of the TikZ picture
% to show the size of the text area in the KOMA document:
  every picture/.append style={
    execute at end picture={%
      \draw[red](current bounding box.north west)

    \draw (0,0) circle (10);


enter image description here

| improve this answer | |
  • Works like a charm, it's more than I expected. But now I get greedy. Is it also possible to adjust Tikzs `internal grid'. To say e.g. the left bottom corner is coordinate (0,0) and I want to fix the right bottom corner at (10, 0) or (12, 0) to have an easy impression of the ratios I am working with? – DerWeh Nov 30 '17 at 21:08
  • I am sorry, but I do not understand what you want to do. – esdd Dec 1 '17 at 7:47

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.