Re: [NTG-context] Registers and getparameters

2018-01-23 Thread Otared Kavian
On 23 Jan 2018, at 10:19, Hans Hagen  wrote:
> 
> On 1/22/2018 8:26 PM, Wolfgang Schuster wrote:
>>> […]
>> You have to add \expanded, i.e. \expanded{\speakers{...}}.
> 
> or maybe try the 'expanded' option
> 
> \setupregister
>  [speakers]
>  [style=sansbold,
>   n=2,
>   expansion=yes]

Hi Hans,

Thanks for your input (which I added to the wiki), but even though it works 
fine as expected in the example code sent by Wolfgang, it does not work 
properly on the longer document I have, for some reason unknown to me…

Best regards: OK
___
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
___

Re: [NTG-context] Registers and getparameters

2018-01-23 Thread Hans Hagen

On 1/22/2018 8:26 PM, Wolfgang Schuster wrote:



Otared Kavian 
22. Januar 2018 um 19:53
Hi all,

I have a list of speakers (and abstracts of their talk) in a rather 
long document, and the name of each speaker is written to a register 
named speakers.
Then with the command \getparameters[Talk] I get the name of each 
speaker and try to write it to the register with


\speakers{\TalkSpeakerName}


You have to add \expanded, i.e. \expanded{\speakers{...}}.


or maybe try the 'expanded' option

\setupregister
  [speakers]
  [style=sansbold,
   n=2,
   expansion=yes]


Indeed this does not work to obtain the result I am looking for: the 
sorting is indeed under the letter « t », and most importantly the 
register gets only the last name in the list instead of getting each 
speaker name.


The following is a (not so minimal…) example. Can anyone help me in 
this matter?


When you replace \getparameters with \setvariables you can set a command
which is applied each time when you set new values.


\defineregister[speakers]

\setupregister
   [speakers]
   [style=sansbold,
    n=2]

\startbuffer[pagetalk]
   \doflushatpar
     {\expanded{\speakers{\getvariable{talk}{speakername}}}%
  \expanded{\pagereference[talk:\getvariable{talk}{speakername}]}}%
   \starttabulate[|f{\bi}l|p|]
   \NC Speaker \EQ \getvariable{talk}{speakername} \NC\NR
   \NC Title   \EQ \getvariable{talk}{title}   \NC\NR
   \NC Time    \EQ \getvariable{talk}{time}    \NC\NR
   \NC Room    \EQ \getvariable{talk}{room}    \NC\NR
   \HL
   \stoptabulate
\stopbuffer

\setvariable{talk}{set}{\getbuffer[pagetalk]}

\showframe[text][text]

\starttext

\setvariables
   [talk]
   [speakername={Gauss},
    title={Remarks on Number Theory},
    time={10:30},
    room={A}]

The talk about Gauss was on \at{page}[talk:Gauss].

\completeregister[speakers]

\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://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
___

Re: [NTG-context] Registers and getparameters

2018-01-22 Thread Otared Kavian
Hi Wolfgang,

Thanks a lot! Indeed with removing the \doflushatpar and putting the page 
reference out of the tabulate solves all the problems.

Have a nice day: Otared K.

> On 22 Jan 2018, at 22:38, Wolfgang Schuster  
> wrote:
> 
> 
>> Otared Kavian  22. Januar 2018 um 21:39
>> Hi Wolfgang,
>> 
>> Thank you very much for your reply and your wise advice to use the 
>> \setvariable mechanism. It is indeed much more convenient to use for what I 
>> intend to do.
>> 
>> The only remaining problem is that when several talks are included in my 
>> file (in the following example there three of them), then the entries to the 
>> register are correct but the associated pagenumbers are incorrect and are 
>> given the last pagenumber: in the following example all three talks are 
>> given the pagenumber 4 in the register. Is there something I am doing wrong?
> I moved the link for the page number to the next paragraph because putting 
> the reference command into the tabulate environment hasn’t worked but in your 
> example the first paragraph starts on the last page. This was necessary 
> because the \pagereference starts a new paragraph which results in an empty 
> line before the table. A way to fix the page number is to omit the 
> \doflushatpar command, the table itself can be moved upwards by a line with a 
> negative vertical skip (\vskip-).
> 
> \startbuffer[pagetalk]
>  %\blank
>   \expanded{\pagereference[talk:\getvariable{talk}{speakername}]}%
>   \expanded{\speakers{\getvariable{talk}{speakername}}}%
>   \vskip-\lineheight
>   \starttabulate[|f{\bi}l|p|][before=]%
>   \NC Speaker \EQ \getvariable{talk}{speakername} \NC\NR
>   \NC Title   \EQ \getvariable{talk}{title}   \NC\NR
>   \NC Time\EQ \getvariable{talk}{time}\NC\NR
>   \NC Room\EQ \getvariable{talk}{room}\NC\NR
>   \HL
>   \stoptabulate
> \stopbuffer
> 
> 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://context.aanhet.net
> archive  : https://bitbucket.org/phg/context-mirror/commits/
> wiki : http://contextgarden.net
> ___

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

