* Stange behavior of \startluacode
@ 2010-10-02 23:46 Aditya Mahajan
2010-10-03 6:30 ` Wolfgang Schuster
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Aditya Mahajan @ 2010-10-02 23:46 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
___________________________________________________________________________________
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Stange behavior of \startluacode
2010-10-02 23:46 Stange behavior of \startluacode Aditya Mahajan
@ 2010-10-03 6:30 ` Wolfgang Schuster
2010-10-03 6:33 ` Wolfgang Schuster
` (2 subsequent siblings)
3 siblings, 0 replies; 11+ messages in thread
From: Wolfgang Schuster @ 2010-10-03 6:30 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
___________________________________________________________________________________
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Stange behavior of \startluacode
2010-10-02 23:46 Stange behavior of \startluacode Aditya Mahajan
2010-10-03 6:30 ` Wolfgang Schuster
@ 2010-10-03 6:33 ` Wolfgang Schuster
2010-10-04 7:17 ` Procházka Lukáš Ing. - Pontex s. r. o.
2010-10-04 7:19 ` Procházka Lukáš Ing. - Pontex s. r. o.
2010-10-03 8:28 ` luigi scarso
2010-10-03 10:32 ` Hans Hagen
3 siblings, 2 replies; 11+ messages in thread
From: Wolfgang Schuster @ 2010-10-03 6:33 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
___________________________________________________________________________________
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Stange behavior of \startluacode
2010-10-03 6:33 ` Wolfgang Schuster
@ 2010-10-04 7:17 ` Procházka Lukáš Ing. - Pontex s. r. o.
2010-10-04 7:19 ` Procházka Lukáš Ing. - Pontex s. r. o.
1 sibling, 0 replies; 11+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2010-10-04 7:17 UTC (permalink / raw)
To: mailing list for ConTeXt users
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 <schuster.wolfgang@googlemail.com> wrote:
>
> 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
___________________________________________________________________________________
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Stange behavior of \startluacode
2010-10-03 6:33 ` Wolfgang Schuster
2010-10-04 7:17 ` Procházka Lukáš Ing. - Pontex s. r. o.
@ 2010-10-04 7:19 ` Procházka Lukáš Ing. - Pontex s. r. o.
2010-10-04 8:00 ` Hans Hagen
1 sibling, 1 reply; 11+ messages in thread
From: Procházka Lukáš Ing. - Pontex s. r. o. @ 2010-10-04 7:19 UTC (permalink / raw)
To: mailing list for ConTeXt users
(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 <schuster.wolfgang@googlemail.com> wrote:
>
> 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
___________________________________________________________________________________
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Stange behavior of \startluacode
2010-10-04 7:19 ` Procházka Lukáš Ing. - Pontex s. r. o.
@ 2010-10-04 8:00 ` Hans Hagen
0 siblings, 0 replies; 11+ messages in thread
From: Hans Hagen @ 2010-10-04 8:00 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
-----------------------------------------------------------------
___________________________________________________________________________________
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Stange behavior of \startluacode
2010-10-02 23:46 Stange behavior of \startluacode Aditya Mahajan
2010-10-03 6:30 ` Wolfgang Schuster
2010-10-03 6:33 ` Wolfgang Schuster
@ 2010-10-03 8:28 ` luigi scarso
2010-10-03 9:02 ` Wolfgang Schuster
2010-10-03 10:32 ` Hans Hagen
3 siblings, 1 reply; 11+ messages in thread
From: luigi scarso @ 2010-10-03 8:28 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Sun, Oct 3, 2010 at 1:46 AM, Aditya Mahajan <adityam@umich.edu> 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?
Limitation, but it should be doable to remedy in TeX.
--
luigi
___________________________________________________________________________________
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Stange behavior of \startluacode
2010-10-03 8:28 ` luigi scarso
@ 2010-10-03 9:02 ` Wolfgang Schuster
2010-10-03 9:12 ` Wolfgang Schuster
0 siblings, 1 reply; 11+ messages in thread
From: Wolfgang Schuster @ 2010-10-03 9:02 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
___________________________________________________________________________________
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Stange behavior of \startluacode
2010-10-03 9:02 ` Wolfgang Schuster
@ 2010-10-03 9:12 ` Wolfgang Schuster
0 siblings, 0 replies; 11+ messages in thread
From: Wolfgang Schuster @ 2010-10-03 9:12 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
___________________________________________________________________________________
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Stange behavior of \startluacode
2010-10-02 23:46 Stange behavior of \startluacode Aditya Mahajan
` (2 preceding siblings ...)
2010-10-03 8:28 ` luigi scarso
@ 2010-10-03 10:32 ` Hans Hagen
2010-10-05 23:36 ` Aditya Mahajan
3 siblings, 1 reply; 11+ messages in thread
From: Hans Hagen @ 2010-10-03 10:32 UTC (permalink / raw)
To: mailing list for ConTeXt users
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
-----------------------------------------------------------------
___________________________________________________________________________________
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: Stange behavior of \startluacode
2010-10-03 10:32 ` Hans Hagen
@ 2010-10-05 23:36 ` Aditya Mahajan
0 siblings, 0 replies; 11+ messages in thread
From: Aditya Mahajan @ 2010-10-05 23:36 UTC (permalink / raw)
To: Hans Hagen; +Cc: mailing list for ConTeXt users
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
___________________________________________________________________________________
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://tex.aanhet.net
archive : http://foundry.supelec.fr/projects/contextrev/
wiki : http://contextgarden.net
___________________________________________________________________________________
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2010-10-05 23:36 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-02 23:46 Stange behavior of \startluacode Aditya Mahajan
2010-10-03 6:30 ` Wolfgang Schuster
2010-10-03 6:33 ` Wolfgang Schuster
2010-10-04 7:17 ` Procházka Lukáš Ing. - Pontex s. r. o.
2010-10-04 7:19 ` Procházka Lukáš Ing. - Pontex s. r. o.
2010-10-04 8:00 ` Hans Hagen
2010-10-03 8:28 ` luigi scarso
2010-10-03 9:02 ` Wolfgang Schuster
2010-10-03 9:12 ` Wolfgang Schuster
2010-10-03 10:32 ` Hans Hagen
2010-10-05 23:36 ` Aditya Mahajan
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).