Dear list, I have the following sample: \startluacode function document.gouppercase(str) tex.print(str:upper()) end \stopluacode \unexpanded\def\MyUpper#1% {\ctxlua{document.gouppercase("#1")}} \starttext \doif{\MyUpper{adfalkjfaeñf}}{\MyUpper{aDFAlkjfaeñf}}{equal}{unequal} \ctxlua{if string.upper("adfalkjfaeñf") == string.upper("aDFAlkjfaeñf") then tex.print("equal") else tex.print("unequal") end} \stoptext Why are are the first two strings unequal? Many thanks for your help, Pablo -- http://www.ousia.tk
Pablo Rodriguez mailto:oinos@gmx.es 17. September 2015 18:47 Dear list,
I have the following sample:
\startluacode function document.gouppercase(str) tex.print(str:upper()) end \stopluacode
\unexpanded\def\MyUpper#1% {\ctxlua{document.gouppercase("#1")}}
\starttext \doif{\MyUpper{adfalkjfaeñf}}{\MyUpper{aDFAlkjfaeñf}}{equal}{unequal}
\ctxlua{if string.upper("adfalkjfaeñf") == string.upper("aDFAlkjfaeñf") then tex.print("equal") else tex.print("unequal") end} \stoptext
Why are are the first two strings unequal? You can’t use a unexpandable (which you created with \unexpanded) in ConTeXts \doifXXX commands.
PS. You need \doifelse and not \doif. Wolfgang
On 09/17/2015 07:26 PM, Wolfgang Schuster wrote:
Pablo Rodriguez 17. September 2015 18:47 [...] \unexpanded\def\MyUpper#1% {\ctxlua{document.gouppercase("#1")}}
\starttext \doif{\MyUpper{adfalkjfaeñf}}{\MyUpper{aDFAlkjfaeñf}}{equal}{unequal}
Why are are the first two strings unequal?
You can’t use a unexpandable (which you created with \unexpanded) in ConTeXts \doifXXX commands.
Many thanks for your reply, Wolfgang. I see. I thought it was better to add \unexpanded before a pure \def. Is it \unexpaded required before a \def with more than one argument? (Sorry, but expansion is a concept which I’m not familiar with.)
PS. You need \doifelse and not \doif.
I realized this too sending the message to the list. Pablo -- http://www.ousia.tk
participants (2)
-
Pablo Rodriguez
-
Wolfgang Schuster