0

I try to change my main font style in a Tufte book document class. Documentation say that it's possible by using the nofonts class option but nothing works. I tried the \setmainfont function, and other tricky solutions, without result. Here are my packages:

\documentclass[11pt, justified]{tufte-handout}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
  \setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio}
  \graphicspath{{graphics/}}
\usepackage{lmodern}
\usepackage{amsmath, amssymb, amsfonts, euscript}
\usepackage{mathabx, mathrsfs, mathptmx}
\usepackage{booktabs}
\usepackage{units}
\usepackage{multicol}
\usepackage{lipsum}
\usepackage{fancyvrb}
\fvset{fontsize=\normalsize}
\usepackage[frenchb]{babel}
\usepackage{titlesec}
\usepackage{bibentry}
\usepackage{xcolor}
\usepackage{enumerate}
\usepackage{enumitem}
\usepackage{microtype}
\usepackage{todonotes}
\usepackage{fontawesome}
\usepackage{listings}
\usepackage{geometry}
\usepackage{theorem}
\usepackage{fancyhdr}
\usepackage[most]{tcolorbox}
\usepackage[framemethod=TikZ]{mdframed}
\usepackage{ifthen}
\usepackage{tikz}

\usetikzlibrary{shadows}
\lstset{language=C}

Thanks for your help.

MWE:

Here is a minimal code of what I'm trying to do, remember that I just want to change the text fond of my document.

\documentclass[nofonts, justified]{tufte-handout}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{amsmath, amssymb, amsfonts}
\usepackage{mathabx, mathrsfs, mathptmx}
\usepackage{booktabs}
\usepackage{units}
\usepackage{multicol}
\usepackage{fancyvrb}
\usepackage{titlesec}
\usepackage{bibentry}
\usepackage{xcolor}
\usepackage{enumitem}
\usepackage{microtype}
\usepackage{todonotes}
\usepackage{listings}
\usepackage{theorem}
\usepackage{fancyhdr}
\usepackage[most]{tcolorbox}
\usepackage{ifthen}
\usepackage{tikz}

%-----------For test-----------------------------------
\usepackage{lipsum}
%------------------------------------------------------

\setkeys{Gin}{width=\linewidth,totalheight=\textheight,keepaspectratio}
\graphicspath{{graphics/}}
\usetikzlibrary{shadows}
\lstset{language=C}

%=======================================================
%                       COLORS
%=======================================================
\definecolor{grey}{rgb}{0.9,0.9,0.9}

%=======================================================
%                  TITLES OPTIONS
%=======================================================
\titleformat*{\section}{\fontfamily{pag}\selectfont\huge\bfseries}
\titleformat*{\subsection}{\fontfamily{pag}\selectfont\LARGE\bfseries}
\titleformat*{\subsubsection}{\large\bfseries}
\titleformat*{\paragraph}{\large\bfseries}
\titleformat*{\subparagraph}{\large\bfseries}

\titlespacing{\section}{0pt}{*0}{*0}
\titlespacing{\subsection}{0pt}{*0}{*0}
\titlespacing{\subsubsection}{0pt}{*0}{*0}
\titlespacing{\paragraph}{0pt}{*2}{*2}

\renewcommand{\thesubsubsection}{\thesection.\thesubsection\alph{subsubsection}}


\title{Test - tex.stackexchange.com}
\author[The Author]{The author}


