* problem with \getparameters
@ 2012-02-23 8:05 Thomas A. Schmitz
2012-02-23 11:27 ` Wolfgang Schuster
0 siblings, 1 reply; 10+ messages in thread
From: Thomas A. Schmitz @ 2012-02-23 8:05 UTC (permalink / raw)
To: mailing list for ConTeXt users
Hi all,
I'm trying to use \getparameters, but I'm doing it wrong. What I want to
do is: define an environment which starts linenumbering and takes a
key=value argument to define the start of the numbers. Here's what I
tried (I also tried a few other things, such as \setvariables, but
wasn't any more successful):
\definestartstop[mynumberedblockquote]
[before={\blank[line]
\setupindenting[no]
\setuplinenumbering[width=1cm,start=\getvalue{testsetupsstart}]
\startlinenumbering},
after={\stoplinenumbering
\setupindenting[yes]
{\blank[line]}
\par}]
\def\startnumberedblockquote#1[#2]%
{\getparameters[testsetups][start=1,#2]%
\startmynumberedblockquote}
\define\stopnumberedblockquote%
{\stopmynumberedblockquote}
\starttext
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
\startnumberedblockquote [start=9]
Lorem
ipsum
dolor
sit
amet
\stopnumberedblockquote
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy
eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam
voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd
gubergren,
\startnumberedblockquote[start=19]
consetetur
sadipscing
elitr
sed
diam
\stopnumberedblockquote
\stoptext
But for some reason, the numbers are not local for each block. Can
anybody shed some light into these (for me) dark an mysterious corners
of ConTeXt?
Thanks a lot!
Thomas
___________________________________________________________________________________
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] 10+ messages in thread
* Re: problem with \getparameters
2012-02-23 8:05 problem with \getparameters Thomas A. Schmitz
@ 2012-02-23 11:27 ` Wolfgang Schuster
2012-02-23 11:42 ` Thomas A. Schmitz
0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Schuster @ 2012-02-23 11:27 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 23.02.2012 um 09:05 schrieb Thomas A. Schmitz:
> Hi all,
>
> I'm trying to use \getparameters, but I'm doing it wrong. What I want to do is: define an environment which starts linenumbering and takes a key=value argument to define the start of the numbers. Here's what I tried (I also tried a few other things, such as \setvariables, but wasn't any more successful):
>
> \definestartstop[mynumberedblockquote]
> [before={\blank[line]
> \setupindenting[no]
> \setuplinenumbering[width=1cm,start=\getvalue{testsetupsstart}]
> \startlinenumbering},
> after={\stoplinenumbering
> \setupindenting[yes]
> {\blank[line]}
> \par}]
>
> \def\startnumberedblockquote#1[#2]%
> {\getparameters[testsetups][start=1,#2]%
> \startmynumberedblockquote}
>
> \define\stopnumberedblockquote%
> {\stopmynumberedblockquote}
\usemodule[annotation]
\define[2]\NumberedblockquoteCommand
{\setupindenting[no]
\startlinenumbering[width=1cm][\annotationparameter{start}]%
#2%
\stoplinenumbering}
\defineannotation
[numberedblockquote]
[alternative=command,
%indenting=no,
command=\NumberedblockquoteCommand]
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] 10+ messages in thread
* Re: problem with \getparameters
2012-02-23 11:27 ` Wolfgang Schuster
@ 2012-02-23 11:42 ` Thomas A. Schmitz
2012-02-23 12:29 ` Wolfgang Schuster
2012-02-23 12:31 ` luigi scarso
0 siblings, 2 replies; 10+ messages in thread
From: Thomas A. Schmitz @ 2012-02-23 11:42 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 02/23/2012 12:27 PM, Wolfgang Schuster wrote:
> \usemodule[annotation]
>
> \define[2]\NumberedblockquoteCommand
> {\setupindenting[no]
> \startlinenumbering[width=1cm][\annotationparameter{start}]%
> #2%
> \stoplinenumbering}
>
> \defineannotation
> [numberedblockquote]
> [alternative=command,
> %indenting=no,
> command=\NumberedblockquoteCommand]
Wolfgang,
thanks a lot for your solution. It works beautifully with the minimal
example, but I can't use it in my project: it only works with a recent
beta, but since footnotes are so badly broken, I need to use an older
beta for typesetting this book project. Any chance of having a more
generic solution without the annotation module?
Thomas
___________________________________________________________________________________
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] 10+ messages in thread
* Re: problem with \getparameters
2012-02-23 11:42 ` Thomas A. Schmitz
@ 2012-02-23 12:29 ` Wolfgang Schuster
2012-02-23 15:19 ` Thomas A. Schmitz
2012-02-23 12:31 ` luigi scarso
1 sibling, 1 reply; 10+ messages in thread
From: Wolfgang Schuster @ 2012-02-23 12:29 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 23.02.2012 um 12:42 schrieb Thomas A. Schmitz:
> On 02/23/2012 12:27 PM, Wolfgang Schuster wrote:
>> \usemodule[annotation]
>>
>> \define[2]\NumberedblockquoteCommand
>> {\setupindenting[no]
>> \startlinenumbering[width=1cm][\annotationparameter{start}]%
>> #2%
>> \stoplinenumbering}
>>
>> \defineannotation
>> [numberedblockquote]
>> [alternative=command,
>> %indenting=no,
>> command=\NumberedblockquoteCommand]
>
> Wolfgang,
>
> thanks a lot for your solution. It works beautifully with the minimal example, but I can't use it in my project: it only works with a recent beta, but since footnotes are so badly broken, I need to use an older beta for typesetting this book project. Any chance of having a more generic solution without the annotation module?
\def\startnumberedblockquote
{\dosingleempty\dostartnumberedblockquote}
\def\dostartnumberedblockquote[#1]%
{\getrawparameters[numberedblockquote][start=1,#1]%
\blank[line]%
\begingroup
\setupindenting[no]%
\startlinenumbering[width=1cm][\numberedblockquotestart]}
\def\stopnumberedblockquote
{\stoplinenumbering
\endgroup
\blank[line]}
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] 10+ messages in thread
* Re: problem with \getparameters
2012-02-23 11:42 ` Thomas A. Schmitz
2012-02-23 12:29 ` Wolfgang Schuster
@ 2012-02-23 12:31 ` luigi scarso
2012-02-23 12:39 ` Wolfgang Schuster
1 sibling, 1 reply; 10+ messages in thread
From: luigi scarso @ 2012-02-23 12:31 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Thu, Feb 23, 2012 at 12:42 PM, Thomas A. Schmitz
<thomas.schmitz@uni-bonn.de> wrote:
> On 02/23/2012 12:27 PM, Wolfgang Schuster wrote:
>>
>> \usemodule[annotation]
>>
>> \define[2]\NumberedblockquoteCommand
>> {\setupindenting[no]
>> \startlinenumbering[width=1cm][\annotationparameter{start}]%
>> #2%
>> \stoplinenumbering}
>>
>> \defineannotation
>> [numberedblockquote]
>> [alternative=command,
>> %indenting=no,
>> command=\NumberedblockquoteCommand]
>
>
> Wolfgang,
>
> thanks a lot for your solution. It works beautifully with the minimal
> example, but I can't use it in my project: it only works with a recent beta,
> but since footnotes are so badly broken, I need to use an older beta for
> typesetting this book project. Any chance of having a more generic solution
> without the annotation module?
>
> Thomas
>
> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________
Hm global effect.. you can use a namespaced one
\enabletrackers[lines.numbers]
\starttext
Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd
gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
\vrule width\textwidth height 1pt\par
\setuplinenumbering[Mine1][width=1cm,start=1]
\startlinenumbering[Mine1]
consetetur
sadipscing
elitr
sed
diam
\stoplinenumbering
\vrule width\textwidth height 1pt\par
\setuplinenumbering[Mine2][width=1cm,start=19]
\startlinenumbering[Mine2]
consetetur
sadipscing
elitr
sed
diam
\stoplinenumbering
\stoptext
--
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] 10+ messages in thread
* Re: problem with \getparameters
2012-02-23 12:31 ` luigi scarso
@ 2012-02-23 12:39 ` Wolfgang Schuster
2012-02-23 12:51 ` luigi scarso
0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Schuster @ 2012-02-23 12:39 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 23.02.2012 um 13:31 schrieb luigi scarso:
> Hm global effect.. you can use a namespaced one
>
> \enabletrackers[lines.numbers]
> \starttext
> Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
> tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
> vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd
> gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
> \vrule width\textwidth height 1pt\par
> \setuplinenumbering[Mine1][width=1cm,start=1]
Better use first \define… and not \setup… which can result in an error for commands which
use the commandhandler (e.g. \definelayout[<name>][…] vs. \setuplayout[<name>][…]).
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] 10+ messages in thread
* Re: problem with \getparameters
2012-02-23 12:39 ` Wolfgang Schuster
@ 2012-02-23 12:51 ` luigi scarso
2012-02-23 13:00 ` Wolfgang Schuster
0 siblings, 1 reply; 10+ messages in thread
From: luigi scarso @ 2012-02-23 12:51 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Thu, Feb 23, 2012 at 1:39 PM, Wolfgang Schuster
<schuster.wolfgang@googlemail.com> wrote:
>
> Am 23.02.2012 um 13:31 schrieb luigi scarso:
>
>> Hm global effect.. you can use a namespaced one
>>
>> \enabletrackers[lines.numbers]
>> \starttext
>> Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
>> tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
>> vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd
>> gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
>> \vrule width\textwidth height 1pt\par
>> \setuplinenumbering[Mine1][width=1cm,start=1]
>
> Better use first \define… and not \setup… which can result in an error for commands which
> use the commandhandler (e.g. \definelayout[<name>][…] vs. \setuplayout[<name>][…]).
yes, infact It was only to show the interference... I'm not sure if
it's a bug or not.
Anyway for this case \setup.. seems to inglobe \define...
\unexpanded\def\definelinenumbering
{\dosingleempty\dodefinelinenumbering}
\def\dodefinelinenumbering[#1]%
{\edef\currentlinenumbering{#1}%
\mkdefinetextlinenumbering}
\unexpanded\def\setuplinenumbering
{\dodoubleempty\dosetuplinenumbering}
\def\dosetuplinenumbering[#1][#2]%
{\ifsecondargument
\def\currentlinenumbering{#1}%
\getparameters[\??rn#1][#2]%
\else
\let\currentlinenumbering\empty
\getparameters[\??rn][#1]%
\fi
\mksetuptextlinenumbering}
>
> 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
> ___________________________________________________________________________________
--
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] 10+ messages in thread
* Re: problem with \getparameters
2012-02-23 12:51 ` luigi scarso
@ 2012-02-23 13:00 ` Wolfgang Schuster
2012-02-23 13:08 ` luigi scarso
0 siblings, 1 reply; 10+ messages in thread
From: Wolfgang Schuster @ 2012-02-23 13:00 UTC (permalink / raw)
To: mailing list for ConTeXt users
Am 23.02.2012 um 13:51 schrieb luigi scarso:
> On Thu, Feb 23, 2012 at 1:39 PM, Wolfgang Schuster
> <schuster.wolfgang@googlemail.com> wrote:
>>
>> Am 23.02.2012 um 13:31 schrieb luigi scarso:
>>
>>> Hm global effect.. you can use a namespaced one
>>>
>>> \enabletrackers[lines.numbers]
>>> \starttext
>>> Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod
>>> tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At
>>> vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd
>>> gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.
>>> \vrule width\textwidth height 1pt\par
>>> \setuplinenumbering[Mine1][width=1cm,start=1]
>>
>> Better use first \define… and not \setup… which can result in an error for commands which
>> use the commandhandler (e.g. \definelayout[<name>][…] vs. \setuplayout[<name>][…]).
> yes, infact It was only to show the interference... I'm not sure if
> it's a bug or not.
>
> Anyway for this case \setup.. seems to inglobe \define...
>
> \unexpanded\def\definelinenumbering
> {\dosingleempty\dodefinelinenumbering}
>
> \def\dodefinelinenumbering[#1]%
> {\edef\currentlinenumbering{#1}%
> \mkdefinetextlinenumbering}
>
> \unexpanded\def\setuplinenumbering
> {\dodoubleempty\dosetuplinenumbering}
>
> \def\dosetuplinenumbering[#1][#2]%
> {\ifsecondargument
> \def\currentlinenumbering{#1}%
> \getparameters[\??rn#1][#2]%
> \else
> \let\currentlinenumbering\empty
> \getparameters[\??rn][#1]%
> \fi
> \mksetuptextlinenumbering}
\definelinenumbering doesn’t use the commandhandler (see mult-aux.mkiv) but this can change.
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] 10+ messages in thread
* Re: problem with \getparameters
2012-02-23 13:00 ` Wolfgang Schuster
@ 2012-02-23 13:08 ` luigi scarso
0 siblings, 0 replies; 10+ messages in thread
From: luigi scarso @ 2012-02-23 13:08 UTC (permalink / raw)
To: mailing list for ConTeXt users
On Thu, Feb 23, 2012 at 2:00 PM, Wolfgang Schuster
<schuster.wolfgang@googlemail.com> wrote:
> \definelinenumbering doesn’t use the commandhandler (see mult-aux.mkiv) but this can change.
Ah, right.
--
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] 10+ messages in thread
* Re: problem with \getparameters
2012-02-23 12:29 ` Wolfgang Schuster
@ 2012-02-23 15:19 ` Thomas A. Schmitz
0 siblings, 0 replies; 10+ messages in thread
From: Thomas A. Schmitz @ 2012-02-23 15:19 UTC (permalink / raw)
To: mailing list for ConTeXt users
On 02/23/2012 01:29 PM, Wolfgang Schuster wrote:
> \def\startnumberedblockquote
> {\dosingleempty\dostartnumberedblockquote}
>
> \def\dostartnumberedblockquote[#1]%
> {\getrawparameters[numberedblockquote][start=1,#1]%
> \blank[line]%
> \begingroup
> \setupindenting[no]%
> \startlinenumbering[width=1cm][\numberedblockquotestart]}
>
> \def\stopnumberedblockquote
> {\stoplinenumbering
> \endgroup
> \blank[line]}
>
> Wolfgang
Many thanks, Wolfgang, that does exactly what I need!
Thomas
___________________________________________________________________________________
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] 10+ messages in thread
end of thread, other threads:[~2012-02-23 15:19 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-02-23 8:05 problem with \getparameters Thomas A. Schmitz
2012-02-23 11:27 ` Wolfgang Schuster
2012-02-23 11:42 ` Thomas A. Schmitz
2012-02-23 12:29 ` Wolfgang Schuster
2012-02-23 15:19 ` Thomas A. Schmitz
2012-02-23 12:31 ` luigi scarso
2012-02-23 12:39 ` Wolfgang Schuster
2012-02-23 12:51 ` luigi scarso
2012-02-23 13:00 ` Wolfgang Schuster
2012-02-23 13:08 ` luigi scarso
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).