ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Font switching for titles and subtitle not working as expected ?
@ 2024-04-30 12:22 denis.maier
  2024-04-30 14:02 ` [NTG-context] " Wolfgang Schuster
  0 siblings, 1 reply; 2+ messages in thread
From: denis.maier @ 2024-04-30 12:22 UTC (permalink / raw)
  To: ntg-context


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

Hi,
I just jumbled upon this question on tex stackexchange : https://tex.stackexchange.com/questions/715799/context-switching-font-for-both-title-and-subject#715804
Using the style key as suggested in the accepted answer works, but I've had a look in to this, and I don't understand why the original code does not work.
I've also tried to find a solution using textcommand instead of command, but that makes no difference. Only one setting will be accepted. As soon as both, titles and subjects, are changed only the first change will be accepted.

Is this a bug, or am I missing something?

Best,
Denis


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Original MWE

\define[2]\mytitle{%
  \switchtobodyfont[chorus]%
  #2
}

\define[2]\mysubject{%
  \switchtobodyfont[chorus]%
  #2
}

\setuphead[title][command=\mytitle]
\setuphead[subject][command=\mysubject]

\starttext
\title{In Zapf Chancery}
\subject{Apparently the default font. Why?}

And in the default font, just as expected.
\stoptext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Adapted MWE
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\define[1]\mytitleformat{%
  \switchtobodyfont[chorus]%
  #1
}

%\setuphead[subject,title][textcommand=\mytitleformat]
%\setuphead[title][textcommand=\mytitleformat]
\setuphead[subject][textcommand=\mytitleformat] % this will adapt the format for subjects, as long as titles are not changed


\starttext
\title{In Zapf Chancery}
\subject{Apparently the default font. Why?}

And in the default font, just as expected.
\stoptext
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

[-- Attachment #1.2: Type: text/html, Size: 6458 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] 2+ messages in thread

* [NTG-context] Re: Font switching for titles and subtitle not working as expected ?
  2024-04-30 12:22 [NTG-context] Font switching for titles and subtitle not working as expected ? denis.maier
@ 2024-04-30 14:02 ` Wolfgang Schuster
  0 siblings, 0 replies; 2+ messages in thread
From: Wolfgang Schuster @ 2024-04-30 14:02 UTC (permalink / raw)
  To: mailing list for ConTeXt users, denis.maier


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

denis.maier@unibe.ch schrieb am 30.04.2024 um 14:22:
>
> Hi,
>
> I just jumbled upon this question on tex stackexchange : 
> https://tex.stackexchange.com/questions/715799/context-switching-font-for-both-title-and-subject#715804
>
> Using the style key as suggested in the accepted answer works, but 
> I’ve had a look in to this, and I don’t understand why the original 
> code does not work.
>
> I’ve also tried to find a solution using textcommand instead of 
> command, but that makes no difference. Only one setting will be 
> accepted. As soon as both, titles and subjects, are changed only the 
> first change will be accepted.
>
> Is this a bug, or am I missing something?
>

When you load a typescript only in a local group (e.g. a section title) 
you should always load it
at the start of the document to avoid such side effects.

     \usebodyfont[chorus] % load the chorus typescript
     \setupbodyfont[modern] % set the default font for the document

Wolfgang


[-- Attachment #1.2: Type: text/html, Size: 3082 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] 2+ messages in thread

end of thread, other threads:[~2024-04-30 14:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-30 12:22 [NTG-context] Font switching for titles and subtitle not working as expected ? denis.maier
2024-04-30 14:02 ` [NTG-context] " Wolfgang Schuster

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