Hi, The following snippet \startluacode -- \undefined why should a comment matter a = 10 \stopluacode fails with system > error on line 4 in file bug.tex: Undefined control sequence ... -- \undefined why should a comment matt a = 10 \dodostartluacode ...and \directlua \zerocount {#1 }} l.4 \stopluacode Bug or limitation? Aditya
Am 03.10.2010 um 01:46 schrieb Aditya Mahajan:
Hi,
The following snippet
\startluacode -- \undefined why should a comment matter a = 10 \stopluacode
fails with
system > error on line 4 in file bug.tex: Undefined control sequence ... -- \undefined why should a comment matt a = 10 \dodostartluacode ...and \directlua \zerocount {#1 }} l.4 \stopluacode
Bug or limitation?
The comment character in the luacode environment is “%”. Wolfgang
Am 03.10.2010 um 01:46 schrieb Aditya Mahajan:
Hi,
The following snippet
\startluacode -- \undefined why should a comment matter a = 10 \stopluacode
fails with
system > error on line 4 in file bug.tex: Undefined control sequence ... -- \undefined why should a comment matt a = 10 \dodostartluacode ...and \directlua \zerocount {#1 }} l.4 \stopluacode
Bug or limitation?
The comment character in the luacode environment is “%”. Wolfgang
Hello,
my observation:
---
\starttext
AAA
\startluacode
a = 10
context(a)
-- a = 20
context(a)
\stopluacode
\stoptext
---
- works OK, 'AAA', '10' and '20' is printed.
If I modify the code:
---
\starttext
AAA
\startluacode
a = 10
context(a)
-- a = 20
context(a)
% a = 30
context(a)
\stopluacode
\stoptext
---
- I get an error:
! LuaTeX error <main ctx instance>:11: unexpected symbol near '%'.
So it seems to me that '--' works fine to start a comment but '%' doesn't (?).
Lukas
NB: ConTeXt ver: 2010.09.29 23:37 MKIV fmt: 2010.9.30 int: english/english
On Sun, 03 Oct 2010 08:33:23 +0200, Wolfgang Schuster
Am 03.10.2010 um 01:46 schrieb Aditya Mahajan:
Hi,
The following snippet
\startluacode -- \undefined why should a comment matter a = 10 \stopluacode
fails with
system > error on line 4 in file bug.tex: Undefined control sequence ... -- \undefined why should a comment matt a = 10 \dodostartluacode ...and \directlua \zerocount {#1 }} l.4 \stopluacode
Bug or limitation?
The comment character in the luacode environment is “%”.
Wolfgang
(Sorry, I've written bad information, now correcting (*)...)
Hello,
my observation:
---
\starttext
AAA
\startluacode
a = 10
context(a)
-- a = 20
context(a)
\stopluacode
\stoptext
---
- works OK, 'AAA', '10' and '10' (*) is printed.
If I modify the code:
---
\starttext
AAA
\startluacode
a = 10
context(a)
-- a = 20
context(a)
% a = 30
context(a)
\stopluacode
\stoptext
---
- I get an error:
! LuaTeX error <main ctx instance>:11: unexpected symbol near '%'.
So it seems to me that '--' works fine to start a comment but '%' doesn't (?).
Lukas
NB: ConTeXt ver: 2010.09.29 23:37 MKIV fmt: 2010.9.30 int: english/english
On Sun, 03 Oct 2010 08:33:23 +0200, Wolfgang Schuster
Am 03.10.2010 um 01:46 schrieb Aditya Mahajan:
Hi,
The following snippet
\startluacode -- \undefined why should a comment matter a = 10 \stopluacode
fails with
system > error on line 4 in file bug.tex: Undefined control sequence ... -- \undefined why should a comment matt a = 10 \dodostartluacode ...and \directlua \zerocount {#1 }} l.4 \stopluacode
Bug or limitation?
The comment character in the luacode environment is “%”.
Wolfgang
On 4-10-2010 9:19, Procházka Lukáš Ing. - Pontex s. r. o. wrote:
(Sorry, I've written bad information, now correcting (*)...)
Hello,
my observation:
--- \starttext AAA
\startluacode
a = 10
context(a)
-- a = 20
context(a)
\stopluacode \stoptext ---
- works OK, 'AAA', '10' and '10' (*) is printed.
If I modify the code:
--- \starttext AAA
\startluacode
a = 10
context(a)
-- a = 20
context(a)
% a = 30
context(a)
\stopluacode \stoptext ---
- I get an error:
! LuaTeX error <main ctx instance>:11: unexpected symbol near '%'.
So it seems to me that '--' works fine to start a comment but '%' doesn't (?).
indeed. but string.format("%0.3f %0.3f",a,b) does as does context("%0.3f %0.3f",a,b) so the % is just a normal token Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Sun, Oct 3, 2010 at 1:46 AM, Aditya Mahajan
Hi,
The following snippet
\startluacode -- \undefined why should a comment matter a = 10 \stopluacode
fails with
system > error on line 4 in file bug.tex: Undefined control sequence ... -- \undefined why should a comment matt a = 10 \dodostartluacode ...and \directlua \zerocount {#1 }} l.4 \stopluacode
Bug or limitation? Limitation, but it should be doable to remedy in TeX.
-- luigi
Am 03.10.2010 um 10:28 schrieb luigi scarso:
Bug or limitation? Limitation, but it should be doable to remedy in TeX.
Possible but is it worth the effort, when you start with “--” the percent should also behave like in Lua etc. \starttext \bgroup\obeylines \gdef\texcomment#1 {} \egroup \bgroup \let\letterhyphen=- \catcode`-=13 \unexpanded\def-{\futurelet\next\doscanhyphen} \def\doscanhyphen {\ifx\next- \expandafter\texcomment \else \expandafter\letterhyphen \fi} \obeylines text text % foo - foo 1 -- foo 2 \normalexpanded{- foo 1} \normalexpanded{-- foo 2} text \egroup \stoptext Wolfgang
Am 03.10.2010 um 11:02 schrieb Wolfgang Schuster:
Am 03.10.2010 um 10:28 schrieb luigi scarso:
Limitation, but it should be doable to remedy in TeX.
Possible but is it worth the effort, when you start with “--” the percent should also behave like in Lua etc.
The problem is that there is no solution to write something expandable (because \startluacode expands the content) which is required here.
\starttext
\bgroup\obeylines \gdef\texcomment#1 {} \egroup
\bgroup \let\letterhyphen=- \catcode`-=13 \unexpanded\def-{\futurelet\next\doscanhyphen} \def\doscanhyphen {\ifx\next- \expandafter\texcomment \else \expandafter\letterhyphen \fi} \obeylines text text % foo - foo 1
-- \undefined \normalexpanded{- foo 1} \normalexpanded{-- foo 2} \normalexpanded{-- \undefined}
text \egroup
\stoptext
Wolfgang
On 3-10-2010 1:46, Aditya Mahajan wrote:
Hi,
The following snippet
\startluacode -- \undefined why should a comment matter a = 10 \stopluacode
fails with
system > error on line 4 in file bug.tex: Undefined control sequence ... -- \undefined why should a comment matt a = 10 \dodostartluacode ...and \directlua \zerocount {#1 }} l.4 \stopluacode
Bug or limitation?
feature ... the content gets expanded texnically I could catch comments but it's not worth the effort (and slowdown) Hans ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------
On Sun, 3 Oct 2010, Hans Hagen wrote:
On 3-10-2010 1:46, Aditya Mahajan wrote:
Hi,
The following snippet
\startluacode -- \undefined why should a comment matter a = 10 \stopluacode
fails with
system > error on line 4 in file bug.tex: Undefined control sequence ... -- \undefined why should a comment matt a = 10 \dodostartluacode ...and \directlua \zerocount {#1 }} l.4 \stopluacode
Bug or limitation?
feature ... the content gets expanded
texnically I could catch comments but it's not worth the effort (and slowdown)
OK. I documented this on the wiki. Aditya
participants (5)
-
Aditya Mahajan
-
Hans Hagen
-
luigi scarso
-
Procházka Lukáš Ing. - Pontex s. r. o.
-
Wolfgang Schuster