1

I would like to redefine the \thechapter command in the aim to use the eurb10 font only for the chapter number.

I try something like :

\newfont{\ChapNumbFont}{eurb10}
\renewcommand \thechapter {\ChapNumbFont{\@arabic\c@chapter}\normalfont}

But the chapter number font size is not correctly scaled in section, subsection... It seems to use only the "normal" size and cannot "scaled" it.

What I'm doing wrong ?

PS : I'm using a book class strongly customized.


Answer

Thanks to Ulrike Fischer comment, I use this trick:

\renewcommand \thechapter {{\fontencoding{U}\fontfamily{eur}\fontseries{b}\selectfont\@arabic\c@chapter}}

There is a still a little font size difference.

4
  • While I can understand a different font in the chapter head, I don't think it's good to have the same font in the text, next to numbers in the normal font. In any case, \newfont is a deprecated command.
    – egreg
    Jan 31 '13 at 12:39
  • As I said before, the chapter number in the Euler font next to other digits in the normal text font has a rather disputable appearance. Euphemism for "is horrible". ;-)
    – egreg
    Jan 31 '13 at 13:33
  • @egreg: I agree about the look. The look of the section and subsection numbers is simply odd - like font errors. I told Elendil not to redefine \thechapter:-(. Jan 31 '13 at 15:07
  • You are right that's not good. I was hoping a different layout but this is odd :-D. I will change it!
    – Elendil
    Jan 31 '13 at 15:43
2

You can use something like this to call the font in a scalable way:

\documentclass{article}

\begin{document}
{\fontencoding{U}\fontfamily{eur}\fontseries{b}\selectfont abc 123
 \large abc 123}
\end{document}

Be aware that the "U" in \fontencoding means "unknown". So you can't rely on chars to be on standard positions. (But the numbers should be ok.)

You shouldn't put the font switching command in \thechapter: \thechapter is used in a lot of places. The font switch will e.g. end also in the headers, the toc and will be used when you reference a chapter as it will be stored with the label:

\newlabel{abc}{{\fontencoding  {U}\fontfamily  {eur}\fontseries  {b}\selectfont  1}{1}}
2
  • I used \thechapter in the aim to switch the font everywhere the chapter number is used (TOC, label...) to be consistent with the chapter header. So using \renewcommand \thechapter {\fontencoding{U}\fontfamily{eur}\fontseries{b}\selectfont \@arabic\c@chapter\normalfont} works for me. Thanks a lot.
    – Elendil
    Jan 31 '13 at 13:03
  • 1
    I would remove the \normalfont command. Better add additional braces to keep the font switch local. Jan 31 '13 at 13:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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