1

Possible Duplicate:
Print large macro block from Lua to TeX

I need to escape a string in Lua code in LuaLaTeX. I'm trying to print a string but LaTeX seems to hiccup on some special characters. I know I can call \luatexluaescapestring from inside text but I need an equivalent function in Lua that will either remove the offending characters or escape them properly.

  • 4
    What are the special characters that give the problem? – egreg Mar 29 '12 at 17:55
  • 1
    I am really really very happy now and I have no intention for another comment flaming but I am really trying to understand why you are reluctant to post a simple code example. It has been the topic of your previous questions for no reason but why again I wonder. – percusse Mar 29 '12 at 17:56
  • I have the feeling that I've just answered this on your last question. I think this should be closed as a duplicate. – topskip Mar 29 '12 at 18:21
  • By "offending characters" you mean the literal ones? The Lua Reference Manual recommends to use literal strings ([[ one\ntwo ]]) in this case (the literal char \n is already escaped). I'm not sure Lua has a built-in function for this (they explicitly recommend literal strings for escaping literal chars), but maybe a solution is to write a local function which string.sub's all the 14 literal chars and return a "clean" string. :) – Paulo Cereda Mar 29 '12 at 18:21
  • 8
    Please no further down-voting, as it isn't productive. – Martin Scharrer Mar 29 '12 at 18:32

Browse other questions tagged or ask your own question.