43

To my eternal horror – reading a remark by egreg to some other post – I discovered that LaTeX 3 has been incorporated in the standard LaTeX kernel since 2020. I had missed it completely. Blame the strange COVID-19 year.

I think it is time for me and other end users (not internals wizards) to start learning more, too. It would be a shame if it stayed less noticed. Is there a document that promotes the end user transition?

Presumably, it could answer some basic questions:

  1. Why is LaTeX 3 better for end users than LaTeX 2e?
  2. How should one go about learning to use it?
  3. What should I now do differently?

For example, presumably, I should use some new commands (e.g., \NewDocumentEnvironment instead of newenvironment).

Pointers are appreciated.

PS: My wish that the name space for macros defined by end users would allow trailing digits, did not seem to have come true :-(.

7
  • 5
    A better phrasing of that statement is: the expl3 programming layer was incorporated into the LaTeX2e kernel. LaTeX2e usage stays the same for end users (so much so that you didn't notice it :). Of course, moving forward, documentation will be updated to recommend newer and more powerful interfaces, but old things will still work for the forseeable future (forever, likely, given the backwards compatibility tradition in the TeX community) Feb 11 at 3:17
  • 1
    Do you have a particular task in mind? How do you like to learn? Expl3 is too big for "a" tutorial; on the other hand, it is consistently and logically structured, so is easy to follow.
    – Cicada
    Feb 11 at 4:03
  • 3
    Regarding your PS: in the next latex (already available as latex-dev) you will be able to define a command with digits with \ExpandArgs{c}\newcommand{blub123}[1]{Hallo #1!} and then use it with \UseName{blub123}{world}. Feb 11 at 8:50
  • 1
    Alan Xiang has written a LaTeX 3 tutorial which also helps you getting used to interface3.pdf. Feb 11 at 19:44
  • Thank you for your question which spurred me on to ask a follow up tex.stackexchange.com/questions/633551. Feb 11 at 19:47

2 Answers 2

44

There is no LaTeX 3. The change that occurred was that the expl3 package which was initially conceived as "experimental latex 3" has been incorporated into the LaTeX format as a permanent stable enhancement, the "L3 programming layer".

On the terminal in every job, LaTeX reports this as:

LaTeX2e <2021-11-15> patch level 1
L3 programming layer <2022-02-05>

As a programming layer, you would not expect "end users" to be using this directly, but they will be using commands that are written using these commands.

Notable user level commands written in this L3 programming layer are

  • fontspec so all the font handling in LuaTeX and XeTeX

  • siunitx for consistent display of values and units.

  • ltcmd (part of the LaTeX format, formerly xparse) \NewDocumentCommand and related constructs providing enhanced alternatives to \newcommand

  • The new hook system re-implementing hooks such as \AtBeginDocument, with many more hooks allowing patching general commands, environments and packages via \AddToHook.

  • The new keys system based on l3keys package but providing a much enhanced keyval system, that is now available to package writers, both for commands and also in the latest release as a new key-val based package option system (this is very new and probably not used by any packages yet).

At a lower level, the format now includes other L3 programming layer modules that don't have user level interfaces yet but l3color has the back end support for a color system along the lines of xcolor, l3backend has back end support for graphics inclusion which could allow a re-implementation of graphicx, and support for linking which should allow build in support for features currently provided by hyperref.

Currently a lot of work is being done to improved PDF accessibility tagging, all of which is written in the L3 programming layer, but it will finally not require much or any "end user" action at all. Their documents should just generate more accessible PDF due to internal enhancements.

The above code is all by LaTeX team members, but other packages by LaTeX contributors such as the new extended tables package, tabularray are also written using more or less purely L3 code.

Note on your final PS regarding name parsing note that the L3 programming layer, like LaTeX2e is not a new executable. It is written in TeX, and runs on the same engines with the same primitive behaviour. So the catcode mechanism that underlies the basic TeX token parsing that governs the rules about the characters allowed in command names is unchanged. Making digits letters (catcode 11) so they are allowed in command names, makes it hard to use them in other constructs, and L3 can not change TeX.

0
23

In addition to David's extensive answer, one point to look at is usrguide3.pdf if you look for "what is relevant for me as a user". It will contain additions to LaTeX (which are likely to be written internally in the L3 programming layer) that are relevant and new.

As usual, documentation is a hard thing, so this is probably always lagging behind somewhat (e.g., the whole hook management system is only in lthooks-doc so far --- on the other hand that is mainly of interest for programmers and less so for users.

The other starting point is to take a look at ltnews.pdf(all newsletters) or the recent ones, e.g., ltnews30.pdf to ltnews34.pdf, all accessible via texdoc ltnews34, etc.

8
  • thx, frank, for all the work. yes, docs are hard. at some point, I hope someone will write a 10-page document that is a transition guide more than a reference guide. in the meantime, I (as an enduser) will start transitioning over to expl3. incidentally, it probably would be easy to provide a script that stabs at converting old style macro arguments to new style macro arguments.
    – ivo Welch
    Feb 11 at 17:24
  • 2
    These are some great pointers to the documentation! Essentially all of them are new to me — which makes me wonder: How discoverable are they? Is there some kind of index of all the various "core documenation" for LaTeX (enumerating things suchs as usrguide3, interface3, lthooks-doc, ...)?
    – Wisperwind
    Feb 14 at 9:38
  • @Wisperwind the question then is how discoverable is that overview? I think you can't win. But for what it is worth: all LaTeX releases have been accompanied by a newletter ltnewsXX for the last 30 years and we also announce new stuff on latex-project.org where you can subscribe to a newfeed. And the core docs are also listed on that web site for LaTeX. Hope that helps. Feb 14 at 10:32
  • 1
    @AndrewSwann it covers the parts that we think should be moved forward and have been placed into the format. xparse was "x" as in experimental and some ideas turned out to be not really useful or say, good enough to promote. xparse is a superset though, so if you want the others you can load xparse instead of just using the LaTeX format. Feb 16 at 17:50
  • 1
    @FrankMittelbach Thank you for the explanation. That makes sense. Feb 17 at 9:53

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.