%=======================================================
%                        MACROS
%=======================================================
\newcommand{\doccmd}[1]{\texttt{\textbackslash#1}}
\newcommand{\docopt}[1]{\ensuremath{\langle}\textrm{\textit{#1}}\ensuremath{\rangle}}
\newcommand{\docarg}[1]{\textrm{\textit{#1}}}
\newcommand{\docenv}[1]{\textsf{#1}}
\newcommand{\docpkg}[1]{\texttt{#1}}
\newcommand{\doccls}[1]{\texttt{#1}}
\newcommand{\docclsopt}[1]{\texttt{#1}}
\renewcommand{\rmdefault}{pplx}

\newcommand{\etal}{\textit{et al}.}
\newcommand{\ie}{\textbf{\textit{i}.\textit{e}. }}
\newcommand{\eg}{\textbf{\textit{e}.\textit{g}. }}
\newcommand{\cfr}{\textit{cfr}. }

\geometry{
  left=15mm,
  textwidth=140mm,
  headsep=10mm,
  headheight = 0mm,
  marginparsep=7mm,
  marginparwidth=50mm,
  bottom = 1.5cm, 
  top = 1.7cm
}

%=======================================================
%                    HEADER/FOOTER
%=======================================================
\pagestyle{fancy}{
\fancyhf{}
\rhead{The Author}
\lhead{TEST - tex.stackexchange.com}
\rfoot{Page \thepage}
}

%=======================================================
%                      DOCUMENT
%=======================================================
\begin{document}

%---------------------------------------------------------------
\begin{titlepage}
    \fontfamily{pag}
    \begin{center}
        \noindent\begin{minipage}{1\textwidth}
            \includegraphics[draft]{example-image}
        \end{minipage}
    \end{center}
    \vfill
    \centering
    \colorbox{grey}{
        \parbox[t]{1.2\textwidth}{
            \parbox[t]{1.2\textwidth}{
                \vspace{0.2cm}
                \begin{center}
                \fontsize{13pt}{0pt}\selectfont
                \text{TEST - tex.stackexchange.com}\\
                \fontsize{50pt}{0pt}\selectfont\bfseries
                \vspace{0.3cm}\underline{Base project}\end{center} {\Huge2019}
                \vspace{0.7cm}
            }
        }
    }

    \vfill
    %------------------------------------------------
    %   Author name and informations
    %------------------------------------------------

    \parbox[t]{1.2\textwidth}{
        \raggedleft
        \large
        {\Large Author}\\[4pt]
        University\\
        \hfill\rule{0.2\linewidth}{1pt}
    }

\end{titlepage}
%---------------------------------------------------------------

\renewcommand{\headrulewidth}{1pt}

\section{Chapter 1:}
\lipsum[2]
\lipsum[3]

\begin{marginfigure}
\lipsum[1]
\end{marginfigure}
\end{document}
  • Welcome to TeX.SX! You are already loading a bunch of font packages. Are you sure you need all those packages you have listed? – TeXnician Feb 15 at 12:54
  • Yes most of them but I admit that I rather complete my package list as I write than to try to group them together. I'd already delete fontawesome, babel and euscript. – Guilian Deflandre Feb 15 at 13:50
  • 1
    It's also questionable whether you should use geometry with tufte, whether you need enumitem and enumerate, whether you really want to use mdframed if you are already using tcolorbox, whether you need lipsum for a production document etc. It will help us help you if you could make your code example a MWE (minimal compilable working example). – TeXnician Feb 15 at 14:24
  • @TeXnician, you will find it in answers below. – Guilian Deflandre Feb 15 at 15:12
  • 1
    Next time, please use the edit button of your post. Did you try removing \renewcommand{\rmdefault}{pplx} and then loading a package changing the font? That should work as expected (btw. you should not have a \fontfamily{pag} without \selectfont and maybe remove it to see changes made by font packages)… – TeXnician Feb 15 at 15:16
2

The problem with your code was, that you were overriding any font settings in the preamble by explicitly selecting fonts with commands like \renewcommand{\rmdefault}{pplx}.

After removing all the explicit font selections and several other things that dindn't spark joy from your code you can now use a font of your choosing. I tried the Linux Libertine and Biolinum Fonts with \usepackage{libertine}:

\documentclass[nobib,nofonts,justified]{tufte-handout}
\usepackage{graphicx}
\usepackage{microtype}


\usepackage{libertine} % <-- Here



%-----------For test-----------------------------------
\usepackage{lipsum}
%------------------------------------------------------
%                  TITLES OPTIONS
%=======================================================
\titleformat*{\section}{\huge\bfseries}
\titleformat*{\subsection}{\LARGE\bfseries}
\titleformat*{\subsubsection}{\large\bfseries}
\titleformat*{\paragraph}{\large\bfseries}
\titleformat*{\subparagraph}{\large\bfseries}

\titlespacing{\section}{0pt}{*0}{*0}
\titlespacing{\subsection}{0pt}{*0}{*0}
\titlespacing{\subsubsection}{0pt}{*0}{*0}
\titlespacing{\paragraph}{0pt}{*2}{*2}

\renewcommand{\thesubsubsection}{\thesection.\thesubsection\alph{subsubsection}}


\title{Test - tex.stackexchange.com}
\author[The Author]{The author}


%=======================================================
%                      DOCUMENT
%=======================================================
\begin{document}

%---------------------------------------------------------------
\begin{titlepage}
    \begin{center}
        \noindent\begin{minipage}{1\textwidth}
            \includegraphics[draft]{example-image}
        \end{minipage}
    \end{center}
    \vfill
    \centering
    \colorbox{gray}{
        \parbox[t]{1.2\textwidth}{
            \parbox[t]{1.2\textwidth}{
                \vspace{0.2cm}
                \begin{center}
                \fontsize{13pt}{0pt}\selectfont
                TEST - tex.stackexchange.com\\
                \fontsize{50pt}{0pt}\selectfont\bfseries
                \vspace{0.3cm}\underline{Base project}\end{center} {\Huge2019}
                \vspace{0.7cm}
            }
        }
    }

    \vfill

    %------------------------------------------------
    %   Author name and informations
    %------------------------------------------------

    \parbox[t]{1.2\textwidth}{
        \raggedleft
        \large
        {\Large Author}\\[4pt]
        University\\
        \hfill\rule{0.2\linewidth}{1pt}
    }

\end{titlepage}
%---------------------------------------------------------------

\renewcommand{\headrulewidth}{1pt}

\section{Chapter 1:}
\lipsum[2]
\lipsum[3]

\begin{marginfigure}
\lipsum[1]
\end{marginfigure}
\end{document}

pdffonts shows, that no other fonts were loaded:

name                                 type              encoding         emb sub uni object ID
------------------------------------ ----------------- ---------------- --- --- --- ---------
QFROIV+LinLibertineMT                Type 1            Custom           yes yes no      13  0
GYBFUK+LinLibertineT                 Type 1            Custom           yes yes no      14  0
AWSGUC+LinLibertineTB                Type 1            Custom           yes yes no      15  0
GYBFUK+LinLibertineT                 Type 1            Custom           yes yes no      21  0
0

Welcome to this group...

You didn't mention the font name what you want to change. By using the code \usepackage{palatino,mathpazo} able to change the main font to Palatino

  • I've also try this solution, it doesn't work either.. – Guilian Deflandre Feb 15 at 13:07
  • 1
    @GuilianDeflandre Then, confirm what type of TeX engine you are using, e.g., MikTeX, LuaLaTeX, XeLaTeX, etc. – MadyYuvi Feb 15 at 13:56
  • @MadyYuvi You should not recommend using palatino (see l2tabu for an explanation). And MikTeX is no TeX engine but a TeX distribution. – TeXnician Feb 15 at 14:25
  • @MadyYuvi pdfLaTex on OverLeaf mainly. – Guilian Deflandre Feb 15 at 14:45

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.