3

I want to make two-line chapter titles such as this:

Chapter 1
Animals

I found instructions in this article about titles at the ConTeXt wiki.

I want to adjust the font properties of each line though. With this code, I expected it would set "Chapter 1" to roman, size "c" text and set "Animals" to sans serif, size "d" text:

\setuplabeltext[en][chapter=Chapter~]
\define[2]\placechapter{
    \framed[align=raggedleft]{
    {\rm #1} \crlf
            {\tfd #2}
}
}
\setuphead[chapter][style={\ss\tfc}, command={\placechapter}]

\starttext
\chapter{This is the title.}

    This is some text.

\stoptext

Somehow though, the code is ignoring my font commands. How can I independently set the font properties of each line in a two-line section title?

1 Answer 1

5

This is because the style is already applied to #1 and #2, so effectively you are using \rm\ss\tfc, so the \ss overrides the \rm. Why not simply use textstyle and numberstyle keys.

\setuplabeltext[en][chapter=Chapter~]

\define[2]\placechapter
    {\framed[strut=no, align=raggedleft]{#1\crlf #2}}

\setuphead[chapter][numberstyle={\rmc}, textstyle={\ssd}, command={\placechapter}]

\starttext
\chapter{This is the title.}

    This is some text.
\stoptext

which gives

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .