TransWikia.com

Problems with defining font defaults in `XeLaTeX`

TeX - LaTeX Asked on February 28, 2021

I want to define a default font(Arial), a sans-serif font(also Arial), a monospace font(Roboto Mono), and a roman font(Times New Roman). Defining the latter three is okay, but introducing the main font seems to ruin the monospace font. Reordering also fails. Here are two MWEs(reordering the commands in between the two comment percent signs don’t work either):

documentclass[12pt]{article}
usepackage{fontspec}
%
setsansfont{Arial}
setromanfont{Times New Roman}
setmonofont{Roboto Mono}
setmainfont{Arial}
%

begin{document}
    noindent
    c
    {sffamily c}
    {rmfamily c}
    {ttfamily c}
end{document}

I was looking at other sources, which seemed to imply that this should work(but it fails too):

documentclass[12pt]{article}
usepackage{fontspec}
%
setsansfont{Arial}
setromanfont{Times New Roman}
setmonofont{Roboto Mono}
renewcommand{familydefault}{sfdefault}
%

begin{document}
    noindent
    c
    {sffamily c}
    {rmfamily c}
    {ttfamily c}
end{document}

PS: I would like to also change the small caps font to Helvetica, as Arial doesn’t have one. Any way to do that too?

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP