2

Oveleaf say that it's possible to use a set of pre-installed fonts here. One of these is "CMU Classical Serif" I want to change the section title in my document to be "CMU Classical Serif"

I try the following, but the font does not change at all (using package titlesec, XeLaTex compiler for fontspec)

    \newfontfamily\sectionfonts{CMU Classical Serif}
    \titleformat*{\section}{ \center \large \bf}
    \titleformat*{\subsection}{\bf} 
    \titleformat*{\subsubsection}{\it} 

Is this a problem with Overleaf or have I done something wrong?

Edit: there are no errors, not even "font not found", just no changes...

3
  • 1
    Welcome to TeX.SE! Did you ask the support of overleaf? They should know ...
    – Mensch
    May 29, 2019 at 9:14
  • titlesec doesn't use \sectionfonts directly, so you'll need to actually call it in your \titleformat perhaps?
    – imnothere
    May 29, 2019 at 9:28
  • unrelated but note that \center should never be used as a command form, I think you intended \centering` May 29, 2019 at 9:40

2 Answers 2

1

You are using the deprecated font commands such as \bf they will always use the document default encoding and family, they do not combine in the way that latex2e font commands do

Presumably you want something like

\titleformat*{\section}{\centering\sectionfonts\large\bfseries}
1

I think I found a solution: I just need to define a fontfamily separately and then call this inside \titelformat* as @LianTze Lim was suggesting, i.e:

\newfontfamily\headingfont[]{Alexander} 
 \titleformat{\section}{\headingfont \centering \large\bfseries}{\S \thesection.}{0.5em}{}[{\titlerule[0.2pt]}]

(the last parts are irrelevant). Thanks also to @DavidCarlisle, although I admit I haven't checked this :)

You must log in to answer this question.

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