i am writing thesis and need to have separate font (Calibri-like) for title page. How to change font family (for example, to "Allerta") for one page only?
1 Answers
As far as I understand your issue, you want to be able to use any font, not only the fonts provided with the default TeX distribution.
You can easily achieve this by loading the fontspec package and using XeLaTeX as your compiler. You can now download the fonts you like from places like Google Fonts, DaFont, and others and add the font files to your project. In the example below, I downloaded the Roboto font from Google Fonts and added the files into a fonts/ directory in my project.
\documentclass{article}
\usepackage{fontspec}
\usepackage{lipsum}
\newfontfamily{\mycustomfont}{Roboto}[
Path = fonts/,
Extension = .ttf,
UprightFont = -Regular,
BoldFont = -Bold,
ItalicFont = -Italic,
BoldItalicFont = -BoldItalic
]
\begin{document}
\section{Introduction}
\lipsum[1]
{\mycustomfont \lipsum[1]}
\lipsum[1]
\end{document}
Note that you could use the Calibri font if you have it installed on your system. Just make sure that you have the correct licenses to use the font. All you need to do is to add the absolute path to the fonts directory on your machine to the Path = <path> entry inside the \newfontfamily command.
- 2,958
The next question is where to find font codes?
– Jonas Klimantavicius Nov 05 '20 at 09:36\newfontfamily\allerta{in Fontspec, you can write\clearpage\allerta ...\clearpage\normalfont. If you wanted things like the header and footer to also change font, that would be slightly more complicated. – Davislor Nov 05 '20 at 17:57