TransWikia.com

Problem when using the specifier `b` of `xparse` with tabulars

TeX - LaTeX Asked by F. Pantigny on March 8, 2021

Edit: Phelype Oleinik has opened an issue in the bug tracker of LaTeX3 for that issue: https://github.com/latex3/latex3/issues/839


The following code provides an error.

documentclass{article}
usepackage{array}
NewDocumentEnvironment{MyEnv}{b}
  {$begin{array}{cc}#1end{array}$}
  {}

begin{document}

begin{MyEnv}x&yend{MyEnv} 

begin{tabular}{cc}
smth & begin{MyEnv}x&yend{MyEnv}
end{tabular}
end{document}

Is it a bug of the specifier b of xparse?

One Answer

As Phelype commented we looked at this and might add the special table group required to hide nested & but meanwhile you can add them using the new environment hook feature.

documentclass{article}
usepackage{array}
NewDocumentEnvironment{MyEnv}{b}
  {$begin{array}{cc}#1end{array}$}
  {}

BeforeBeginEnvironment{MyEnv}{{ifnum0=`}fi}
AfterEndEnvironment{MyEnv}{ifnum0=`{fi}}

begin{document}

begin{MyEnv}x&yend{MyEnv} 

begin{tabular}{cc}
smth & begin{MyEnv}x&yend{MyEnv}
end{tabular}
end{document}

Correct answer by David Carlisle on March 8, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP