2

I'm trying to change the font of my chapter titles and subsections but none of the examples online are working for me. Here is my current code and the typesetting it generates. How do I change the font of the title and subsections? E.g., I want set the title and subsection fonts to Arial to keep the body font as Palatino.

\documentclass[12pt]{memoir}
\usepackage{fontspec}\setmainfont{Palatino}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{csquotes}
\usepackage{endnotes}
\usepackage{imakeidx}\makeindex[columns=3, title=Alphabetical Index]
\usepackage[
    backend=biber,
    style=authortitle,
    citestyle=authortitle
]{biblatex}\addbibresource{sample.bib}
\usepackage[explicit]{titlesec}
\titleformat{\chapter}[display]{\bfseries\centering}{\huge\thechapter}{1em}{\Huge #1}

\begin{document}

\setlength{\bibhang}{0pt}
\setlength\bibitemsep{\baselineskip}

\frontmatter
\maketitle
\tableofcontents

\mainmatter
\include{./TeX_files/introduction}
\include{./TeX_files/chapter01}

\theendnotes
\printbibliography

\backmatter
\printindex

\end{document}

enter image description here

1
  • Use the titlesec package. It explains on page 4. Feb 4, 2023 at 19:03

1 Answer 1

1

I've changed the chapter and subsection titles to Arial via the titlesec and fontspec packages. I've also commented out some code so that the code works on my machine.

\documentclass[12pt]{memoir}
\usepackage{blindtext}
\usepackage{fontspec}
\setmainfont{TeX Gyre Pagella}%I don't have Palatino.
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{csquotes}
%\usepackage{endnotes}
\usepackage{imakeidx}\makeindex[columns=3, title=Alphabetical Index]
\usepackage[
    backend=biber,
    style=authortitle,
    citestyle=authortitle
]{biblatex}\addbibresource{sample.bib}
\usepackage[explicit]{titlesec}
\newfontfamily{\arialfont}{Arial Nova}
\titleformat{\chapter}%
    [display]%
    {%
        \bfseries%
        \centering%
        \arialfont%
    }%
    {\huge\thechapter}%
    {1em}%
    {\Huge #1}
\titleformat{\subsection}
    [display]
    {%
        \bfseries%
        \arialfont%
    }
    {\thesubsubsection}
    {}
    {#1}
\title{Title}
\author{Author}
\begin{document}

\setlength{\bibhang}{0pt}
\setlength\bibitemsep{\baselineskip}

\frontmatter
\maketitle
\tableofcontents

\mainmatter
%\include{./TeX_files/introduction}
%\include{./TeX_files/chapter01}
\blinddocument

%\theendnotes
%\printbibliography

\backmatter
\printindex

\end{document}
1
  • 1
    Perfect. Thanks @User23456234 Feb 4, 2023 at 21:58

You must log in to answer this question.

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