This small example

    \clip (0,0) rectangle (12.8cm, 1.15cm);
    \draw (0,0) grid (12.8cm, 1.15cm);

generates this output:


Where is the margin / extra space on the left side coming from, and how can I remove it? Shouldn't \clip take care of that?

  • You don't need graphicx,color if you're loading TikZ. You almost certainly shouldn't be loading both xltxtra and textcomp. That suggests some level of confusion. Do you really want textpos for a standalone TikZ picture?
    – cfr
    Jun 7, 2016 at 22:21

1 Answer 1




With the tikz option the standalone class knows that it should crop the environment(s) tikzpicture and not only the given text box.

With the border option you can better control the result

  • 2
    thank you, that worked just fine. Could you maybe elaborate a bit about the use of the tikz option, what does it do?
    – barbaz
    Oct 14, 2013 at 9:38
  • 1
    see documentation page 7
    – user2478
    Oct 14, 2013 at 9:41
  • This reference shows a simple solution: \documentclass[border=10pt]{standalone}.
    – Rubens
    Jul 22, 2014 at 21:56
  • 3
    @Rubens: border=... doesn't solve the problem with the tikz key ...
    – user2478
    Jul 23, 2014 at 4:40
  • 1
    Alternatively, one could use multi=tikzpicture,varwidth=false instead. The only difference according to the documentation is that standalone would not load the tikz package itself thus one has to do that manually. However, this might help in some situations, e.g., if one uses \usepackage[svgnames]{xcolor} which has to be loaded before tikz or else results in LaTeX Error: Option clash for package xcolor. (which would be impossible if the document class has loaded tikz already.
    – stefanct
    Nov 10, 2017 at 13:58

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .