ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] setuphead in connection with the command argument
@ 2024-05-30 14:15 Gerion Entrup
  2024-05-30 14:25 ` [NTG-context] " Gerion Entrup
  2024-05-30 16:49 ` Bruce Horrocks
  0 siblings, 2 replies; 15+ messages in thread
From: Gerion Entrup @ 2024-05-30 14:15 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1.1: Type: text/plain, Size: 2782 bytes --]

Hi,

I'm trying to adapt the format of chapters in my document and have a few questions regarding setuphead.
My aim is to have the chapter (title) on a separate page with an additional intro in different text sizes for title, subtitle and the intro.
I chose to use the "command=" argument in setuphead for that.
However, I'm not quite sure about it's internals.

Let's begin with a minimal example:
```
\define[2]\MyChapter{%
	#1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
}

\setuphead[title, chapter][command=\MyChapter]

\setupbodyfont[11pt]

\starttext
\startchapter[title=foo][subtitle=bar, intro={some explanation}]
some text
\stopchapter
\stoptext
```
This produces 1.pdf.


## Font size

What is the reason that that the font of the chapter is bigger? How can I reset it to normal size? This does not work at all:
```
\define[2]\MyChapter{%
	\setupbodyfont[11pt] #1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
}
```
However, changing to a bigger font works somehow. Is there a factor applied to the font size internally? For example:
```
\define[2]\MyChapter{%
	\setupbodyfont[20pt] #1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
}
```
produces 2.pdf (the chapter font is not 20pt).


## Line breaks

How can I achieve line breaks?
This does not work:
```
\define[2]\MyChapter{%
    #1 #2:\\
    \structureuservariable{subtitle}\\
    (\structureuservariable{intro})
}
```
(see 3.pdf)

I also want to set everything except of the intro in a flushright environment but do not know how. I tried:
```
\define[2]\MyChapter{%
    \startalignment[flushright]
        #1 #2:\\
        \structureuservariable{subtitle}\\
    \stopalignment
    \structureuservariable{intro}
}
```
(see 4.pdf, no change)


## Bold text

I tried to get the text bold. However, `#1` and `#2` does not seem to follow this.
```
\define[2]\MyChapter{%
    \bold #1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
}
```

## Makeups

The best solution, I had so far, was to define a makeup, but I don't get it to work with text with mixed alignment and it does not solve the font size problem:
```
\definemakeup[chapter][align=left, top=]
\define[2]\MyChapter{%
    \startmakeup[chapter]
        #1 #2:\\
        \structureuservariable{subtitle}\\
    \stopmakeup
    (\structureuservariable{intro})
}
```
(see 5.pdf)

## Framed

I also have tried this but it does not bring any linebreaks:
```
\define[2]\MyChapter{%
    \framed[frame=off, offset=0pt]{#1\\#2:\\ \structureuservariable{subtitle}\\ (\structureuservariable{intro})}
}
```
(see 6.pdf)

I hope you can shed some light into setuphead with command. I search on the wiki, Stackoverflow and the manuals but didn't really find anything.

Best,
Gerion


