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!



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





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 Aug 31 '17 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 Aug 31 '17 at 12:53
  • 1
    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. – Torbjørn T. Aug 31 '17 at 14:02
  • Is the ordering for border: left bottom right top? – Teepeemm May 30 at 16:13
  • @Teepeemm No: left/right/bottom/top. It's written in the answer and in Torbjørn's comment. – campa May 31 at 7:34

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.