8

I am adapting the LaTeX3 answer in this question: https://tex.stackexchange.com/a/61603

But I can't get the original MWE answer to compile using xelatex. I have renamed the variables, but the error is the same whether I use it verbatim (not counting the \str_case:nnn fix) or slightly adapted. So I am wondering if root syntax requirements have changed in the last couple of years since this question was answered?

\documentclass{article}
\usepackage{xparse}

\ExplSyntaxOn

\NewDocumentCommand{\BuildTablePortion}{ O{Default} m }{%
    \my_BuildTablePortion:nn { #1 } { #2 }%
}

\cs_new:Npn \my_BuildTablePortion:nn #1 #2
{
    \str_case:nnn { #2 }{%
    {START} { Start data here}%
    {END} { End Data here}%
    % other possible strings
   }%
   {%
    I~don't~know~what~to~do~with~`#1'%
   }%
 }%

\ExplSyntaxOff

\begin{document}
\BuildTablePortion{START}

\BuildTablePortion{END}

\end{document}
EngBIRD
  • 3,985
  • There's no str_case:nnn and the solution of egreg has \prog_case:nnn –  Oct 05 '15 at 17:05
  • 1
    \str_case:nnn has been renamed. If the third argument was code to be inserted when no match is found then the new name is \str_case:nnF – cgnieder Oct 05 '15 at 17:06
  • @clemens: You were quicker, please write the answer –  Oct 05 '15 at 17:07
  • Thanks for noting: I fixed that old answer of mine. I think I searched for occurrences of \str_case:nnn, but that one escaped. You should have left a comment there, rather than asking a question. – egreg Oct 05 '15 at 17:11
  • @egreg: I find this question useful anyway –  Oct 05 '15 at 17:42

1 Answers1

5

\str_case:nnn has been renamed to \str_case:nnF. Actually all \<module>_case:nnn functions have been renamed to \<module>_case:nnF (also see Function renaming: \<thing>_case:nnn to \<thing>_case:nnF).

cgnieder
  • 66,645