[luatex] Expansion of TeX macros

Paul Isambert zappathustra at free.fr
Thu May 31 07:29:54 CEST 2012


Herbert Voss <Herbert.Voss at fu-berlin.de> a écrit:
> 
> Am 30.05.2012 17:55, schrieb Dirk Laurie:
> > 2012/5/30 Christophe Jorssen<jorssen.leraincy at free.fr>:
> >> Could you provide the lua and the tex code you wrote please?
> >
> > `lualatex sample` works, but not if the comment symbol is removed.
> 
> use it this way:
> 
>   \[ \mat{\string\\mathbf{x},0,0;0,1,2} \]
> 
> you have to escape the backslash

That or you can redefine \mat as:

\newcommand\mat[1]{%
  \directlua{tex.print(tomatrix("\luatexluaescapestring{\detokenize{#1}}"))}%
  }

Also, the following lines in the Lua code:

  str = str:gsub("%;",[[\\]])
  str= str:gsub("%,",[[&]])

have unnecessary "%" (meant to escape magic characters; the comma and
semi-colon aren't magic). They can be rewritten as:

  str = str:gsub ("[,;]", {[","] = "&",
                           [";"] = [[\\]]} )

Best,
Paul



More information about the luatex mailing list