Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.