Re: [NTG-context] Registers and getparameters

2018-01-22 Thread Wolfgang Schuster



Otared Kavian 
22. Januar 2018 um 21:39
Hi Wolfgang,

Thank you very much for your reply and your wise advice to use the 
\setvariable mechanism. It is indeed much more convenient to use for 
what I intend to do.


The only remaining problem is that when several talks are included in 
my file (in the following example there three of them), then the 
entries to the register are correct but the associated pagenumbers are 
incorrect and are given the last pagenumber: in the following example 
all three talks are given the pagenumber 4 in the register. Is there 
something I am doing wrong?
I moved the link for the page number to the next paragraph because 
putting the reference command into the tabulate environment hasn’t 
worked but in your example the first paragraph starts on the last page. 
This was necessary because the \pagereference starts a new paragraph 
which results in an empty line before the table. A way to fix the page 
number is to omit the \doflushatpar command, the table itself can be 
moved upwards by a line with a negative vertical skip (\vskip-).


\startbuffer[pagetalk]
 %\blank
  \expanded{\pagereference[talk:\getvariable{talk}{speakername}]}%
  \expanded{\speakers{\getvariable{talk}{speakername}}}%
  \vskip-\lineheight
  \starttabulate[|f{\bi}l|p|][before=]%
  \NC Speaker \EQ \getvariable{talk}{speakername} \NC\NR
  \NC Title   \EQ \getvariable{talk}{title}   \NC\NR
  \NC Time\EQ \getvariable{talk}{time}\NC\NR
  \NC Room\EQ \getvariable{talk}{room}\NC\NR
  \HL
  \stoptabulate
\stopbuffer

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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___

Re: [NTG-context] Registers and getparameters

2018-01-22 Thread Otared Kavian
Hi Wolfgang,

Thank you very much for your reply and your wise advice to use the \setvariable 
mechanism. It is indeed much more convenient to use for what I intend to do.

The only remaining problem is that when several talks are included in my file 
(in the following example there three of them), then the entries to the 
register are correct but the associated pagenumbers are incorrect and are given 
the last pagenumber: in the following example all three talks are given the 
pagenumber 4 in the register. Is there something I am doing wrong?

Thanks agin for your time and attention: Otared K.
%%% begin register-talks.tex
\setupinteraction[state=start]
\defineregister[speakers]

\setupregister
  [speakers]
  [style=sansbold,
   n=2]

\startbuffer[pagetalk]
  \doflushatpar 
{\expanded{\speakers{\getvariable{talk}{speakername}}}%
 \expanded{\pagereference[talk:\getvariable{talk}{speakername}]}}%
  \starttabulate[|f{\bi}l|p|]
  \NC Speaker \EQ \getvariable{talk}{speakername} \NC\NR
  \NC Title   \EQ \getvariable{talk}{title}   \NC\NR
  \NC Time\EQ \getvariable{talk}{time}\NC\NR
  \NC Room\EQ \getvariable{talk}{room}\NC\NR
  \HL
  \stoptabulate
\stopbuffer

\setvariable{talk}{set}{\getbuffer[pagetalk]}

\showframe[text][text]

\starttext

\setvariables[talk]
[speakername={Gauss},
title={Remarks on Number Theory},
time={10:30},
room={A}]


\page

\setvariables[talk]
[speakername={Poincaré},
title={Remarks on Relativity},
time={16:30},
room={B}]

\page

\setvariables[talk]%
[speakername={Dirac},
title={Quaternions and the wave equation},
time={15:30},
room={B}]

\page

The talk about Gauss is on \at{page}[talk:Gauss].

\completeregister[speakers]

