For me the "standalone" documents is useful to produce a document with a size that matches exactly the document. However, here is an example where the final size is to small:

enter image description here

Here is the same document, with an aditional 'A':

enter image description here

Do you know why the size of the first arrow is not the good one, and how to correct that?

Thank you!



1 Answer 1


As the TeX Book says (p. 63)

From TeX's viewpoint, a single character from a font is a box [...] The character shape need not fit inside the boundaries of its box.

Here we have such a situation: the \leftarrow is larger than the box, as the following snippet shows

\mathsurround0pt % for safety

enter image description here

However, standalone doesn't know that, so we must force it to consider a somewhat larger box. One easy way is to insert some vertical phantom, like \vphantom{A} or even a simple \strut. Alternatively, the standalone class accepts an optional argument border with syntax

border=〈length (all sides)〉
border={〈length (left/right)〉 〈length (bottom/top)〉}
border={〈length (left)〉 〈length (right)〉 〈length (bottom)〉 〈length (top)〉}

So in this case one might use



\documentclass[border={0pt 0pt 0pt 2pt}]{standalone}

if you want the border only above.

  • Does this helps? tex.stackexchange.com/questions/149500/… ... may be a \vphantom will do the work... or totalheightof from calc package...
    – koleygr
    Commented Aug 31, 2017 at 12:47
  • 1
    @koleygr Of course \vphantom would work too; \strut is even simpler. But sometimes you have glyphs that protrude horizontally out of the box, so an overall border is in my opinion the easiest way to cover all cases.
    – campa
    Commented Aug 31, 2017 at 12:53
  • 2
    You can also specify a separate border for each side, e.g. border={0pt 0pt 0pt 2pt} (left right bottom top) to only add those 2pt at the top. Commented Aug 31, 2017 at 14:02
  • 1
    Is the ordering for border: left bottom right top?
    – Teepeemm
    Commented May 30, 2019 at 16:13
  • @Teepeemm No: left/right/bottom/top. It's written in the answer and in Torbjørn's comment.
    – campa
    Commented May 31, 2019 at 7:34

You must log in to answer this question.

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