2

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
    Often one makes the title page inside a special environment (you show now code, so I have no idea what you are actually doing). Since envs form groups, any changes to fonts etc inside this env stays inside this env. – daleif Nov 05 '20 at 09:13
  • Welcome to TeX.SX! This question is very similar to https://tex.stackexchange.com/q/25249/117727. Please take a look at it as the information there might help you. If so, that's great, and we'll probably close this question as a duplicate just to keep the place tidy and to help people find answers quickly. If not, please edit your question here to explain why so that people can better focus their attention to help you. – Sam Nov 05 '20 at 09:17
  • 5
  • I tried this and it seems to work: {\fontfamily{qcr}\selectfont VILNIUS}

    The next question is where to find font codes?

    – Jonas Klimantavicius Nov 05 '20 at 09:36
  • What do you mean by "font codes"? – Sam Nov 05 '20 at 09:47
  • I ment Family -> Font Name. I have alrady found this list: https://tex.stackexchange.com/questions/25249/how-do-i-use-a-particular-font-for-a-small-section-of-text-in-my-document May be the is moe extensive list to find "Windows Calibri" analog? – Jonas Klimantavicius Nov 05 '20 at 09:51
  • If you’ve set up a command to use your font, such as completing the command \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
  • I’m not completely sure what you’re asking, though. Could you give a brief example? – Davislor Nov 05 '20 at 17:59
  • @JonasKlimantavicius If you like my answer and it was helpful, please consider upvoting (by clicking on the arrows next to the score) and/or marking it as the accepted answer (by clicking on the checkmark ✓). – Sam Nov 09 '20 at 15:11

1 Answers1

0

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.

Sam
  • 2,958