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}
  • There's no str_case:nnn and the solution of egreg has \prog_case:nnn – user31729 Oct 5 '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 – clemens Oct 5 '15 at 17:06
  • @clemens: You were quicker, please write the answer – user31729 Oct 5 '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 5 '15 at 17:11
  • @egreg: I find this question useful anyway – user31729 Oct 5 '15 at 17:42
4

\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).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.