One can specify a box in LaTeX, using various methods for example:


How can I retrieve the width, height and depth of the box. TeX has the primitives \wd, \ht and \dp. However in order for these to be used it is necessary to know the number of the box for example \box13.


You really shouldn't be referring to boxes by number even with the plain format. For example,


will work fine. Both \newbox and \newsavebox do a \chardef to assign the name you give as a number. So in LaTeX you can happily do


and all will be fine.

| improve this answer | |
  • Thanks Joseph. Out of curiosity, I see if I type \showthe\Abox I get the number 101, does LaTeX allocated from box100 onwards? Thanks for the tip though, I will not be using numbers even with the plain format :) – Yiannis Lazarides Sep 16 '10 at 20:28
  • No, it's just that the kernel itself allocates a lot of things, both as boxes and as inserts (which need a box leaving free). – Joseph Wright Sep 16 '10 at 20:51

I believe the canonical LaTeX way is this:

| improve this answer | |
  • 1
    Brent thanks. The question though asked how can the dimensions be retrieved i.e one or more of them might not be known. Is there a canonical way for this? – Yiannis Lazarides Sep 16 '10 at 21:12
  • Yiannis, I don't fully understand the comment. If you have a TeX "thinh", the three lengths are always (I think) known. The lengths \myhh etc can be used as standard TeX lengths, I believe. What more do you want to do with them? – Brent.Longborough Sep 18 '10 at 14:14

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.