0

I want to control the size of the chapter number in ConTeXt with some command like LaTeX \anyfontsize. I was checking this answer https://tex.stackexchange.com/a/668592/14423 I was able to modify the gap between the chapter number and the vertical line (\blackrule) but I could not control the size of the chapter number. Another related question is, the size of \blackrule is affected by the size of the chapter number?

\definehspace[oneem][-.125 em]
\starttexdefinition MyNumberChapterCommand #1
    {\tfe #1}
    %\enspace
    \hspace[oneem]
    \blackrule[
        height=\lineheight,
        depth=\strutdepth,
        width=2pt,
        color=darkred,
    ]
\stoptexdefinition

\definebodyfont[14pt][rm][tfe=Regular at 36pt]

\setuphead[chapter][ numbercommand=\MyNumberChapterCommand, page=no,%Just to have them on the same page here
%numberstyle=\tfe ]

\starttext

\startchapter[title={With a rule}] Bla bla bla \stopchapter

\stoptext

juanuni
  • 1,987

1 Answers1

2

It is not perfectly clear to me how you want it to look, but you can try this (see some comments in the code):

\definehspace[oneem][-.125 em]
\starttexdefinition MyNumberChapterCommand #1
    \tfe #1
    % {\tfe #1}% Test this instead of the one above
    % #1% Test this if the numberstyle is enabled
    \hspace[oneem]
    \blackrule[
        height=\strutheight,% I changed \lineheight to \strutheight
        depth=\strutdepth,
        width=2pt,
        color=darkred,
    ]
\stoptexdefinition

% \definebodyfont[12pt][rm][tfe=Serif at 36pt] \definefontsize[e] \definebodyfontenvironment[default][e=3]% 3*12=36

\setuphead[chapter][ numbercommand=\MyNumberChapterCommand, page=no,%Just to have them on the same page here
% numberstyle={\definedfont[Serif*default at 36pt]}, ]

\starttext

\startchapter[title={With a rule}] Bla bla bla \stopchapter

\stoptext

The version of the code shown above gives (I think the number and the rule look too cramped):

chapter number

mickep
  • 8,685