5

The following minimal example doesn't compile when the optional argument to \macro is used:

\documentclass{article}

\usepackage{xparse,amsmath}

\NewDocumentCommand{\macro}{o}{A\IfValueT{#1}{(#1)}}%

\begin{document}

\begin{align}
  abc \macro \\
  def \macro[A]% Error
\end{align}

\end{document}

I'm using the following file list:

 *File List*
 article.cls    2014/09/29 v1.4h Standard LaTeX document class
  size10.clo    2014/09/29 v1.4h Standard LaTeX file (size option)
  xparse.sty    2016/03/26 v6466 L3 Experimental document command parser
   expl3.sty    2016/03/26 v6466 L3 programming layer (loader) 
expl3-code.tex    2016/03/26 v6466 L3 programming layer 
l3pdfmode.def    2016/03/26 v6465 L3 Experimental driver: PDF mode
 amsmath.sty    2016/03/03 v2.15a AMS math features
 amstext.sty    2000/06/29 v2.01 AMS text
  amsgen.sty    1999/11/30 v2.0 generic functions
  amsbsy.sty    1999/11/29 v1.2d Bold Symbols
  amsopn.sty    1999/12/14 v2.01 operator names
 ***********

I'm not sure whether the problem may lie, as both xparse and amsmath was recently updated.

2
  • 1
    Joseph has screwed up the L3 distribution.
    – egreg
    Mar 31, 2016 at 7:08
  • More precisely, a change in the internals of expl3 has made xparse buggy in that respect; today's update of l3packages makes it completely unusable. :(
    – egreg
    Mar 31, 2016 at 7:12

1 Answer 1

8

The most recent update to l3kernel made the code for optional arguments in a command defined by \NewDocumentCommand not working in all circumstances (this happens especially with align).

The update to l3packages (among which there is xparse) issued on 2016/03/28 fixes the problem.

Unfortunately, it also makes xparse unusable, because it requires a non existent version of l3kernel (it wants 2016/03/28, but 2016/03/26 is available as a release date for l3kernel).

I fixed by hand the date and your example works. I'm pretty sure this is just a temporary problem and that the goof will be fixed as soon as possible.

Update, April 1, 2016

After today's update with tlmgr, the issue has been solved for TeX Live and your example compiles without errors.

I believe that also an updated MiKTeX will work.

> tlmgr info l3kernel l3packages
package:     l3kernel
category:    Package
shortdesc:   LaTeX3 programming conventions
longdesc:    [...]
installed:   Yes
revision:    40184
sizes:       src: 2329k, doc: 7473k, run: 877k
relocatable: No
cat-version: SVN 6468
cat-date:    2016-03-30 18:26:01 +0200
cat-license: lppl1.3
cat-topics:  format latex3 pre-release
cat-related: l3packages l3experimental
collection:  collection-latexrecommended

package:     l3packages
category:    Package
shortdesc:   High-level LaTeX3 concepts
longdesc:    [...]
installed:   Yes
revision:    40176
sizes:       src: 301k, doc: 1673k, run: 141k
relocatable: No
cat-version: SVN 6468
cat-date:    2016-03-29 00:16:53 +0200
cat-license: lppl1.3
cat-topics:  macro-supp latex3 pre-release
cat-related: l3kernel l3experimental
collection:  collection-latexrecommended

You must log in to answer this question.

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