Promoting xparse

I’ve had a few chances in recent weeks to promote the xparse package. Regular readers will know that xparse is part of the efforts of the LaTeX3 Project, and is meant to provide a replacement for \newcommand, etc., for creating document macros. The promotions have come up where there are things that are hard to do with \newcommand but easy with xparse. One example was creating an optional argument for a macro but giving it in normal braces. With xparse, this is pretty straight forward

\( \en \) and \( \en{stuff} \).

This is clear, and does not need any knowledge of the internals of the LaTeX3 approach. So I’m going to keep promoting xparse for day to day LaTeX users, even if they aren’t using much code. Hopefully this will make life easier for them, and for me, and will be a real benefit now from the LaTeX3 work.

5 thoughts on “Promoting xparse

  1. xparse can be used for very interesting things. I have one question though:

    Why does it allocate two writes, when in most cases those writes are not used? At least my own hacks to release them does not seem to cause problems in my use of xparse.

    This becomes a problem in large projects where one is running out of writes.

    Why was the number of writes/reads not increased by etex with the rest of things?

  2. I can’t speak for e-TeX, although I’d guess that this is because file operations have a “cost” at the OS level.

    On xparse, I don’t follow. There should not be any reads or writes involved in xparse: can you provide an example (including listfiles)?

    One thing I would add is that the I/O unit for expl3 provides a much more flexible approach to opening reads and writes than the one used by LaTeX2e. It implements a pool, so as long as programmers are sensible (closing I/O once they’ve finished with it) then we should have much less risk of running out. See what I’ve done in notes2bib, for example, where I don’t need to know anything about the shipout so can have a one-shot I/O at the end of the document.

  3. just did a test, it seems that it has changed since the last time I worked with it. Then it was quite clear in the log that xparse (or one of the packages it loads) would alocate two writes.

    It does not seem to do that anymore

  4. Sounds like xparse before the re-write (when there was still a lot of other “stuff” that had been thought about).

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.