ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Assigning a variable to the list argument in \setupsection
@ 2016-04-14  9:12 Michael Guravage
  0 siblings, 0 replies; 4+ messages in thread
From: Michael Guravage @ 2016-04-14  9:12 UTC (permalink / raw)
  To: ntg-context


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

Greetings,

I would like to use a variable for the value of the list argument in, e.g.,
the \startsection command. If you compile my little example you will see
that the first 'literal' assignment works, while the second 'variable'
assignment does not. What am I missing here?

Cheers,

Michael


\starttext

  \placecontent

  \setvariables[TOC][list=Second Section]

  \startsection [title={First}, list={First Section}]
    This is the first section.
  \stopsection

  \startsection [title={Second}, list={\getvariable{TOC}{list}}]
    This is the \getvariable{TOC}{list}
  \stopsection

\stoptext

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

[-- Attachment #2: Type: text/plain, Size: 485 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Assigning a variable to the list argument in \setupsection
  2016-04-14  7:46 Michael Guravage
  2016-04-14  9:45 ` Marco Patzer
@ 2016-04-14 17:15 ` Wolfgang Schuster
  1 sibling, 0 replies; 4+ messages in thread
From: Wolfgang Schuster @ 2016-04-14 17:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users


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

> Michael Guravage <mailto:guravage@gmail.com>
> 14. April 2016 um 09:46
> Greetings,
>
> I would like to use a variable for the value of the list argument in, 
> e.g., the \startsection command. If you compile my little example you 
> will see that the first 'literal' assignment works, while the second 
> 'variable' assignment does not. What am I missing here?
>
ConTeXt saves by default the list entries without expanding them
which means you get "\getvariable{TOC}{list}" as entry in the table
of contents for your section section entry but at this moment you
haven’t set a value for this variable.

To get the content of the variable in the list entry you have to expand
the argument of the list key, one way is the use of the \expanded
command as shown by Marco but you also let ConTeXt do this for
you (no need for \expanded{…}) when you add

     \setuphead[section][expansion=yes]

at the begin of your document.

Wolfgang

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

[-- Attachment #2: Type: text/plain, Size: 485 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Assigning a variable to the list argument in \setupsection
  2016-04-14  7:46 Michael Guravage
@ 2016-04-14  9:45 ` Marco Patzer
  2016-04-14 17:15 ` Wolfgang Schuster
  1 sibling, 0 replies; 4+ messages in thread
From: Marco Patzer @ 2016-04-14  9:45 UTC (permalink / raw)
  To: ntg-context

On Thu, 14 Apr 2016 09:46:34 +0200
Michael Guravage <guravage@gmail.com> wrote:

> I would like to use a variable for the value of the list argument in,
> e.g., the \startsection command. If you compile my little example you
> will see that the first 'literal' assignment works, while the second
> 'variable' assignment does not. What am I missing here?
> 
> Cheers,
> 
> Michael
> 
> 
> \starttext
> 
>   \placecontent
> 
>   \setvariables[TOC][list=Second Section]
> 
>   \startsection [title={First}, list={First Section}]
>     This is the first section.
>   \stopsection
> 
>   \startsection [title={Second}, list={\getvariable{TOC}{list}}]

I suspect issues with the order of expansion because it works with

  \expanded{\startsection [title={Second}, list={\getvariable{TOC}{list}}]}

Marco
___________________________________________________________________________________
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] 4+ messages in thread

* Assigning a variable to the list argument in \setupsection
@ 2016-04-14  7:46 Michael Guravage
  2016-04-14  9:45 ` Marco Patzer
  2016-04-14 17:15 ` Wolfgang Schuster
  0 siblings, 2 replies; 4+ messages in thread
From: Michael Guravage @ 2016-04-14  7:46 UTC (permalink / raw)
  To: ntg-context


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

Greetings,

I would like to use a variable for the value of the list argument in, e.g.,
the \startsection command. If you compile my little example you will see
that the first 'literal' assignment works, while the second 'variable'
assignment does not. What am I missing here?

Cheers,

Michael


\starttext

  \placecontent

  \setvariables[TOC][list=Second Section]

  \startsection [title={First}, list={First Section}]
    This is the first section.
  \stopsection

  \startsection [title={Second}, list={\getvariable{TOC}{list}}]
    This is the \getvariable{TOC}{list}
  \stopsection

\stoptext

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

[-- Attachment #2: Type: text/plain, Size: 485 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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-14 17:15 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-04-14  9:12 Assigning a variable to the list argument in \setupsection Michael Guravage
  -- strict thread matches above, loose matches on Subject: below --
2016-04-14  7:46 Michael Guravage
2016-04-14  9:45 ` Marco Patzer
2016-04-14 17:15 ` Wolfgang Schuster

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).