Tell me more ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Is there a way, in LaTeX3, to find out whether a given control sequence or variable is a box register (created with \box_new:(cN))?

share|improve this question
1  
You can test with \box_if_exist:NTF, but this doesn't really test if the control sequence has been created with \box_new:N. There isn't a \boxdef primitive in TeX: box registers are accessed only with integers. So \box_new:N actually defines an integer constant. – egreg Jan 22 at 15:23
@egreg: Thanks. If a subsequent \box_if_empty_p:N evaluates to false, can I be sure the tested integer is a box? – AlexG Jan 22 at 15:32
No. If the tested integer is the constant 32000, for instance, it addresses box register 32000 even if not defined with \box_new:N – egreg Jan 22 at 15:39
2  
At present, we don't track the names of boxes other than using the plain/LaTex2e like approach of assigning a number for a box (as @egreg outlines). However, we could in principal add a list of these to the internal LaTeX3 information, and then query that. What I guess would needed is a use case. – Joseph Wright Jan 22 at 18:06
Probably the best is to rely on one's own defined variables. There's no problem in allocating new ones, so long as they are a bit less than 32768. – egreg Jan 22 at 18:47
show 1 more comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.