![](https://secure.gravatar.com/avatar/49e63acb01f2ca80efce7eed08310ce8.jpg?s=120&d=mm&r=g)
On 2/27/2017 2:11 PM, Antoine Cailliau wrote:
The following code, from the wiki, results in a compilation error:
\starttext \ctxlua{context(string.format("\%.2f", math.pi))} \stoptext
\startluacode ... \stopluacode but not in macros where the % is normally a comment again
The error is:
[\directlua]:1: invalid escape sequence near '\%' 1 \starttext 2 3 >> \ctxlua{context(string.format("\%.2f", math.pi))} 4 5 \stoptext
I ended using \letterpercent command but it is not very convenient.
Any help is welcome,
Antoine C.
Full log:
mtx-context | warning: synctex is enabled mtx-context | run 1: luatex --fmt="/usr/local/texlive/2015/texmf-var/luatex-cache/context/a86c089b384a3076dc514ba966a1fac9/formats/luatex/cont-en" --jobname="luapercent" --lua="/usr/local/texlive/2015/texmf-var/luatex-cache/context/a86c089b384a3076dc514ba966a1fac9/formats/luatex/cont-en.lui" --no-parse-first-line --synctex=1 --c:autogenerate --c:currentrun=1 --c:directives="system.synctex=1" --c:fulljobname="/Users/acailliau/Desktop/luapercent.tex" --c:input="/Users/acailliau/Desktop/luapercent.tex" --c:kindofrun=1 --c:maxnofruns=9 --c:synctex="1" "cont-yes.mkiv" This is LuaTeX, Version beta-0.80.0 (TeX Live 2015) (rev 5238) \write18 enabled. system > synctex functionality is enabled (1)! open source > 1 > 1 > /usr/local/texlive/2015/texmf-dist/tex/context/base/cont-yes.mkiv ConTeXt ver: 2015.05.18 12:26 MKIV current fmt: 2016.4.25 int: english/english system > 'cont-new.mkiv' loaded open source > 2 > 2 > /usr/local/texlive/2015/texmf-dist/tex/context/base/cont-new.mkiv close source > 2 > 2 > /usr/local/texlive/2015/texmf-dist/tex/context/base/cont-new.mkiv system > files > jobname 'luapercent', input '/Users/acailliau/Desktop/luapercent', result 'luapercent' fonts > latin modern fonts are not preloaded languages > language 'en' is active open source > 2 > 3 > /Users/acailliau/Desktop/luapercent.tex fonts > preloading latin modern fonts (second stage) fonts > 'fallback modern-designsize rm 12pt' is loaded lua error > error on line 3 in file /Users/acailliau/Desktop/luapercent.tex: [\directlua]:1: invalid escape sequence near '\%' 1 \starttext 2 3 >> \ctxlua{context(string.format("\%.2f", math.pi))} 4 5 \stoptext
? Type to proceed, S to scroll future error messages, R to run without stopping, Q to run quietly, I to insert something, 1 or ... or 9 to ignore the next 1 to 9 tokens of input, H for help, X to quit. ? close source > 2 > 3 > /Users/acailliau/Desktop/luapercent.tex close source > 1 > 3 > /usr/local/texlive/2015/texmf-dist/tex/context/base/cont-yes.mkiv mkiv lua stats > used config file: selfautoparent:/texmfcnf.lua;selfautoparent:/texmf-dist/web2c/texmfcnf.lua mkiv lua stats > used cache path: /usr/local/texlive/2015/texmf-var/luatex-cache/context/a86c089b384a3076dc514ba966a1fac9 mkiv lua stats > synctex tracing: synctex has been enabled (extra log file generated) mkiv lua stats > resource resolver: loadtime 0.117 seconds, 0 scans with scantime 0.000 seconds, 0 shared scans, 8 found files, scanned paths: mkiv lua stats > stored bytecode data: 371 modules (0.309 sec), 78 tables (0.008 sec), 449 chunks (0.316 sec) mkiv lua stats > traced context: maxstack: 1132, freed: 0, unreachable: 1132 mkiv lua stats > running in nuts mode: yes mkiv lua stats > cleaned up reserved nodes: 41 nodes, 439 lists of 438 mkiv lua stats > node memory usage: 2 glue, 2 penalty, 6 attribute, 26 glue_spec, 2 attribute_list, 2 temp mkiv lua stats > node list callback tasks: 6 unique task lists, 2 instances (re)created, 3 calls mkiv lua stats > used backend: pdf (backend for directly generating pdf output) mkiv lua stats > loaded patterns: en::2, load time: 0.000 mkiv lua stats > jobdata time: 0.001 seconds saving, 0.000 seconds loading mkiv lua stats > callbacks: 60 direct, 243 indirect, 303 total mkiv lua stats > result saved in file: luapercent.pdf, compresslevel 3, objectcompresslevel 3 mkiv lua stats > loaded fonts: 2 files: latinmodern-math.otf, lmroman12-regular.otf mkiv lua stats > fonts load time: 0.180 seconds mkiv lua stats > used platform: osx-64, type: unix, binary subtree: bin mkiv lua stats > luatex banner: this is luatex, version beta-0.80.0 (tex live 2015) (rev 5238) mkiv lua stats > control sequences: 43101 of 65536 + 100000 mkiv lua stats > lua properties: engine: lua, used memory: 67 MB (ctx: 66 MB), hash type: lua, hash chars: min(64,40), symbol mask: utf (τεχ) mkiv lua stats > runtime: 0.540 seconds mtx-context | fatal error: return code: 1
___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki!
maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://context.aanhet.net archive : https://bitbucket.org/phg/context-mirror/commits/ wiki : http://contextgarden.net ___________________________________________________________________________________
-- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl -----------------------------------------------------------------