# Overleaf and Section Fonts

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...

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

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}


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}
`