problem with \getparameters
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
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
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
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
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
On Thu, Feb 23, 2012 at 12:42 PM, 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?
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
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
On Thu, Feb 23, 2012 at 1:39 PM, Wolfgang Schuster
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
Am 23.02.2012 um 13:51 schrieb luigi scarso:
On Thu, Feb 23, 2012 at 1:39 PM, Wolfgang Schuster
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
participants (3)
-
luigi scarso
-
Thomas A. Schmitz
-
Wolfgang Schuster