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
___________________________________________________________________________________