josephwright / etoolbox

Tool-box for LaTeX programmers using e-TeX
LaTeX Project Public License v1.3c
41 stars 7 forks source link

\multicolumn fails with "! Misplaced \omit" in a macro test branch #36

Closed jotbeel closed 3 years ago

jotbeel commented 3 years ago

Here is the MWE:

\documentclass{minimal} \usepackage{etoolbox} \def\bar{bar} \begin{document} \begin{tabular}{l} \ifcsstring{\bar}{bar}
{\multicolumn{1}{l}{bar}\\} {not bar\\} \end{tabular} \end{document}

josephwright commented 3 years ago

TeX only allows the underlying \omit at the start of a cell, and there can be no non-expandable content before that. The way \ifcsstring works is non-expandable, so this simply cannot work.

jotbeel commented 3 years ago

Silly/naive me... Perhaps those non-expandable could be marked as such in the manual? With \ifcsdef{\bar} the MWE works, thus it's expandable :-)

Thank you, Joseph. Closing.