ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Gerion Entrup <gerion.entrup@flump.de>
To: "Tomáš Hála" <mendelu@thala.cz>
Cc: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: [NTG-context] Re: setuphead in connection with the command argument
Date: Thu, 30 May 2024 17:04:44 +0200	[thread overview]
Message-ID: <4589502.1IzOArtZ34@falbala> (raw)
In-Reply-To: <20240530144736.GA10499@thala.cz>


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

  reply	other threads:[~2024-05-30 15:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <e405fddb4b534eb68f0be12a3a153c4e@AS8P194MB2116.EURP194.PROD.OUTLOOK.COM>
2024-05-30 14:47 ` Tomáš Hála
2024-05-30 15:04   ` Gerion Entrup [this message]
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
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

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=4589502.1IzOArtZ34@falbala \
    --to=gerion.entrup@flump.de \
    --cc=mendelu@thala.cz \
    --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).