7

I would like to change the font of the chapter and section numbers appearing in my titles. I found that I can change the number style from arabic to roman etc. but I couldn't find a way to change the font of the number itself.

When I tried changing the font of the chapter heading it changed only the heading title text and not the numbering. So I get "1.1" in times roman and "section name" in sans serif :/

I tried using sectsty, titlesec and renewing the \chapter command.

class definition is: \documentclass[twoside,12pt,a4paper,pointlessnumbers,headsepline,idxtotoc]{scrbook}

Any tips or advice would be great!

8
  • maybe the package sectsty can help you. Commented May 9, 2012 at 14:06
  • I didn't try to change it, but in the memoir class I think you can change the \makechapterstyle{section} in the memoir.cls. I did something similar to the chapter style. I guess something similar exists in scrbook.
    – Dror
    Commented May 9, 2012 at 14:07
  • 4
    Please indicate which document class you're using. Are you using one of the koma-script document classes? If so, which one?
    – Mico
    Commented May 9, 2012 at 14:28
  • @Mico: Apparently she (?) made the tagging herself. (@NoaTamir: No offence intended.)
    – Speravir
    Commented May 9, 2012 at 21:53
  • 1
    What I do not understand: In KOMA-script the default are sans serif fonts for disposition/sectioning. Did you confuse the numbers? But compare for instance \documentclass{scrbook} \usepackage[T1]{fontenc} \usepackage{libertine} \usepackage{blindtext} \begin{document} \blinddocument \end{document}.
    – Speravir
    Commented May 9, 2012 at 22:34

3 Answers 3

7

From the tagging, it seems that you are using KOMAscript and the class scrbook. Then you change the font either with \setkomafont or \addtokomafont (see section 3.6, page 51 in the revised manual), and with the modifier chapterprefix. Try:

\setkomafont{chapterprefix}{\rmfamily\Large\bfseries}

or, to change to a serif typeface only:

\addtokomafont{chapterprefix}{\rmfamily}

To change all sectioning to the default Roman font, reverse all font changes you have done to chapter, and try

\addtokomafont{sectioning}{\rmfamily}

It seems from your comment that somebody has tampered with the definitions in your classfile. This minimal example works for me, giving me sans serif in heading and body text.

\documentclass[twoside,12pt,a4paper,pointlessnumbers,headsepline,idxtotoc]{scrb‌​ook}
\usepackage{fixltx2e}
\usepackage[UKenglish]{babel}
\usepackage{tgheros}
\renewcommand*\familydefault{\sfdefault}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{blindtext}

\begin{document}
\blinddocument
\end{document}

In your document, comment out (or delete) all usepackage{secsty} etc. that changes the headings. Or add packages and commands from you preamble to my code.

If you are going to use Helvetica as sans serif font, I suggest using the Tex-Gyre version instead, by loading the package tgheros. I have changed my MWE correspondingly.

2
  • I tried \setkomafont{chapterprefix}{\sffamily} but it didn't change the numbers to sans serif. I'm working on a project I didn't start I'm afraid and the entire book is in \rmfamily despite the fact the default should be sans serif, as @Speravir pointed out in the comments above. It's a very messy project I'm afraid, I couldn't find where they changed the font family. This is the class definition: \documentclass[twoside,12pt,a4paper,pointlessnumbers,headsepline,idxtotoc]{scrbook}
    – Kiwile
    Commented May 11, 2012 at 15:05
  • I have added a MWE to my answer that gives sans serif (Helvetica) for text and headings.
    – Sveinung
    Commented May 11, 2012 at 19:48
3

Here's a way you can change the number formatting:

enter image description here

\documentclass[twoside,12pt,a4paper,pointlessnumbers,headsepline,idxtotoc]{scrbook}
\makeatletter
\renewcommand*{\chapterformat}{% Chapter number formatting
  \mbox{\chapappifchapterprefix{\nobreakspace}{\normalfont\itshape\thechapter}\autodot\enskip}%
}
\renewcommand*{\@seccntformat}[1]{% Section number formatting
   \protect\othersectionlevelsformat{#1}{%
     \expandafter\aftergroup\noexpand\@gobble}{\normalfont\itshape\csname the#1\endcsname}%
}
\makeatother
\begin{document}
\chapter{A chapter}
\section{A section}
Here is some text
\subsection{A subsection}
\end{document}

Printing of the chapter and section numbers are done by \chapterformat and \@seccntformat, respectively. In the above MWE I've inserted \normalfont\itshape which you can change to your liking/preference. It should also be possible to do this a little cleaner using etoolbox.

1

Without knowing the class you are using, this is a very general answer. Here sectsty package is used. A MWE will be:

\documentclass{book}
\usepackage{sectsty}
\allsectionsfont{\sf}
\begin{document}
  \chapter{First chapter}
  This is first chapter
  \section{First section}
  First section and
  \subsection{Also first}
  First sub section
  \subsubsection{Again first}
  What do you think?
  \section{Second section}
  And here is second section.
  \chapter{Second chapter}
\end{document}

enter image description here

enter image description here

1
  • @barbarabeeton: Thanks. I was bit lazy to be elaborate. I think that sentance itself is not required when we have a picture.
    – user11232
    Commented May 9, 2012 at 23:55

You must log in to answer this question.

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