I was peeking at the LaTeX3 Github repository and specifically l3auxdata.dtx. There was a surprise for me, as I have been practicing and studying the expl3 syntax and modules for the last couple of weeks. The surprise was code like:


I am not too sure if there was a reason for the code to use \def, but this reminded me of my own difficulties with the syntax.

There is a great temptation when starting with expl to bypass the verbosity of the expl language and use \def and TeX primitives. When I started with expl3 I was literally translating LaTeX2e code in my head and then writing it down. Pretty much like when you learn a foreign language.

I have by now mostly overcome this as I forced myself to do the following:

  1. Avoided \defs.
  2. As the too many underscores bothered me, at the beginning I wrote functions as \module_dosomething:nn. This way I was a bit quicker with debugging and typing. Only started adding l_ or g_ much later or on refactoring the code.
  3. I mentally kept reading the commands together with the argument specifier until it started sinking in. Like module dosomething en en. The reason I kept forgetting to write the specifier.
  4. When I used a tex_<cs>:D like a command, I went back and refactored the code later to remove it.
  5. Write notes with examples as I practice the commands. This can be also useful to others.

Do you have any additional tips and tricks to share?

  • Something that I should have done is revise the interface3.pdf semi-quickly, so you get a general idea of what's available. That is, get an idea of what seq, prop, clist, tl, box, msg, keys, fp, file, bool, etc. You will get the idea of what's there already done; you will avoid being in a situation when you discover that prop or seq exists that could have solved 30 minutes of your code that you wrote two days ago. I think getting that general idea is fast (less than half an hour) and then, when you see a problem yo know where to see if there's something ready for you.
    – Manuel
    May 9, 2015 at 12:21
  • 5
    @LeonMeier isn't there some TeX-loving-millionaire somewhere who would be thrilled to finance a prof for 10 years to do the work? Or even better, a team of 5 skilled TeX scripters over a timespan of 2 years or something like that? Your comment conveys a sad prospect.
    – thymaro
    Dec 3, 2017 at 7:39
  • 2
    I think that the only way to.learn how to use it is to use it:)
    – user30471
    Jun 15, 2019 at 2:24
  • Since when are functions meant to start with \l_ or \g_?
    – cfr
    Oct 3, 2019 at 21:51
  • 1
    Is your question really: how to go from TeX to expl3? Because your examples aren't using 2e syntax at all ....
    – cfr
    Oct 3, 2019 at 22:20

1 Answer 1


As the too many underscores bothered me, ...

+1 for too many underscores. I am really unable to use that syntax.

For people who don't like underscores in LaTeX3 programming layer (expl3), now there is a new functional package for you. It provides intuitive LaTeX2 interfaces for expl3.

It also emulates functional programming in other programming languages such as Lua. the evaluation of composite functions is from inside to outside. Here is a simple example:


% make every function become a group


\PrgNewFunction \MathSquare { m } {
  \IntSet \lTmpaInt { \IntEval {#1 * #1} }
  \Return { \Value \lTmpaInt }


Note that with this package, you need to pass return values of functions with \Return command.

You must log in to answer this question.

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