3

I want to use the Alegreya font in a book for chapter headings, but would like to use Computer Modern for the body text. The thing is, \usepackage{Alegreya} makes the default font Alegreya. To set the body font back to Computer Modern I did this:

\renewcommand\rmdefault{lmr}

The thing is, when I try to use bold font it stays in Alegreya. I would rather it not do that, so how can I set boldface font to Computer Modern?

MWE:

\documentclass{article}

\RequirePackage[utf8]{inputenc}
\RequirePackage{pifont}
\RequirePackage[T1]{fontenc}

\usepackage{Alegreya}
\renewcommand\rmdefault{lmr}

\begin{document}
\textbf{This is in Alegreya.} This is Computer Modern.
\end{document}

Output:

Output of the LaTeX code.

Thanks for your time.

1 Answer 1

3

If you use alegreya, you're changing \familydefault and changing \rmdefault cannot give you Latin Modern everywhere except in chapter titles.

If you make the simple document

\documentclass{article}
\usepackage{Alegreya}

\begin{document}

\familydefault

\end{document}

upon compiling it you will see

Alegreya-LF

That's the key for the following.

\documentclass{book}
\usepackage{sectsty}

\DeclareRobustCommand{\alegreyafont}{\fontfamily{Alegreya-LF}\selectfont}
\chapterfont{\alegreyafont}


\begin{document}

\chapter{This is in Alegreya}

This is not.

\end{document}

There are other ways to change the chapter heading, sectsty offers the simplest interface.

enter image description here

You must log in to answer this question.

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