[NTG-context] Using variables and macros for styling of section title and line in table of contents

Wolfgang Schuster wolfgang.schuster.lists at gmail.com
Wed Jul 22 21:38:29 CEST 2020


James Withers schrieb am 22.07.2020 um 21:20:
> Dear list
> 
> I have a document with section headings which include a title, date and 
> reference spread over two lines with different font style and 
> justification, plus a slightly different text for the table of contents.
> 
> So that I can alter the styling of the section headings without having 
> to recode each \startsection command, I have used variables and a macro 
> command for the style.
> 
> This works for section 'title' and 'marking', but not for the 'list' 
> attribute.

The title argument works only because it is placed in the text but it 
won't work when you try to show the argument in the ToC like the list 
argument.

> The minimal working example below shows what I'm trying to do.
> 
> Best wishes and many thanks in advance.
> 
> James
> 
> \define\mytitle{\getvariable{myvar}{title}\crlf{\tfx\getvariable{myvar}{date}\hfill\getvariable{myvar}{ref}}}
> \define\mylist{\getvariable{myvar}{list}---{\bf \getvariable{myvar}{date}}}

In this case you have to use \defineexpandable to create your commands 
and enable expansion for sections.

\defineexpandable\mytitle{...}
\defineexpandable\mylist {...}

\setuphead[section][expansion=yes]

Wolfgang


More information about the ntg-context mailing list