ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Otared Kavian <otared@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Registers and getparameters
Date: Mon, 22 Jan 2018 21:39:12 +0100	[thread overview]
Message-ID: <CE049D29-4E89-4431-AA91-7C40A29F721A@gmail.com> (raw)
In-Reply-To: <5A663ACE.8050301@gmail.com>


[-- Attachment #1.1: Type: text/plain, Size: 4582 bytes --]

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 <schuster.wolfgang@gmail.com <mailto:schuster.wolfgang@gmail.com>> wrote:
> 
> 
>> Otared Kavian <mailto:otared@gmail.com> 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 <mailto:ntg-context@ntg.nl> / http://www.ntg.nl/mailman/listinfo/ntg-context <http://www.ntg.nl/mailman/listinfo/ntg-context>
> webpage  : http://www.pragma-ade.nl <http://www.pragma-ade.nl/> / http://context.aanhet.net <http://context.aanhet.net/>
> archive  : https://bitbucket.org/phg/context-mirror/commits/ <https://bitbucket.org/phg/context-mirror/commits/>
> wiki     : http://contextgarden.net <http://contextgarden.net/>
> ___________________________________________________________________________________


[-- Attachment #1.2: Type: text/html, Size: 9957 bytes --]

[-- Attachment #2: Type: text/plain, Size: 492 bytes --]

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

  reply	other threads:[~2018-01-22 20:39 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-22 18:53 Otared Kavian
2018-01-22 19:26 ` Wolfgang Schuster
2018-01-22 20:39   ` Otared Kavian [this message]
2018-01-22 21:38     ` Wolfgang Schuster
2018-01-23  4:12       ` Otared Kavian
2018-01-23  9:19   ` Hans Hagen
2018-01-23 16:54     ` Otared Kavian

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CE049D29-4E89-4431-AA91-7C40A29F721A@gmail.com \
    --to=otared@gmail.com \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).