[-- Attachment #1.1.2: 1.pdf --]
[-- Type: application/pdf, Size: 6848 bytes --]

[-- Attachment #1.1.3: 2.pdf --]
[-- Type: application/pdf, Size: 6851 bytes --]

[-- Attachment #1.1.4: 3.pdf --]
[-- Type: application/pdf, Size: 6841 bytes --]

[-- Attachment #1.1.5: 4.pdf --]
[-- Type: application/pdf, Size: 6668 bytes --]

[-- Attachment #1.1.6: 5.pdf --]
[-- Type: application/pdf, Size: 7203 bytes --]

[-- Attachment #1.1.7: 6.pdf --]
[-- Type: application/pdf, Size: 6851 bytes --]

[-- Attachment #1.1.8: mwe.tex --]
[-- Type: text/x-tex, Size: 1138 bytes --]

% 1.pdf
\define[2]\MyChapter{%
	#1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
}

% % 2.pdf
% \define[2]\MyChapter{%
% 	\setupbodyfont[20pt] #1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
% }

% % 3.pdf
% \define[2]\MyChapter{%
%     #1 #2:\\
%     \structureuservariable{subtitle}\\
%     (\structureuservariable{intro})
% }

% % 4.pdf
% \define[2]\MyChapter{%
%     \startalignment[flushright]
%         #1 #2:\\
%         \structureuservariable{subtitle}\\
%     \stopalignment
%     \structureuservariable{intro}
% }

% % 5.pdf
% \definemakeup[chapter][align=left, top=]
% \define[2]\MyChapter{%
%     \startmakeup[chapter]
%         #1 #2:\\
%         \structureuservariable{subtitle}\\
%     \stopmakeup
%     (\structureuservariable{intro})
% }


% % 6.pdf
% \define[2]\MyChapter{%
%     \framed[frame=off, offset=0pt]{#1\\#2:\\ \structureuservariable{subtitle}\\ (\structureuservariable{intro})}
% }

\setuphead[title, chapter][command=\MyChapter]

\setupbodyfont[11pt]

\starttext
\startchapter[title=foo][subtitle=bar, intro={some explanation}]
some text
\stopchapter
\stoptext

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [NTG-context] Re: setuphead in connection with the command argument
  2024-05-30 14:15 [NTG-context] setuphead in connection with the command argument Gerion Entrup
@ 2024-05-30 14:25 ` Gerion Entrup
  2024-05-30 20:54   ` Wolfgang Schuster
  2024-05-30 16:49 ` Bruce Horrocks
  1 sibling, 1 reply; 15+ messages in thread
From: Gerion Entrup @ 2024-05-30 14:25 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1.1: Type: text/plain, Size: 3218 bytes --]

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).

Best
Gerion


Am Donnerstag, 30. Mai 2024, 16:15:01 MESZ schrieb Gerion Entrup:
> Hi,
> 
> I'm trying to adapt the format of chapters in my document and have a few questions regarding setuphead.
> My aim is to have the chapter (title) on a separate page with an additional intro in different text sizes for title, subtitle and the intro.
> I chose to use the "command=" argument in setuphead for that.
> However, I'm not quite sure about it's internals.
> 
> Let's begin with a minimal example:
> ```
> \define[2]\MyChapter{%
> 	#1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
> }
> 
> \setuphead[title, chapter][command=\MyChapter]
> 
> \setupbodyfont[11pt]
> 
> \starttext
> \startchapter[title=foo][subtitle=bar, intro={some explanation}]
> some text
> \stopchapter
> \stoptext
> ```
> This produces 1.pdf.
> 
> 
> ## Font size
> 
> What is the reason that that the font of the chapter is bigger? How can I reset it to normal size? This does not work at all:
> ```
> \define[2]\MyChapter{%
> 	\setupbodyfont[11pt] #1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
> }
> ```
> However, changing to a bigger font works somehow. Is there a factor applied to the font size internally? For example:
> ```
> \define[2]\MyChapter{%
> 	\setupbodyfont[20pt] #1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
> }
> ```
> produces 2.pdf (the chapter font is not 20pt).
> 
> 
> ## Line breaks
> 
> How can I achieve line breaks?
> This does not work:
> ```
> \define[2]\MyChapter{%
>     #1 #2:\\
>     \structureuservariable{subtitle}\\
>     (\structureuservariable{intro})
> }
> ```
> (see 3.pdf)
> 
> I also want to set everything except of the intro in a flushright environment but do not know how. I tried:
> ```
> \define[2]\MyChapter{%
>     \startalignment[flushright]
>         #1 #2:\\
>         \structureuservariable{subtitle}\\
>     \stopalignment
>     \structureuservariable{intro}
> }
> ```
> (see 4.pdf, no change)
> 
> 
> ## Bold text
> 
> I tried to get the text bold. However, `#1` and `#2` does not seem to follow this.
> ```
> \define[2]\MyChapter{%
>     \bold #1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
> }
> ```
> 
> ## Makeups
> 
> The best solution, I had so far, was to define a makeup, but I don't get it to work with text with mixed alignment and it does not solve the font size problem:
> ```
> \definemakeup[chapter][align=left, top=]
> \define[2]\MyChapter{%
>     \startmakeup[chapter]
>         #1 #2:\\
>         \structureuservariable{subtitle}\\
>     \stopmakeup
>     (\structureuservariable{intro})
> }
> ```
> (see 5.pdf)
> 
> ## Framed
> 
> I also have tried this but it does not bring any linebreaks:
> ```
> \define[2]\MyChapter{%
>     \framed[frame=off, offset=0pt]{#1\\#2:\\ \structureuservariable{subtitle}\\ (\structureuservariable{intro})}
> }
> ```
> (see 6.pdf)
> 
> I hope you can shed some light into setuphead with command. I search on the wiki, Stackoverflow and the manuals but didn't really find anything.
> 
> Best,
> Gerion
> 
> 


[-- Attachment #1.1.2: chapter.pdf --]
[-- Type: application/pdf, Size: 15279 bytes --]

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [NTG-context] Re: setuphead in connection with the command argument
  2024-05-30 14:15 [NTG-context] setuphead in connection with the command argument Gerion Entrup
  2024-05-30 14:25 ` [NTG-context] " Gerion Entrup
@ 2024-05-30 16:49 ` Bruce Horrocks
  2024-05-30 22:25   ` Gerion Entrup
  1 sibling, 1 reply; 15+ messages in thread
From: Bruce Horrocks @ 2024-05-30 16:49 UTC (permalink / raw)
  To: ntg-context mailing list



> 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

—
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [NTG-context] Re: setuphead in connection with the command argument
  2024-05-30 14:25 ` [NTG-context] " Gerion Entrup
@ 2024-05-30 20:54   ` Wolfgang Schuster
  2024-05-30 22:37     ` Gerion Entrup
  0 siblings, 1 reply; 15+ messages in thread
From: Wolfgang Schuster @ 2024-05-30 20:54 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Gerion Entrup

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
\defineframed
   [ChapterFrame]
   [width=\textwidth,
    align=flushright,
    offset=0pt,
    rulethickness=0pt]

\startsetups [christian_dietrich]
   \startlocalheadsetup
     \startframed[ChapterFrame]
       \blank[2cm]
       \startfont[Serif sa 8]
         \color[darkgray]{\headnumbercontent}
       \stopfont
       \blank[5mm]
       \startfont[SerifBold sa 2]
         \color[darkred]{\headtextcontent}
       \stopfont
       \blank[1cm]
       \startfont[SerifBold sa 1.5]
         \color[darkred]{\structureuservariable{subtitle}}
       \stopfont
     \stopframed
   \stoplocalheadsetup
\stopsetups

\defineheadalternative
   [christian_dietrich]
   [renderingsetup=christian_dietrich]

\setuphead
   [chapter]
   [alternative=christian_dietrich,
    header=empty,
    style=]

\starttext

\startchapter[title=Chapter title][subtitle=Chapter subtitle]
\samplefile{lorem}
\stopchapter

\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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [NTG-context] Re: setuphead in connection with the command argument
  2024-05-30 16:49 ` Bruce Horrocks
@ 2024-05-30 22:25   ` Gerion Entrup
  2024-05-30 22:40     ` Bruce Horrocks
  0 siblings, 1 reply; 15+ messages in thread
From: Gerion Entrup @ 2024-05-30 22:25 UTC (permalink / raw)
  To: ntg-context mailing list


[-- Attachment #1.1: Type: text/plain, Size: 1418 bytes --]

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.
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?

Best
Gerion

[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [NTG-context] Re: setuphead in connection with the command argument
  2024-05-30 20:54   ` Wolfgang Schuster
@ 2024-05-30 22:37     ` Gerion Entrup
  2024-06-01  7:53       ` Wolfgang Schuster
  0 siblings, 1 reply; 15+ messages in thread
From: Gerion Entrup @ 2024-05-30 22:37 UTC (permalink / raw)
  To: mailing list for ConTeXt users, Wolfgang Schuster


[-- Attachment #1.1: Type: text/plain, Size: 2015 bytes --]

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
> \defineframed
>    [ChapterFrame]
>    [width=\textwidth,
>     align=flushright,
>     offset=0pt,
>     rulethickness=0pt]
> 
> \startsetups [christian_dietrich]
>    \startlocalheadsetup
>      \startframed[ChapterFrame]
>        \blank[2cm]
>        \startfont[Serif sa 8]
>          \color[darkgray]{\headnumbercontent}
>        \stopfont
>        \blank[5mm]
>        \startfont[SerifBold sa 2]
>          \color[darkred]{\headtextcontent}
>        \stopfont
>        \blank[1cm]
>        \startfont[SerifBold sa 1.5]
>          \color[darkred]{\structureuservariable{subtitle}}
>        \stopfont
>      \stopframed
>    \stoplocalheadsetup
> \stopsetups
> 
> \defineheadalternative
>    [christian_dietrich]
>    [renderingsetup=christian_dietrich]
> 
> \setuphead
>    [chapter]
>    [alternative=christian_dietrich,
>     header=empty,
>     style=]
> 
> \starttext
> 
> \startchapter[title=Chapter title][subtitle=Chapter subtitle]
> \samplefile{lorem}
> \stopchapter
> 
> \stoptext
> %%%% 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="?
What, if I define multiple of them? Is the system not made for this?

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?

Best
Gerion


[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [NTG-context] Re: setuphead in connection with the command argument
  2024-05-30 22:25   ` Gerion Entrup
@ 2024-05-30 22:40     ` Bruce Horrocks
  0 siblings, 0 replies; 15+ messages in thread
From: Bruce Horrocks @ 2024-05-30 22:40 UTC (permalink / raw)
  To: Gerion Entrup; +Cc: ntg-context mailing list



> 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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [NTG-context] Re: setuphead in connection with the command argument
  2024-05-30 22:37     ` Gerion Entrup
@ 2024-06-01  7:53       ` Wolfgang Schuster
  2024-06-01 14:34         ` Gerion Entrup
  0 siblings, 1 reply; 15+ messages in thread
From: Wolfgang Schuster @ 2024-06-01  7:53 UTC (permalink / raw)
  To: Gerion Entrup; +Cc: mailing list for ConTeXt users

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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [NTG-context] Re: setuphead in connection with the command argument
  2024-06-01  7:53       ` Wolfgang Schuster
@ 2024-06-01 14:34         ` Gerion Entrup
  2024-06-02 22:05           ` Wolfgang Schuster
  0 siblings, 1 reply; 15+ messages in thread
From: Gerion Entrup @ 2024-06-01 14:34 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 580 bytes --]

Am Samstag, 1. Juni 2024, 09:53:46 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 31.05.2024 um 00:37:
> > What, if I define multiple of them? Is the system not made for this?
> 
> Multiple of what?

When I define `alternative=` _and_ `command=` in the same `\setuphead`.
Or `alternative=` and `style=`, or `alternative=` and `command=`.

I guess style is applied just to the arguments/macros of the command/the alternative?
And combining alternative and command never make sense.

Thank you very much for your long answer, that was very enlightening!

Best
Gerion




[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [NTG-context] Re: setuphead in connection with the command argument
  2024-06-01 14:34         ` Gerion Entrup
@ 2024-06-02 22:05           ` Wolfgang Schuster
  2024-06-03 11:36             ` Gerion Entrup
  0 siblings, 1 reply; 15+ messages in thread
From: Wolfgang Schuster @ 2024-06-02 22:05 UTC (permalink / raw)
  To: Gerion Entrup; +Cc: mailing list for ConTeXt users

Gerion Entrup schrieb am 01.06.2024 um 16:34:
> Am Samstag, 1. Juni 2024, 09:53:46 MESZ schrieb Wolfgang Schuster:
>> Gerion Entrup schrieb am 31.05.2024 um 00:37:
>>> What, if I define multiple of them? Is the system not made for this?
>>
>> Multiple of what?
> 
> When I define `alternative=` _and_ `command=` in the same `\setuphead`.
> Or `alternative=` and `style=`, or `alternative=` and `command=`.
> 
> I guess style is applied just to the arguments/macros of the command/the alternative?
> And combining alternative and command never make sense.

The following descriptions applies to most setup commands when exclude 
special cases like \setupbodyfont or \setuplayout.


When you make multiple changes to the values of a command with

     \setuphead [section] [style=bold]

and

    \setuphead [section] [color=blue]

you achieve the same result as setting both values at the same time like

    \setuphead [section] [style=bold,color=blue]


What you're doing here is just passing some value to a parameter, 
nothing else happens at this time. When you process a document Context 
has already passed the value "normal" to the "alternative" parameter in 
the \setuphead command. When you now pass a custom macro the "command" 
parameter in \setuphead all you have done is to set a value, nothing 
else happened at this point.


The evaluation of the parameter happens when Context places the content 
of a heading with \startchapter etc. in your document and only at this 
point it has to make a decision what should happen when both "command" 
and "alternative" are set. The order in which the parameters are used is 
the following: a) check if the "command" parameter has a value and if 
this is true is it and ignore the "alternative" value b) if no value is 
present for the "command" parameter use the value of "alternative".


The value of the "style" parameter is unrelated of the 
command/alternative values because it isn't needed to choose a layout 
for the heading, all the parameter does is to change the font/style 
which is independent of the layout.


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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [NTG-context] Re: setuphead in connection with the command argument
  2024-06-02 22:05           ` Wolfgang Schuster
@ 2024-06-03 11:36             ` Gerion Entrup
  2024-06-03 13:13               ` Hans Hagen via ntg-context
  0 siblings, 1 reply; 15+ messages in thread
From: Gerion Entrup @ 2024-06-03 11:36 UTC (permalink / raw)
  To: Wolfgang Schuster; +Cc: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 4085 bytes --]

Am Montag, 3. Juni 2024, 00:05:22 MESZ schrieb Wolfgang Schuster:
> Gerion Entrup schrieb am 01.06.2024 um 16:34:
> > Am Samstag, 1. Juni 2024, 09:53:46 MESZ schrieb Wolfgang Schuster:
> >> Gerion Entrup schrieb am 31.05.2024 um 00:37:
> >>> What, if I define multiple of them? Is the system not made for this?
> >>
> >> Multiple of what?
> > 
> > When I define `alternative=` _and_ `command=` in the same `\setuphead`.
> > Or `alternative=` and `style=`, or `alternative=` and `command=`.
> > 
> > I guess style is applied just to the arguments/macros of the command/the alternative?
> > And combining alternative and command never make sense.
> 
> The following descriptions applies to most setup commands when exclude 
> special cases like \setupbodyfont or \setuplayout.
> 
> 
> When you make multiple changes to the values of a command with
> 
>      \setuphead [section] [style=bold]
> 
> and
> 
>     \setuphead [section] [color=blue]
> 
> you achieve the same result as setting both values at the same time like
> 
>     \setuphead [section] [style=bold,color=blue]
> 
> 
> What you're doing here is just passing some value to a parameter, 
> nothing else happens at this time. When you process a document Context 
> has already passed the value "normal" to the "alternative" parameter in 
> the \setuphead command. When you now pass a custom macro the "command" 
> parameter in \setuphead all you have done is to set a value, nothing 
> else happened at this point.
> 
> 
> The evaluation of the parameter happens when Context places the content 
> of a heading with \startchapter etc. in your document and only at this 
> point it has to make a decision what should happen when both "command" 
> and "alternative" are set. The order in which the parameters are used is 
> the following: a) check if the "command" parameter has a value and if 
> this is true is it and ignore the "alternative" value b) if no value is 
> present for the "command" parameter use the value of "alternative".
> 
> 
> The value of the "style" parameter is unrelated of the 
> command/alternative values because it isn't needed to choose a layout 
> for the heading, all the parameter does is to change the font/style 
> which is independent of the layout.
> 

Thank you. I think that I understand command vs alternative now.
With try and error, I experienced, that the font/style of the `style`
parameter interleave in a strange way. Therefore I see it as related.
What i mean is:

Example 1
```
\define[2]\MyChapter{%
    \bold This is bold #1 #2
}
\setuphead[title, chapter][command=\MyChapter, style=\italic]
\starttext
\startchapter[title=foo]
\stopchapter
\stoptext
```

"This is bold" is bold, but "1" and "foo" are italic.
The font size is normal.
It seems, that "style" is just applied to "#1" and "#2" _before_ evaluating MyChapter.

Example 2
```
\define[2]\MyChapter{%
    \bold This is bold #1 #2
}

% this should be the "default" style
\setuphead[title, chapter][command=\MyChapter, style=\tfc]
\starttext
\startchapter[title=foo]
\stopchapter
\stoptext
```

"This is bold" is bold, "1" and "2" are normal, but the whole font size is bigger.
It seems, that "style" is applied partially to the whole text and somehow special to "#1" and "#2" (Why are these arguments not bold?)


As of your explanations, I currently think of the following logic for typesetting (in pseudocode):

```
function typeset_chapter(style, numberstyle, textstyle, command, alternative, chapter_number, chapter_title) {
    
    local formatted_chapter_number = apply_style(numberstyle, apply_style(style, chapter_number))
    local formatted_chapter_title = apply_style(textstyle, apply_style(style, chapter_title))
    if (alternative != "normal")
        set_TeX_macro("\headnumbercontent", formatted_chapter_number)
        set_TeX_macro("\headtextcontent", formatted_chapter_title)
        typeset_as_TeX(get_TeX_code(alternative))
    else
        evaluate_TeX_function(command, #1=formatted_chapter_number, #2=formatted_chapter_title)
    endif
}
```
But this does not fit to example 2.

Best
Gerion




[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [NTG-context] Re: setuphead in connection with the command argument
  2024-06-03 11:36             ` Gerion Entrup
@ 2024-06-03 13:13               ` Hans Hagen via ntg-context
  2024-06-06 10:14                 ` Gerion Entrup
  0 siblings, 1 reply; 15+ messages in thread
From: Hans Hagen via ntg-context @ 2024-06-03 13:13 UTC (permalink / raw)
  To: mailing list for ConTeXt users; +Cc: Hans Hagen

On 6/3/2024 1:36 PM, Gerion Entrup wrote:
> Thank you. I think that I understand command vs alternative now.
> With try and error, I experienced, that the font/style of the `style`
> parameter interleave in a strange way. Therefore I see it as related.
> What i mean is:
style: outer level, also sets interline spacing and adapts before after 
blanks

numberstyle and textstyle : specific to the element

Hans


-----------------------------------------------------------------
                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
        tel: 038 477 53 69 | www.pragma-ade.nl | www.pragma-pod.nl
-----------------------------------------------------------------

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [NTG-context] Re: setuphead in connection with the command argument
  2024-06-03 13:13               ` Hans Hagen via ntg-context
@ 2024-06-06 10:14                 ` Gerion Entrup
  0 siblings, 0 replies; 15+ messages in thread
From: Gerion Entrup @ 2024-06-06 10:14 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 557 bytes --]

Am Montag, 3. Juni 2024, 15:13:20 MESZ schrieb Hans Hagen via ntg-context:
> On 6/3/2024 1:36 PM, Gerion Entrup wrote:
> > Thank you. I think that I understand command vs alternative now.
> > With try and error, I experienced, that the font/style of the `style`
> > parameter interleave in a strange way. Therefore I see it as related.
> > What i mean is:
> style: outer level, also sets interline spacing and adapts before after 
> blanks
> 
> numberstyle and textstyle : specific to the element

Thank you! I will try to wrap it up in the Wiki.

Gerion



[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [NTG-context] Re: setuphead in connection with the command argument
  2024-05-30 14:47 ` Tomáš Hála
@ 2024-05-30 15:04   ` Gerion Entrup
  0 siblings, 0 replies; 15+ messages in thread
From: Gerion Entrup @ 2024-05-30 15:04 UTC (permalink / raw)
  To: Tomáš Hála; +Cc: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 7054 bytes --]

Hi Tomáš,

first, thank you for the answer.

Am Donnerstag, 30. Mai 2024, 16:47:36 MESZ schrieb Tomáš Hála:
> Hi Gebrion,
> 
> > ## Font size + ## Bold text
> 
> for font size etc., you can use 
>   \setuphead [chapter] [style={\setupbodyfont[11pt]}]  or
>   \setuphead [chapter] [style=\tf]
> 
>   \setuphead [chapter] [style=\bf]

So this sentence of the wiki [1] is wrong (documentation of the command argument)?:
> Command to use for typesetting the title; overrules all other styling. First argument is the number, second the title text.

If I see it right, `style=` only affects the typesetting of `#1` and `#2`, so I need setupbodyfont _and_ switchtobodyfont, didn't I?
Also, when I want #1 and #2 to be in different sizes, I choose the "base" size with style=\setupbodyfont and adjust it further with switchtobodyfont just for one the the argument?

All in all, the correct documentation would be:
> Command to use for typesetting the title. First argument is the number, second the title text. Styling of these parameters can be achieved only by specifying style=.


> > ## Line breaks + ## Framed
> > How can I achieve line breaks?
> 
> \define[2]\MyChapter{%
>   \framedtext{%
>      #1 #2:\\
>      \structureuservariable{subtitle}\\
>      (\structureuservariable{intro})
>   }
> }

This produces an extra line break between '#2' and ':', I don't get why. Otherwise, it looks quite nice.


> > I also want to set everything except of the intro in a flushright environment but do not know how. I tried:
> 
> As above: 
>   \framedtext[align=flushright]{%

That works, thank you!


Best,
Gerion

> ------
> 
> On Thu, May 30, 2024 at 02:15:01PM +0000, Gerion Entrup wrote:
> > Hi,
> > 
> > I'm trying to adapt the format of chapters in my document and have a few questions regarding setuphead.
> > My aim is to have the chapter (title) on a separate page with an additional intro in different text sizes for title, subtitle and the intro.
> > I chose to use the "command=" argument in setuphead for that.
> > However, I'm not quite sure about it's internals.
> > 
> > Let's begin with a minimal example:
> > ```
> > \define[2]\MyChapter{%
> > 	#1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
> > }
> > 
> > \setuphead[title, chapter][command=\MyChapter]
> > 
> > \setupbodyfont[11pt]
> > 
> > \starttext
> > \startchapter[title=foo][subtitle=bar, intro={some explanation}]
> > some text
> > \stopchapter
> > \stoptext
> > ```
> > This produces 1.pdf.
> > 
> > 
> > ## Font size
> > 
> > What is the reason that that the font of the chapter is bigger? How can I reset it to normal size? This does not work at all:
> > ```
> > \define[2]\MyChapter{%
> > 	\setupbodyfont[11pt] #1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
> > }
> > ```
> > However, changing to a bigger font works somehow. Is there a factor applied to the font size internally? For example:
> > ```
> > \define[2]\MyChapter{%
> > 	\setupbodyfont[20pt] #1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
> > }
> > ```
> > produces 2.pdf (the chapter font is not 20pt).
> > 
> > 
> > ## Line breaks
> > 
> > How can I achieve line breaks?
> > This does not work:
> > ```
> > \define[2]\MyChapter{%
> >     #1 #2:\\
> >     \structureuservariable{subtitle}\\
> >     (\structureuservariable{intro})
> > }
> > ```
> > (see 3.pdf)
> > 
> > I also want to set everything except of the intro in a flushright environment but do not know how. I tried:
> > ```
> > \define[2]\MyChapter{%
> >     \startalignment[flushright]
> >         #1 #2:\\
> >         \structureuservariable{subtitle}\\
> >     \stopalignment
> >     \structureuservariable{intro}
> > }
> > ```
> > (see 4.pdf, no change)
> > 
> > 
> > ## Bold text
> > 
> > I tried to get the text bold. However, `#1` and `#2` does not seem to follow this.
> > ```
> > \define[2]\MyChapter{%
> >     \bold #1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
> > }
> > ```
> > 
> > ## Makeups
> > 
> > The best solution, I had so far, was to define a makeup, but I don't get it to work with text with mixed alignment and it does not solve the font size problem:
> > ```
> > \definemakeup[chapter][align=left, top=]
> > \define[2]\MyChapter{%
> >     \startmakeup[chapter]
> >         #1 #2:\\
> >         \structureuservariable{subtitle}\\
> >     \stopmakeup
> >     (\structureuservariable{intro})
> > }
> > ```
> > (see 5.pdf)
> > 
> > ## Framed
> > 
> > I also have tried this but it does not bring any linebreaks:
> > ```
> > \define[2]\MyChapter{%
> >     \framed[frame=off, offset=0pt]{#1\\#2:\\ \structureuservariable{subtitle}\\ (\structureuservariable{intro})}
> > }
> > ```
> > (see 6.pdf)
> > 
> > I hope you can shed some light into setuphead with command. I search on the wiki, Stackoverflow and the manuals but didn't really find anything.
> > 
> > Best,
> > Gerion
> > 
> 
> 
> 
> 
> 
> 
> 
> > % 1.pdf
> > \define[2]\MyChapter{%
> > 	#1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
> > }
> > 
> > % % 2.pdf
> > % \define[2]\MyChapter{%
> > % 	\setupbodyfont[20pt] #1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
> > % }
> > 
> > % % 3.pdf
> > % \define[2]\MyChapter{%
> > %     #1 #2:\\
> > %     \structureuservariable{subtitle}\\
> > %     (\structureuservariable{intro})
> > % }
> > 
> > % % 4.pdf
> > % \define[2]\MyChapter{%
> > %     \startalignment[flushright]
> > %         #1 #2:\\
> > %         \structureuservariable{subtitle}\\
> > %     \stopalignment
> > %     \structureuservariable{intro}
> > % }
> > 
> > % % 5.pdf
> > % \definemakeup[chapter][align=left, top=]
> > % \define[2]\MyChapter{%
> > %     \startmakeup[chapter]
> > %         #1 #2:\\
> > %         \structureuservariable{subtitle}\\
> > %     \stopmakeup
> > %     (\structureuservariable{intro})
> > % }
> > 
> > 
> > % % 6.pdf
> > % \define[2]\MyChapter{%
> > %     \framed[frame=off, offset=0pt]{#1\\#2:\\ \structureuservariable{subtitle}\\ (\structureuservariable{intro})}
> > % }
> > 
> > \setuphead[title, chapter][command=\MyChapter]
> > 
> > \setupbodyfont[11pt]
> > 
> > \starttext
> > \startchapter[title=foo][subtitle=bar, intro={some explanation}]
> > some text
> > \stopchapter
> > \stoptext
> 
> 
> > ___________________________________________________________________________________
> > 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
> > ___________________________________________________________________________________
> 
> 


[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 659 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 15+ messages in thread

* [NTG-context] Re: setuphead in connection with the command argument
       [not found] <e405fddb4b534eb68f0be12a3a153c4e@AS8P194MB2116.EURP194.PROD.OUTLOOK.COM>
@ 2024-05-30 14:47 ` Tomáš Hála
  2024-05-30 15:04   ` Gerion Entrup
  0 siblings, 1 reply; 15+ messages in thread
From: Tomáš Hála @ 2024-05-30 14:47 UTC (permalink / raw)
  To: Gerion Entrup; +Cc: mailing list for ConTeXt users

Hi Gebrion,

> ## Font size + ## Bold text

for font size etc., you can use 
  \setuphead [chapter] [style={\setupbodyfont[11pt]}]  or
  \setuphead [chapter] [style=\tf]

  \setuphead [chapter] [style=\bf]

> ## Line breaks + ## Framed
> How can I achieve line breaks?

\define[2]\MyChapter{%
  \framedtext{%
     #1 #2:\\
     \structureuservariable{subtitle}\\
     (\structureuservariable{intro})
  }
}

> I also want to set everything except of the intro in a flushright environment but do not know how. I tried:

As above: 
  \framedtext[align=flushright]{%

The best,

Tomáš

------

On Thu, May 30, 2024 at 02:15:01PM +0000, Gerion Entrup wrote:
> Hi,
> 
> I'm trying to adapt the format of chapters in my document and have a few questions regarding setuphead.
> My aim is to have the chapter (title) on a separate page with an additional intro in different text sizes for title, subtitle and the intro.
> I chose to use the "command=" argument in setuphead for that.
> However, I'm not quite sure about it's internals.
> 
> Let's begin with a minimal example:
> ```
> \define[2]\MyChapter{%
> 	#1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
> }
> 
> \setuphead[title, chapter][command=\MyChapter]
> 
> \setupbodyfont[11pt]
> 
> \starttext
> \startchapter[title=foo][subtitle=bar, intro={some explanation}]
> some text
> \stopchapter
> \stoptext
> ```
> This produces 1.pdf.
> 
> 
> ## Font size
> 
> What is the reason that that the font of the chapter is bigger? How can I reset it to normal size? This does not work at all:
> ```
> \define[2]\MyChapter{%
> 	\setupbodyfont[11pt] #1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
> }
> ```
> However, changing to a bigger font works somehow. Is there a factor applied to the font size internally? For example:
> ```
> \define[2]\MyChapter{%
> 	\setupbodyfont[20pt] #1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
> }
> ```
> produces 2.pdf (the chapter font is not 20pt).
> 
> 
> ## Line breaks
> 
> How can I achieve line breaks?
> This does not work:
> ```
> \define[2]\MyChapter{%
>     #1 #2:\\
>     \structureuservariable{subtitle}\\
>     (\structureuservariable{intro})
> }
> ```
> (see 3.pdf)
> 
> I also want to set everything except of the intro in a flushright environment but do not know how. I tried:
> ```
> \define[2]\MyChapter{%
>     \startalignment[flushright]
>         #1 #2:\\
>         \structureuservariable{subtitle}\\
>     \stopalignment
>     \structureuservariable{intro}
> }
> ```
> (see 4.pdf, no change)
> 
> 
> ## Bold text
> 
> I tried to get the text bold. However, `#1` and `#2` does not seem to follow this.
> ```
> \define[2]\MyChapter{%
>     \bold #1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
> }
> ```
> 
> ## Makeups
> 
> The best solution, I had so far, was to define a makeup, but I don't get it to work with text with mixed alignment and it does not solve the font size problem:
> ```
> \definemakeup[chapter][align=left, top=]
> \define[2]\MyChapter{%
>     \startmakeup[chapter]
>         #1 #2:\\
>         \structureuservariable{subtitle}\\
>     \stopmakeup
>     (\structureuservariable{intro})
> }
> ```
> (see 5.pdf)
> 
> ## Framed
> 
> I also have tried this but it does not bring any linebreaks:
> ```
> \define[2]\MyChapter{%
>     \framed[frame=off, offset=0pt]{#1\\#2:\\ \structureuservariable{subtitle}\\ (\structureuservariable{intro})}
> }
> ```
> (see 6.pdf)
> 
> I hope you can shed some light into setuphead with command. I search on the wiki, Stackoverflow and the manuals but didn't really find anything.
> 
> Best,
> Gerion
> 







> % 1.pdf
> \define[2]\MyChapter{%
> 	#1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
> }
> 
> % % 2.pdf
> % \define[2]\MyChapter{%
> % 	\setupbodyfont[20pt] #1 #2: \structureuservariable{subtitle} (\structureuservariable{intro})
> % }
> 
> % % 3.pdf
> % \define[2]\MyChapter{%
> %     #1 #2:\\
> %     \structureuservariable{subtitle}\\
> %     (\structureuservariable{intro})
> % }
> 
> % % 4.pdf
> % \define[2]\MyChapter{%
> %     \startalignment[flushright]
> %         #1 #2:\\
> %         \structureuservariable{subtitle}\\
> %     \stopalignment
> %     \structureuservariable{intro}
> % }
> 
> % % 5.pdf
> % \definemakeup[chapter][align=left, top=]
> % \define[2]\MyChapter{%
> %     \startmakeup[chapter]
> %         #1 #2:\\
> %         \structureuservariable{subtitle}\\
> %     \stopmakeup
> %     (\structureuservariable{intro})
> % }
> 
> 
> % % 6.pdf
> % \define[2]\MyChapter{%
> %     \framed[frame=off, offset=0pt]{#1\\#2:\\ \structureuservariable{subtitle}\\ (\structureuservariable{intro})}
> % }
> 
> \setuphead[title, chapter][command=\MyChapter]
> 
> \setupbodyfont[11pt]
> 
> \starttext
> \startchapter[title=foo][subtitle=bar, intro={some explanation}]
> some text
> \stopchapter
> \stoptext


> ___________________________________________________________________________________
> 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
> ___________________________________________________________________________________

___________________________________________________________________________________
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
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2024-06-06 10:15 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-30 14:15 [NTG-context] setuphead in connection with the command argument 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
     [not found] <e405fddb4b534eb68f0be12a3a153c4e@AS8P194MB2116.EURP194.PROD.OUTLOOK.COM>
2024-05-30 14:47 ` Tomáš Hála
2024-05-30 15:04   ` Gerion Entrup

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).