At a first glance, I understood \c_empty_box as a replacement of \mbox{} but the following MWE (that points out a weird behavior of \c_empty_box: it is replaced by "æ") gives me serious doubts.



\tl_new:N \l_foo_tl%
\tl_new:N \l_bar_tl%

\tl_set:Nn \l_foo_tl {%
  \mbox{} \hfill Foo
\tl_set:Nn \l_bar_tl {%
  \c_empty_box \hfill Bar

\NewDocumentCommand{\baz}{ }


  • 1
    Side note: shouldn't \box_use:N be used? – Manuel Dec 15 '14 at 16:22
  • 4
    I guessed you're right but the David's answer gives me serious doubts (LaTeX3 in general gives me serious doubts ;) – Denis Bitouzé Dec 15 '14 at 16:28

As with other constant variables, \c_empty_box is intended as a fixed data point for use in for example comparisons. It should not be assigned and should be accessed using \box_use:N in contexts where a <box> is not marked as 'expected'.

The expl3 language is intended for lower-level programming and so should not be expected to have equivalents of every LaTeX2e document command, and at the same time there are still areas to be developed. The high-level LaTeX2e \mbox is a very different construct and is intended for inserting a horizontal box containing the given argument. Internally, \mbox uses \leavevmode, and this uses \voidb@x. The equivalence of \c_empty_box and \voidb@x may have led to the confusion.

At present, there is still discussion to be had on how best to handle \leavevmode functionality. What is almost certain is that it will be implemented using the equivalent of


rather than an unbox operation. This is because the construct above switches to horizontal mode such that this is complete before \everypar is inserted, whereas the 'classical' \leavevmode definition leaves the unboxing after the \everypar tokens. (pdfTeX and LuaTeX have \quitvmode to the same effect as the 'improved' defintion above, but XeTeX lacks this and in any case there is no gain from the additional primitive.)

| improve this answer | |

No, as its name shows it does not take an argument. It is in fact

> \c_empty_box=\char"1A.
l.5 \show\c_empty_box

> \box26=void

that is it is it is like \voidb@x defined by

\newbox\voidb@x % permanently void box register

in 2e or plain tex.

\mbox does \leavevmode to start a paragraph and then makes an \hbox with no internal content.

like all box allocations, what is actually stored is just the number (that can be passed to \box, \setbox or \wd primitives. Conventionally the allocation routines use \chardef tokens to store the numbers. So if you just access the token without prefixing with a box command then you get \char26 so whatever is in that slot in the current font encoding.

| improve this answer | |
  • 1
    @DavidCarlisle Still, it's not clear to me. May be because I don't understand what are you showing from the .log/terminal. In any case, isn't this related because of the definition of \leavemode (something with \voidb@x). I don't know, I feel like something is missing from this answer :) – Manuel Dec 15 '14 at 16:52
  • 1
    @Manuel \leavvmode is \unhboxvoidb@x` but that's not really like \mbox{} which is \leavevmode\hbox{} in particular \mbox puts a box into the horizontal list. – David Carlisle Dec 15 '14 at 16:58
  • 2
    @DenisBitouzé the \mbox{}\hfill construct seems to be a version of \hspace*{\fill} and to be honest I'd probably use that if you were generating document level markup which isn't really intended to be covered by the expl3 programming layer. – David Carlisle Dec 15 '14 at 17:03
  • 1
    @DenisBitouzé it is not empty as in \hbox{} which is an hbox with no content, it is declared but not set at all, it is not an hbox or a vbox it is just nothing. – David Carlisle Dec 15 '14 at 17:06
  • 1
    @DenisBitouzé probably the same (unless Joseph corrects me) expl3 is really the programming layer below such commands. – David Carlisle Dec 15 '14 at 19:08

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.