ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>,
	James Withers <james.o.withers@gmail.com>
Subject: Re: Using variables and macros for styling of section title and line in table of contents
Date: Wed, 22 Jul 2020 21:38:29 +0200	[thread overview]
Message-ID: <b1859c17-1bb8-76e5-9b7d-746b1307d8cc@gmail.com> (raw)
In-Reply-To: <CAE8093Unegt8E9bBEGz98-YrXjHyoFGEXoA2O36_uaxe37Q7JQ@mail.gmail.com>

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
___________________________________________________________________________________
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:[~2020-07-22 19:38 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-22 19:20 James Withers
2020-07-22 19:38 ` Wolfgang Schuster [this message]
2020-07-22 19:45   ` James Withers

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=b1859c17-1bb8-76e5-9b7d-746b1307d8cc@gmail.com \
    --to=wolfgang.schuster.lists@gmail.com \
    --cc=james.o.withers@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).