11

Some recent change of the xparse package or of the LaTeX3 fundament seems to yield some changed behaviour regarding parameter processing. In some situations, at least one character is gobbled where it should not.

The following MWE shows a rather harmless situation, but my real problem is that an enironment based on xparse with verbatim text removes the first character of this text, see https://github.com/T-F-S/tcolorbox/issues/43

The MWE constructs an environment myenv with one optional argument. If this argument is not used, the whitespace is gobbled. Used in a more complicated scenario, as mentioned above, crucial stuff can be gobbled.

There is a second environment myENV without arguments to show the expected behaviour.

\documentclass{article}
\usepackage{xparse}

\NewDocumentEnvironment{myenv}{ O{} }{Alpha}{Omega}

\NewDocumentEnvironment{myENV}{}{Alpha}{Omega}

\begin{document}

\begin{myenv}[parameter]
Test
\end{myenv}

\begin{myenv}[]
Test
\end{myenv}

\begin{myenv}
Test
\end{myenv}

\begin{myENV}
Test
\end{myENV}

\end{document}

If this code is compiled against an installation of xparse (2018/02/21), the output is as expected:

enter image description here

But, if this code is compiled against an installation of xparse (2018/04/30) or xparse (2018/05/12), the output is:

enter image description here

I consider this to be a bug. But, if this is a feature, how can I get rid of it? Is there a way to have the old behaviour back with clean or dirty tricks which could help to solve my real problem (see above)?

closed as off-topic by schtandard, Raaja, Phelype Oleinik, Sebastiano, Mensch Jul 24 at 16:26

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    Maybe texdev.net/2018/04/21/xparse-optional-arguments-at-the-end explains the change you are seeing – moewe Jun 4 '18 at 14:50
  • 2
    Yes, but I'm not completly sure that it is a feature, the blog describes spaces before the argument. @JosephWright is needed. – Ulrike Fischer Jun 4 '18 at 15:04
  • 2
    Yes, I also think it is wise to wait, whether the implementation is really as intended before changing many documents... – Thomas F. Sturm Jun 4 '18 at 15:12
  • 5
    We may need to think about environments as needing separate treatment from commands ... – Joseph Wright Jun 4 '18 at 15:17
  • 4
    I'm voting to close this question as off-topic because it was based on a bug that has been fixed. – schtandard Jul 24 at 15:08

Browse other questions tagged or ask your own question.