1

I'm using overleaf and trying to get the body to use the serif version of Alegreya, but the titles and headings to use the sans. Quite a few questions about this, but didn't find the solution. Looked at this but the answer there didn't help. The end result is that in the titles I am now getting the Sans of Computer Modern. Where do I specify that Alegreya Sans is the \sffamily that the sectsty-package should use? Or is there another way to achieve my goal?

\documentclass{book}
\usepackage[utf8]{inputenc}


\title{test}
\author{name}
\date{now}

\usepackage{sectsty}

\usepackage[T1]{fontenc}
\usepackage{Alegreya} %% Option 'black' gives heavier bold face
\renewcommand*\oldstylenums[1]{{\AlegreyaOsF #1}}

\allsectionsfont{\normalfont\sffamily\bfseries}

\begin{document}

\chapter*{This is not Alegregya Sans!}
So here, the body text is in the font is what I would like it to be, namely Alegreya. I got there through using the fontenc package. Then I tried to use the sectsty package and the allsectionsfont command to specify that the sffamily of the font should be used. But it seems it defaulted to the Computer Modern Sans font instead...


\end{document}

sans-serif question

1 Answer 1

2

enter image description here

You need the matching package for the Sans Serif font.

\documentclass{book}
\usepackage[utf8]{inputenc}


\title{test}
\author{name}
\date{now}


\usepackage{sectsty}

\usepackage[T1]{fontenc}
\usepackage{Alegreya,AlegreyaSans} %% Option 'black' gives heavier bold face
\renewcommand*\oldstylenums[1]{{\AlegreyaOsF #1}}

\allsectionsfont{\normalfont\sffamily\bfseries}

\begin{document}

\chapter*{This is not Alegregya Sans!}
So here, the body text is in the font is what I would like it to be, namely Alegreya. I got there through using the fontenc package. Then I tried to use the sectsty package and the allsectionsfont command to specify that the sffamily of the font should be used. But it seems it defaulted to the Computer Modern Sans font instead...


\end{document}
1
  • Why that was easy. Thank you!
    – Parvana
    Nov 4, 2021 at 20:48

You must log in to answer this question.

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