Some TeX Developments

siunitx v3

I’ve just released version 3 of siunitx: its a major update, in which the internals have largely been re-written. The following is a short(ish) summary of the major benefits and changes.

The benefits

The major changes under the hood mean I can get better performance out of version 3 than there was in version 2. For most users, you’ll see something like a two-times speed-up of any use of siunitx. That shows up most if you have complex tables.

The new font control system means that I have to do a lot less to match the running font. So it is a lot easier to ‘do nothing’ than it was with version 2 (where basically you have to undo all of the font changes made by siunitx to get back to where you started!).

There’s new functionality across the board for number processing, and that means I can do more. Most obviously, there is now the ability to round numbers based on their uncertainties. I’ve also removed the oddities and limitations for interaction between parts of the code. Uncertainties can now be formatted using the NIST approach: a long-standing request.

For programmers, there is now a formal documented code-level API and a full set of tests (running using l3build), so it’s a lot easier to be sure what is supposed to happen. You can also re-use bits of siunitx to support other code much more easily than in the past.

Finally, I’ve now got more ability to add new features: I now know how I’m going to deal with multi-part uncertainties, for example. That includes having proper internal structures to make future development easier.

The changes

Now to the things to watch out for: taken from the new manual, and perhaps a bit more formal than the usual blog post!

A significant number of key-value settings have new, more descriptive, names. Where possible, older names are mapped to newer ones internally: you will be warned in the log if this is the case.

It is possible to use the LaTeX kernel mechanism to load the last version 2 release for documents that cannot be successfully processed using version 3. This can be achieved using

\usepackage{siunitx}[=2021-04-09]

or

\usepackage{siunitx}[=v2]

In version 3, the document commands have been revised to be more descriptive. As such, the commands \SI,\SIlist, \SIrange and \si remain available but are not recommended for use in new use.

Some changes have been made to the semantics of commands or options. Most notably

The font control system has been completely re-written for version 3. The method used is entirely different from version 2. Emulation is therefore not provided for some aspects: if you need non-standard font settings, you will need to adjust your source.

The input approach for version 3 is slightly more structured and restricted than for version 2. As well as the updated names for document commands, this means that

The letter used for a numerical tabular column can now be selected by the user: the letter S has been retained as the standard interface. The unit column (s) has been removed from this release. It can be emulated using the collcell package, for example

\usepackage{collcell}
\newcolumntype{s}{>{\collectcell\unit}c<{\endcollectcell}}

or

\usepackage{collcell}
\newcolumntype{s}{>{\collectcell\si}c<{\endcollectcell}}

A new approach has been taken to providing non-Latin symbols for use in units: these are now handled directly where needed, for example in the definition of the \micro prefix.

If you are using table-column-width to have fixed-width columns, you also now need table-fixed-width to set this option active.