ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Lua code and percent sign
@ 2017-02-27 13:11 Antoine Cailliau
  2017-02-27 14:25 ` Hans Hagen
  0 siblings, 1 reply; 3+ messages in thread
From: Antoine Cailliau @ 2017-02-27 13:11 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 4796 bytes --]

The following code, from the wiki, results in a compilation error:

\starttext
> \ctxlua{context(string.format("\%.2f", math.pi))}
> \stoptext


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

[-- Attachment #1.2: Type: text/html, Size: 5763 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Lua code and percent sign
  2017-02-27 13:11 Lua code and percent sign Antoine Cailliau
@ 2017-02-27 14:25 ` Hans Hagen
  2017-02-27 15:23   ` Antoine Cailliau
  0 siblings, 1 reply; 3+ messages in thread
From: Hans Hagen @ 2017-02-27 14:25 UTC (permalink / raw)
  To: ntg-context

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
-----------------------------------------------------------------
___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Lua code and percent sign
  2017-02-27 14:25 ` Hans Hagen
@ 2017-02-27 15:23   ` Antoine Cailliau
  0 siblings, 0 replies; 3+ messages in thread
From: Antoine Cailliau @ 2017-02-27 15:23 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 10 bytes --]

Thank you

[-- Attachment #1.2: Type: text/html, Size: 42 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-02-27 15:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-27 13:11 Lua code and percent sign Antoine Cailliau
2017-02-27 14:25 ` Hans Hagen
2017-02-27 15:23   ` Antoine Cailliau

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).