3

After reading a bit about fonts I decided that I want to use the schola font in my document, but for some reason LaTeX (I am using TeXstudio if this is relevant) does not use this font, despite me using the commands

\fontfamily{qcs} \selectfont

I do not understand what I am doing wrong. Could you please help me? Below you can see the preamble of my document with a sample text that replicates the problem on my PC.

\documentclass[a4paper, 11pt]{book}

\fontfamily{qcs}
\selectfont


\usepackage[a4paper,left=3cm,right=3cm,top=3cm,bottom=3cm]{geometry}




\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{amsthm}
\usepackage[style=numeric,sorting=none]{biblatex}
\usepackage{clrscode}
\usepackage{enumitem}
\usepackage{etoolbox}
\usepackage{fancyhdr}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage[utf8]{inputenc}
\usepackage{latexsym}
\usepackage{lmodern}
\usepackage{mathtools}
\usepackage{mdframed}
\usepackage{pgf}
\usepackage{tcolorbox}
\usepackage{tikz}
\usepackage{tikzpeople}
\usepackage{titlesec}
\usepackage[absolute,overlay]{textpos}
\usepackage{xcolor}

%\usepackage[babel,german=guillements]{csquotes}
%\addbibresource{library.bib}
%\bibliographystyle{unsrt}
%\bibliography{library.bib}    


\titleformat{\chapter}{\bfseries \centering}{\huge \Roman{chapter}.}{10pt}{\huge}

\usetikzlibrary{arrows}
\usetikzlibrary{positioning} 
\usetikzlibrary{shapes.multipart}
\usetikzlibrary{shapes.geometric}

\tikzstyle{process} = [rectangle, minimum width=5cm, text width=5cm, minimum height=1cm, draw=black]
\tikzstyle{arrow} = [thick,->,>=stealth]

\DeclareGraphicsExtensions{.pdf,.png,.jpg, .tif}

\pagestyle{fancy}
\fancyhf{}
\renewcommand{\headrulewidth}{0pt}
\fancyfoot[LE,RO]{\thepage}
\renewcommand{\familydefault}{\sfdefault}



\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}
\DeclarePairedDelimiter\ceil{\lceil}{\rceil}
\DeclarePairedDelimiter\floor{\lfloor}{\rfloor}
\definecolor{darkspringgreen}{rgb}{0.09, 0.45, 0.27}
\definecolor{egyptianblue}{rgb}{0.06, 0.2, 0.65}
\definecolor{amber}{rgb}{1.0, 0.49, 0.0}
\definecolor{byzantine}{rgb}{0.74, 0.2, 0.64}
\definecolor{royalazure}{rgb}{0.0, 0.22, 0.66}
\definecolor{darkpastelgreen}{rgb}{0.01, 0.75, 0.24}
\definecolor{ashgrey}{rgb}{0.7, 0.75, 0.71}

\tcbuselibrary{theorems}

\newtcbtheorem[number within=section]{definition}{Definition}
{colback=blue!25,colframe=blue!25!black,fonttitle=\bfseries}{th}  

\newtcbtheorem[number within=section]{lemma}{Lemma}
{colback=blue!25,colframe=blue!25!black,fonttitle=\bfseries}{th}  

\newtcbtheorem[number within=section]{theorem}{Theorem}
{colback=blue!25,colframe=blue!25!black,fonttitle=\bfseries}{th}

\newtcbtheorem[number within=section]{corollary}{Corollary}
{colback=blue!25,colframe=blue!25!black,fonttitle=\bfseries}{th}



\newtheorem{assumption}{Assumption}
\newtheorem*{example*}{Example}
\newtheorem{reminder}{Reminder}


\newcommand{\jacobi}[2]{\genfrac{(}{)}{}{}{#1}{#2}}
\newcommand{\JNM}{\mathcal{J}_n^{-1}}
\newcommand{\JNP}{\mathcal{J}_n^{+1}}
\newcommand{\legendre}[2]{\genfrac{(}{)}{}{}{#1}{#2}}
\newcommand{\norm}[1]{\| {#1} \|}
\newcommand{\QR}[1][n]{\mathcal{QR}_{#1}}
\newcommand{\QNR}[1][n]{\mathcal{QNR}_{#1}}
\newcommand{\PSQR}[1][n]{\mathcal{PSQR}_{#1}}
\newcommand{\SQRT}[2]{\mathcal{SQRT}_{#2} {(#1)}}
\newcommand{\ZNZ}[1][n]{\mathbb{Z}/{#1}\mathbb{Z}}
\newcommand{\ZNZX}[1][n]{(\mathbb{Z}/{#1}\mathbb{Z})^\times}


\begin{document}
    
This document is a sample document to 
test font families and font typefaces.

\end{document}
5
  • 2
    you are selecting a font but not changing the document defaults and the default font is selected at \begin{document} Commented Jun 11, 2020 at 14:35
  • 2
    That's not the right way to set the main document font. You might use \renewcommand{\familydefault}{qcs}, but you'll get a not matching math font.
    – egreg
    Commented Jun 11, 2020 at 14:35
  • 2
    Please reduce your MWE, looks like there are (for the test case) a lot of useless statements and packages loaded that are not used. In this way it might be that you already see what package provokes the wrong font.
    – albert
    Commented Jun 11, 2020 at 14:35
  • 2
    I'd rather suggest \usepackage{fouriernc}\usepackage{tgschola}
    – egreg
    Commented Jun 11, 2020 at 14:37
  • Thanks a lot for all your answers, I could solve my problem thanks to you.
    – 3nondatur
    Commented Jun 11, 2020 at 16:20

2 Answers 2

5

In order to set the default font family, it's not sufficient to say

\fontfamily{<family>}\selectfont

in any place of the document. You have it in the preamble, but LaTeX always executes \normalfont at the beginning of the document environment.

The “correct” declaration is \renewcommand{\familydefault}{<family>}, but in general it's better to use font packages.

In your case, you can combine tgschola for text and fouriernc for math; the latter provides math letters compatible with New Century Schoolbook, which TeX Gyre Schola is a clone of.

The order of declarations should be

\usepackage{fouriernc}
\usepackage{tgschola}

because fouriernc chooses its own clone of New Century Schoolbook.

2

The reason is simpler than the other answers suggest. You select

\usepackage{lmodern}

after you change \fontfamily. This overwrites your font selection with Latin Modern. Change this to:

\usepackage{tgschola}

as egreg recommends. Or load fouriernc and tgschola after it if you still want Latin Modern Sans and Latin Modern Mono. If you started by copying the package list from a document template, it’s a good idea to try commenting out each package you’re not sure you need, and see if you actually do.

In the modern toolchain, you could replace most of your preamble with

\usepackage{mathtools, amsthm} % The order in which you load these matters.
\usepackage{unicode-math}
% Other packages you need, such as graphicx and xcolor.
% You can drop most of the packages, including latexsym,
% amssymb, fontenc, inputenc, amsfonts and lmodern.

\setmainfont{TeX Gyre Schola}
\setmathfont{TeX Gyre Schola Math}

This will use the modern OpenType versions of the fonts.

1
  • I notice I got a downvote. I’d appreciate hearing how my answer could be improved.
    – Davislor
    Commented Jun 11, 2020 at 20:35

You must log in to answer this question.

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