17

This question already has an answer here:

I hope that this is not a duplicate. Consider the MWE

\documentclass[tikz]{standalone}
\standaloneconfig{border=-3cm 0cm 0cm 0cm} 
\begin{document}
\begin{tikzpicture}
\draw(0,-5) grid (10,5);
\foreach \X in {0,...,10}
\node[circle,fill,label=45:{\X}] at (\X,0){};
\node at (5,2) {border=\{$\langle\mbox{length}~(\mbox{left})~\rangle$
$\langle\mbox{length}~(\mbox{right})~\rangle$
$\langle\mbox{length}~(\mbox{bottom})~\rangle$
$\langle\mbox{length}~(\mbox{top})~\rangle$
\}};
\end{tikzpicture}
\end{document}

enter image description here

The image gets cut at the left, which is consistent with the manual (top of page 9)

enter image description here

However, if I do

\standaloneconfig{border=0cm -3cm 0cm 0cm} 

instead, I get

enter image description here

i.e. the image gets cut at the bottom (rather than right side).

Overall, I think that the standalone crops according to

border={left bottom right top}

What am I doing wrong?

marked as duplicate by Martin Scharrer Mar 24 '18 at 17:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 3
    @Bernard Thanks for cropping the title of this question! ;-) – user121799 Mar 20 '18 at 20:05
18

Never read the documentation. Bad things happen. --- David Carlisle

Edit: [26/03/18]

Martin Scharrer just uploaded version 1.3 of standalone.cls to CTAN, which has the correct order of the border option: border={left bottom right top}.


Older versions of the standalone manual have the order of the border option switched. The correct order of the borders is:

border={<length (left)> <length (bottom)> <length (right)> <length (top)>}

In line 57 of standalone.cls we see:

\default@bp\sa@border@left{#1}%
\default@bp\sa@border@bottom{#2}%
\default@bp\sa@border@right{#3}%
\default@bp\sa@border@top{#4}%

which is the correct order of the arguments.

  • 3
    Indeed standalone follows the usual left-bottom-right-top order. I apparently made an mistake when writing the manual. – Martin Scharrer Mar 21 '18 at 8:20
  • 1
    I fixed this now in the code repository. Will be in the next version. bitbucket.org/martin_scharrer/standalone/commits/… – Martin Scharrer Mar 24 '18 at 17:19
  • @MartinScharrer In css the usual order is top-right-bottom-left, is the order left-bottom-right -top the standard in (la)tex world ? – Kpym Apr 22 '18 at 5:36
  • @Kpym: I'm using the order also used by the trim key of the graphicx package, as my package is kind of a generalization of the graphicx key=value interface to general content. As graphics/graphicx is pretty old you could say this order is the standard. – Martin Scharrer Apr 22 '18 at 6:24