I’m working on another project which provides a LATEX-like typesetting system (but not using TEX for its engine) and I was thinking about how the loading of extensions (its equivalent of LATEX packages) would work.

In particular, I wanted to be able to allow users to do things like 

\LoadExtension{ams:amssymb}[\eqcirc -> \eq,\circeq ->\eqcirc]

to enable commands defined in an extension to be renamed at load time.¹ Of course, it would be nice to be able to also do things like give a list of only the commands that should be imported from an extension, or to give a list of commands that should be excluded from the extension.

As I thought about this, I realized that the xparse syntax for argument specifications provides a simple and convenient way to have multiple context-dependent optional arguments. I could define \LoadExtension with an argument template like:

o m o s o s o

The arguments would then be:

  1. options to the package (akin to options on \usepackage in LATEX)
  2. package name
  3. command remappings when all commands are imported
  4. * (value ignored)
  5. list of commands that should be imported. Only the named commands would be imported.
  6. * (value ignored)
  7. all commands will be imported except those listed

Then a user could write something like:


to import only the \eqcirc command from the extension.


or even


would import two commands, \circeq as \ceq and \eqcirc  Although the user would probably prefer




would import all the commands except \eqcirc and rename \circeq to \ceq  I’m not sure that this is necessarily better than having something like:

\LoadExtension{ams:amssymb}[rename -> {…}, exclude -> {…}]

as the syntax but it’s interesting to note that xparse allows such things to happen.

  1. This particular example doesn’t actually apply for finl. All the AMS symbol fonts will be part of the kernel character set.