\stoptext
%%% end register-talks.tex

> On 22 Jan 2018, at 20:26, Wolfgang Schuster  > wrote:
> 
> 
>> Otared Kavian  22. Januar 2018 um 19:53
>> Hi all,
>> 
>> I have a list of speakers (and abstracts of their talk) in a rather long 
>> document, and the name of each speaker is written to a register named 
>> speakers. 
>> Then with the command \getparameters[Talk] I get the name of each speaker 
>> and try to write it to the register with
>> 
>> \speakers{\TalkSpeakerName}
> 
> You have to add \expanded, i.e. \expanded{\speakers{...}}.
> 
>> Indeed this does not work to obtain the result I am looking for: the sorting 
>> is indeed under the letter « t », and most importantly the register gets 
>> only the last name in the list instead of getting each speaker name.
>> 
>> The following is a (not so minimal…) example. Can anyone help me in this 
>> matter?
> 
> When you replace \getparameters with \setvariables you can set a command
> which is applied each time when you set new values.
> 
> 
> \defineregister[speakers]
> 
> \setupregister
>   [speakers]
>   [style=sansbold,
>n=2]
> 
> \startbuffer[pagetalk]
>   \doflushatpar 
> {\expanded{\speakers{\getvariable{talk}{speakername}}}%
>  \expanded{\pagereference[talk:\getvariable{talk}{speakername}]}}%
>   \starttabulate[|f{\bi}l|p|]
>   \NC Speaker \EQ \getvariable{talk}{speakername} \NC\NR
>   \NC Title   \EQ \getvariable{talk}{title}   \NC\NR
>   \NC Time\EQ \getvariable{talk}{time}\NC\NR
>   \NC Room\EQ \getvariable{talk}{room}\NC\NR
>   \HL
>   \stoptabulate
> \stopbuffer
> 
> \setvariable{talk}{set}{\getbuffer[pagetalk]}
> 
> \showframe[text][text]
> 
> \starttext
> 
> \setvariables
>   [talk]
>   [speakername={Gauss},
>title={Remarks on Number Theory},
>time={10:30},
>room={A}]
> 
> The talk about Gauss was on \at{page}[talk:Gauss].
> 
> \completeregister[speakers]
> 
> \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://context.aanhet.net 
> archive  : https://bitbucket.org/phg/context-mirror/commits/ 
> 
> wiki : http://contextgarden.net 
> ___

___
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
__

Re: [NTG-context] Registers and getparameters

2018-01-22 Thread Wolfgang Schuster



Otared Kavian 
22. Januar 2018 um 19:53
Hi all,

I have a list of speakers (and abstracts of their talk) in a rather 
long document, and the name of each speaker is written to a register 
named speakers.
Then with the command \getparameters[Talk] I get the name of each 
speaker and try to write it to the register with


\speakers{\TalkSpeakerName}


You have to add \expanded, i.e. \expanded{\speakers{...}}.

Indeed this does not work to obtain the result I am looking for: the 
sorting is indeed under the letter « t », and most importantly the 
register gets only the last name in the list instead of getting each 
speaker name.


The following is a (not so minimal…) example. Can anyone help me in 
this matter?


When you replace \getparameters with \setvariables you can set a command
which is applied each time when you set new values.


\defineregister[speakers]

\setupregister
  [speakers]
  [style=sansbold,
   n=2]

\startbuffer[pagetalk]
  \doflushatpar
{\expanded{\speakers{\getvariable{talk}{speakername}}}%
 \expanded{\pagereference[talk:\getvariable{talk}{speakername}]}}%
  \starttabulate[|f{\bi}l|p|]
  \NC Speaker \EQ \getvariable{talk}{speakername} \NC\NR
  \NC Title   \EQ \getvariable{talk}{title}   \NC\NR
  \NC Time\EQ \getvariable{talk}{time}\NC\NR
  \NC Room\EQ \getvariable{talk}{room}\NC\NR
  \HL
  \stoptabulate
\stopbuffer

\setvariable{talk}{set}{\getbuffer[pagetalk]}

\showframe[text][text]

\starttext

\setvariables
  [talk]
  [speakername={Gauss},
   title={Remarks on Number Theory},
   time={10:30},
   room={A}]

The talk about Gauss was on \at{page}[talk:Gauss].

\completeregister[speakers]

\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://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki : http://contextgarden.net
___