1

First of all I'm an absolute noob(I can't stress this enough, this is my second week of using latex).

I don't have any idea about the differences between the different compilers, but xelatex seems to be way better than pdflatex and so on. Not very relevant to me since I'm using overleaf.

Anyways, I'll dump my code here and the pdf it produces.

\documentclass[12pt]{article}
\usepackage{fontspec}
% Main font
\setmainfont[
BoldFont=MinionPro-bold.otf,
ItalicFont=MinionPro-it.otf,
BoldItalicFont=MyriadPro-Regular.otf
]{MinionPro-Regular.otf}
% Sans serif: Akin to Arial
\setsansfont[
BoldFont=MyriadPro-Regular.otf,
ItalicFont=MyriadPro-Regular.otf,
BoldItalicFont=MyriadPro-Regular.otf
]{MyriadPro-Regular.otf}


\title{{\sffamily The title of the article}} 
\author{{\sffamily Hubert Farnsworth}}
\date{{\sffamily this month, 2014}}

\begin{document}

\maketitle

This an \textit{example} of a document compiled with \textbf{xelatex} compiler. 
Various elements in this book are specially formatted for \textbf{\textit{bold italic}} identification while
reading.
The title and chapter headigns are always in {\sffamily MyriadPro}, and the main font is in \textbf{MinionPro}.\par

Variables in the text are printed in bold. Each section ends in a brief summary,
indicating the key points.
\end{document}

As you can see, I have no idea how to change the default title, chapter, subchapter, index, etc.. font.

enter image description here

I wanted the titles in a specific sans serif (Myriad Pro), since it seems to be the font that my university is using for titles. So I uploaded my .otf to overleaf, instead of using their fonts.

But this seems dumb, having to specify IN EVERY TITLE OR CHAPTER that I want my font to be Myriad Pro, because if I forget to do that, it reverts to latin modern roman.

What is the smart way of doing this ?

1

For chapters, sections, &c., titles , you can load titlesec and add declarations such as

\titleformat*{\chapter}{\sffamily}

to your preamble (see §2, Quick reference, in the documentation. For more sophisticates needs, you may have to use the Advanced interface.

Title, author, date of a document are the just obtained with declarations in the preamble, like:

\title{My Funny Title}
\author{I. Ego}

and invoking the \maketitle command at the beginning of the document. The layout of titles can easily be customised with the titling package.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.