LaTeX3 provides tmpa and tmpb scratch variables for many different types. As documented, they may be overwritten by other non-kernel code and so should only be used for short-term storage.

What is exactly short-term storage ?

I would say "a group with only kernel, private code, and no third party code whether explicit or not". This seems a serious limitation for the usage of such variables.

  • 3
    What do you mean by "serious limitation"? It is the same as with every public scratch variable, e.g. \box 0 or \@tempskipa or \dimen@ (where the wrong use lead to an incompability between xcolor and soul tex.stackexchange.com/a/48502/2388). Commented Jul 30, 2021 at 7:04

1 Answer 1


The scratch variables are safe if you have no third-party code between setting and usage. As the core of expl3 does not use these variables at all, you can have basic functions intervening without risk.

Personally, I tend to think of the general scratch variables as mainly aimed at use in ad hoc code in documents. They are also useful for genuinely one-off operations during package loading. Anything that is used repeatedly in a package is likely better using a private scratch variable.

You must log in to answer this question.

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