I've created a custom environment for displaying code examples in a beamer presentation (for an introductory LaTeX couse no less), but compiling my "old" code suddenly results in an error. According to the old log file the version is xparse 2011/10/09 v2900. The definition is (slightly cleaned for brevity):

        {\begin{exampleblock}{Code: #1}}}

and the error is

! LaTeX error: "xparse/expandable-ending-optional"
! Argument specification for expandable command ends with optional argument.
! See the LaTeX3 documentation for further information.
! For immediate help type H <return>.

when compiled using xparse 2012/08/29 v4160 on my up-to-date TeX Live 2012 installation. First step in debugging this problem is to create a MWE, but this results in a quite separate error. The code


    \IfNoValueTF{#1}{\textbf{Test}}{\textbf{Test: #1}}\par}



does not yield the expected result (i.e. two pieces of centered text with a bold first line) but this:

Unexpected result

I've read the documentation for my currently installed version of xparse, but this makes no mention of any limitation regarding terminating optional arguments. Is this a regression or expected but yet undocumented behaviour?

  • This is already fixed in the SVN and should be on CTAN in a few days.
    – cgnieder
    Commented Sep 3, 2012 at 17:13
  • Thanks. I'll wait a few days, try again and hope that the fixed version will allow terminating optional arguments. Commented Sep 3, 2012 at 17:39


Browse other questions tagged .