2

Why and is there a solution?

\documentclass{article}
\usepackage[utf8]{inputenc}
\inputencoding{latin1}
\usepackage{xparse}
\usepackage{etoolbox}

\ExplSyntaxOn

\tl_const:Nx \lang_and
{
  croatian=i,
  czech=a,
  hungarian=\'es,
%  romanian=\c{s}i, % ERROR: Illegal parameter number in definition of \erw_foo.
  slovak=a,
  slovenian=in
}

\ExplSyntaxOff

\begin{document}

\ifcsdef{c}{
  romanian=\c{s}i,
  }{}

\end{document}

enter image description here

  • Apparently \c{s} does not survive the \edef of \tl_const:Nx, with \tl_const:Nn there is no error. – moewe May 29 at 4:11
  • Because \c is not expandable (neither is \': try \show \lang_and to see), and it explodes with x expansion. Either use \tl_const:Nn or use \exp_not:n { romanian=\c{s}i } to avoid the expansion of \c. Besides the name of \lang_and is wrong: something like \c_erwann_lang_tl would be better. – Phelype Oleinik May 29 at 4:11
  • Are you defining a token list constant or rather a clist? And what's the reason for x? – egreg May 29 at 8:37
3

Because \c is not expandable (neither is \': try \show \lang_and to see), and it explodes with x expansion. Either use \tl_const:Nn or use \exp_not:n { romanian=\c{s}i } to avoid the expansion of \c – Phelype Oleinik

| improve this answer | |
3

I can see no reason for

  1. \inputencoding{latin1} after loading utf8;
  2. a token list constant;
  3. x expansion.

Most likely you want

\prop_gset_from_keyval:Nn \g_erwann_lang_and_prop
 {
  croatian=i,
  czech=a,
  hungarian=\'es,
  romanian=\textcommabelow{s}i,
  slovak=a,
  slovenian=in
 }
| improve this answer | |
  • Thanks. Yeah, I didn't put to much thought into 1. The reasons for 2. and 3. wouldn't add value to the discussion. – Erwann May 29 at 10:06

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.