2

I am having problems formatting the text in my chapter headings. I used sectsty to modify all my headings to \sffamily, but I have some parts of the heading that should be in italics and I can't work out how to achieve this.

Here's an example. It seems to work fine if I comment out the three lines relating to sectsty.

\documentclass[12pt, a4paper, oneside, fleqn]{report}

\usepackage{sectsty}          % put section headings in sans-serif font
\allsectionsfont{\sffamily}
\chapterfont{\LARGE\sffamily}

\begin{document}

\chapter{I want some \textit{Text In Italic} in my heading}

Where has the \textit{italic text} gone from my title?


\end{document}

Thanks in advance.

3
  • You shouldn't use \ensuremath, but simply $\mathbf{B}$, which in turn shouldn't be sans serif if in the text it is serif: it is a symbol and so it's not modifiable. If you find it conflicting with the style for chapter titles, then change the style.
    – egreg
    Feb 11, 2014 at 17:04
  • I just used that example because it was a general example of something I have a lot in my text, used for various other things. I want the maths B to be roman. It's the italic text I want fixed. I only included that to show that I knew it was possible for some things to override the default (though I appreciate the example is a little different. I will remove it, as it's obviously confusing.
    – FionaSmith
    Feb 11, 2014 at 17:10
  • 1
    The Computer Modern fonts don't have a “sans serif bold italic”, so LaTeX substitutes with the nearest font according to its rules: the font family is changed last, the shape first. You find Font shape `OT1/cmss/bx/it' undefined, using `OT1/cmss/bx/n' instead in your log file.
    – egreg
    Feb 11, 2014 at 17:17

1 Answer 1

3

Using the Latin Modern font by adding

\usepackage{lmodern}

to your preamble will display "Text In Italic" in sans-serif, bold, and italic, which I assume to be the desired result.

I couldn't explain it better than egreg in his comment:

The Computer Modern fonts don't have a “sans serif bold italic”, so LaTeX substitutes with the nearest font according to its rules: the font family is changed last, the shape first. You find Font shape 'OT1/cmss/bx/it' undefined, using 'OT1/cmss/bx/n' instead in your log file.

1
  • Perfect, thanks! Nice to have such a simple solution for once!
    – FionaSmith
    Feb 11, 2014 at 17:14

You must log in to answer this question.

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