I am trying to use \fontfamily command to insert specific kinds of fonts for specific contents in my document. Also, using the command \renewcommand{\ttdefault}{<Font Name>} does not seem to work either. The commands are relatively simple and I basically just want to change font families. Could this be due to compatibility issues with some of my packages?

Here is a sample of what I get:

enter image description here

My source code:


    % !TeX program = xelatex



    \setmainfont{TeX Gyre Adventor}


    \usepackage{amssymb, amsfonts}













    \usepackage[autostyle, english = american]{csquotes}

    \usepackage[perpage, multiple, stable]{footmisc}











        \renewcommand{\amname}{ AM}
        \renewcommand{\pmname}{ PM}
        \newdateformat{usvardate}{\monthname[\THEMONTH] \ordinaldate{\THEDAY}, \THEYEAR}


\centering \section*{ECE 331 - Exam 1 Pitfall Notes}

\textbf{\today \mbox{ }- \currenttime}


\texttt{Note that typewriter command $\backslash$texttt does not really change the font}

{\myfont This text is also supposed to be in Courier format}

OK guys. In what follows, I will provide you with a some notes about your pitfalls, why they are pitfalls and how to avoid or rectify them.

\paragraph{Area Conversion.} I \strong{noted that many} of you make mistakes when converting from $cm^{2}$ to $m^{2}$. When doing  conversion of areas from one unit to another, the original unit is scaled \emph{twice}. Hence, converting from $cm^{2}$ to $m^{2}$ requires that you divide over $100$ two times. For instance, $30 \thickspace cm^{2} = \frac{30}{100\times100} \thickspace m^{2} \Rightarrow 30 \thickspace cm^{2} =  0.003 \thickspace m^{2}$.

\paragraph{Neglecting Air Gap in Iron Cores.} The relative permeability of iron can be thousands of times that of air ($\mu_{r} = 2000-100,000$), which means that the reluctance of the air gap $\displaystyle \mathcal{R}_{g} = \frac{l_{g}}{\mu_{\note} A_{g}}$ would be much more than the reluctance of the core $\displaystyle \mathcal{R}_{c} = \frac{l_{c}}{\mu_{r}\mu_{\note} A_{c}}$. Hence, significant error would definitely result in if you did not take into account the air gap in magnetic~circuits.


\textit{\Large All the best,}


\emph{\Large Al-Motasem Aldaoudeyeh}

  • Off-topic: cleveref should be loaded as last package here
    – user31729
    Mar 25, 2018 at 10:20
  • do not use \usepackage[T1]{fontenc} with xetex Mar 25, 2018 at 10:20
  • you have only declared the main font using fontspec interfaces you need to also declare the monospace font Mar 25, 2018 at 10:21
  • And you should use siunitx to display the units
    – user31729
    Mar 25, 2018 at 10:28
  • Thanks for the comments, Christian. @DavidCarlisle Removing fontenc package is not helping. Mar 25, 2018 at 10:29

1 Answer 1


You can't use arbitrary names as fontfamily. They must be declared first. With fontspec you can do it with NFSSFamily, but can also simply define new font families.



   \setmainfont{TeX Gyre Adventor}
   \setmonofont{TeX Gyre Cursor} 
   \newfontfamily\verbatimfont{DejaVu Sans Mono}[NFSSFamily=dejamono]


standard text

{\ttfamily courier}

{\fontfamily{dejamono}\selectfont DejaVu Sans Mono} is then equivalent to 
{\verbatimfont DejaVu}

enter image description here

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.