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: signature.asc
Description: This is a digitally signed message part.

___________________________________________________________________________________
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 via email to