ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Bruce Horrocks <ntg@scorecrow.com>
To: Gerion Entrup <gerion.entrup@flump.de>
Cc: ntg-context mailing list <ntg-context@ntg.nl>
Subject: [NTG-context] Re: setuphead in connection with the command argument
Date: Thu, 30 May 2024 23:40:23 +0100	[thread overview]
Message-ID: <24290BB7-EDC1-404F-984D-DAD2983108FA@scorecrow.com> (raw)
In-Reply-To: <5362221.0VBMTVartN@falbala>



> On 30 May 2024, at 23:25, Gerion Entrup <gerion.entrup@flump.de> wrote:
> 
> Am Donnerstag, 30. Mai 2024, 18:49:08 MESZ schrieb Bruce Horrocks:
>> 
>>> On 30 May 2024, at 15:15, Gerion Entrup <gerion.entrup@flump.de> wrote:
>>> 
>>> Let's begin with a minimal example:
>>> ```
>>> \define[2]\MyChapter{%
>>> #1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
>>> }
>> 
>> Stop there!
>> 
>> Use \definehead to create your own variation of a heading - much more robust. Something like the following (untested):
>> 
>>  \startsetups PlaceSubTitleAndIntro
>>    % Set font and and style etc for the subtitle here
>>    \structureuservariable(subtitle)
>> 
>>    % Set font and style etc for the intro text here
>>    \structureuservariable(intro)
>>  \stopsetups
>> 
>>  \definehead [MyChapter] [chapter]
>>  \setuphead [MyChapter]
>>    [ style={...}, % heading style
>>      after={\setup{PlaceSubTitleAndIntro}},
>>    ]
>> 
>>  \starttext
>>  \startMyChapter[title={Foo}]
>>    [ subtitle={Bar},
>>      intro={Some explanation},
>>    ]
>>  The text of the chapter
>>  \stopMyChapter
>>  \stoptext
> 
> Thanks for the input. A comparable example is also listed in the wiki.
> I like the approach for placing subtitle and intro alone. However, I also want to style chapter number and chapter title separately.

Any setuphead commands that apply to MyChapter also apply to chapter so you should be able to use exactly the same styling commands.

> I'm also not sure, if an extra heading (MyChapter) is needed, since all my chapters are styled in this way.
> Isn't it possible to define "after" of chapter directly?

Yes, I think it is possible to just use \setuphead [chapter] instead of \setuphead [MyChapter] with the rest remaining the same.

The only reason I don't do it is that if something goes wrong, I know I have an original version of \chapter readily to hand to compare against for debugging.

Regards,
—
Bruce Horrocks
Hampshire, UK

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

  reply	other threads:[~2024-05-30 22:43 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-05-30 14:15 [NTG-context] " Gerion Entrup
2024-05-30 14:25 ` [NTG-context] " Gerion Entrup
2024-05-30 20:54   ` Wolfgang Schuster
2024-05-30 22:37     ` Gerion Entrup
2024-06-01  7:53       ` Wolfgang Schuster
2024-06-01 14:34         ` Gerion Entrup
2024-06-02 22:05           ` Wolfgang Schuster
2024-06-03 11:36             ` Gerion Entrup
2024-06-03 13:13               ` Hans Hagen via ntg-context
2024-06-06 10:14                 ` Gerion Entrup
2024-05-30 16:49 ` Bruce Horrocks
2024-05-30 22:25   ` Gerion Entrup
2024-05-30 22:40     ` Bruce Horrocks [this message]
     [not found] <e405fddb4b534eb68f0be12a3a153c4e@AS8P194MB2116.EURP194.PROD.OUTLOOK.COM>
2024-05-30 14:47 ` Tomáš Hála
2024-05-30 15:04   ` Gerion Entrup

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=24290BB7-EDC1-404F-984D-DAD2983108FA@scorecrow.com \
    --to=ntg@scorecrow.com \
    --cc=gerion.entrup@flump.de \
    --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).