ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Wolfgang Schuster <wolfgang.schuster.lists@gmail.com>
To: Gerion Entrup <gerion.entrup@flump.de>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: [NTG-context] Re: setuphead in connection with the command argument
Date: Sat, 1 Jun 2024 09:53:46 +0200	[thread overview]
Message-ID: <d6471440-5c27-ba25-47ea-63fdd379f9e9@gmail.com> (raw)
In-Reply-To: <3024583.k3LOHGUjKi@falbala>

Gerion Entrup schrieb am 31.05.2024 um 00:37:
> Am Donnerstag, 30. Mai 2024, 22:54:47 MESZ schrieb Wolfgang Schuster:
>> Gerion Entrup schrieb am 30.05.2024 um 16:25:
>>> The chapter format that I want to achieve in the end is nearly the one in the attachment (excerpt of Christian Dietrich's PhD thesis).
>>
>> When you have a complex layout it is easier to use the
>> \defineheadalternative command to create it.
>>
>> To change the font for each element disable the default settings with
>> \setuphead[style=] and use \startfont (or \definedfont) to apply a
>> different style for the number, title etc.
>>
>> %%%% begin example
>> [...]
>> %%%% end example
> 
> Thank you very much! That looks really clean. I will add it to the wiki.
> 
> Can you bring some clarification regarding "style=", "command=" and "alternative="?

1. Alternatives are the different styles/layouts for the section titles.

The example below demonstrates a few of them and you can create your own 
styles with \defineheadalternative. The command key provides a different 
method to create your own style/layout and in most cases it doesn't 
mattter which method you use, only when you want an inline title like 
"alternative=text" you need \defineheadalternative because it allows you 
to set a few flags which are needed here.

The biggest difference between both is that command uses arguments to 
place the number (#1) and title (#2) while headalternative use the two 
macros \headnumbercontent and \headtextcontent.

%%%% begin example
\starttext

% \setuphead[section][alternative=normal] % default alternative

\section{Lorem ipsum}
\samplefile{lorem}

\page \setuphead[section][alternative=text]

\section{Lorem ipsum}
\samplefile{lorem}

\page \setuphead[section][alternative=middle]

\section{Lorem ipsum}
\samplefile{lorem}

\page \setuphead[section][alternative=margin]

\section{Lorem ipsum}
\samplefile{lorem}

\stoptext
%%%% end example

2. The "style" key is used to set a custom font/style for all elements 
of the section, when you set an empty value the title uses the current 
style of the document.

You can also apply different styles to the number and title with the two 
key "numberstyle" and "titlestyle", the resulting effect is a 
combination of the general "style" value and the special "numberstyle" 
or "titlestyle" value.

Below are few examples where I use a few combinations of the general and 
special settings.

%%%% begin example
\starttext

\section{Lorem ipsum}
\samplefile{lorem}

\page \setuphead[section][style=\bfc]

\section{Lorem ipsum}
\samplefile{lorem}

\page 
\setuphead[section][style=\tfa,textstyle=\bf,numberstyle={\feature[+][oldstyle]}]

\section{Lorem ipsum}
\samplefile{lorem}

\page 
\setuphead[section][style={\switchtobodyfont[heros]\tfa},textstyle=,numberstyle=]

\section{Lorem ipsum}
\samplefile{lorem}

\stoptext
%%%% end example

> What, if I define multiple of them? Is the system not made for this?

Multiple of what?

> I just tested my initial example regarding font size with `command=\MyChapter, style=` and the font size was only affected by the code of \MyChapter.
> What is the default style?

The default style is whatever you set with \setupbofyfont at the begin 
of the document. To get the default settings for \chapter etc. you can 
use the \showinstancevalues which creates a table which prints the values.

%%%% begin example
\usemodule[setups]

\starttext
\showinstancevalues[head][chapter]
\showrootvalues[head]
\stoptext
%%%% end example

Wolfgang
___________________________________________________________________________________
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-06-01  7:56 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 [this message]
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
     [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=d6471440-5c27-ba25-47ea-63fdd379f9e9@gmail.com \
    --to=wolfgang.schuster.lists@gmail.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).