I would like to use a serif font for both the body of my text and maths environments as well as a separate monospaced font for things like URLs.
When I compile this using fontspec
:
\documentclass[12pt,a4paper]{article}
\usepackage[hidelinks]{hyperref}
\usepackage{fontspec}
\setmainfont{Times New Roman}
\setmonofont{Courier New}
\begin{document}
\noindent See the following article on Wikipedia about the year AD 2017:
\url{https://en.wikipedia.org/wiki/2017}
$2000 + 17 = 2017$
\end{document}
I get:
Which does not use the right maths font. Unsurprisingly, I get the same thing by just replacing fontspec
with mathspec
). But when I add \setmathsfont{Times New Roman}
using mathspec
, I still get the same result.
And when I compile:
\documentclass[12pt,a4paper]{article}
\usepackage[hidelinks]{hyperref}
\usepackage{mathspec}
\setallmainfonts{Times New Roman}
\setallmonofonts{Courier New}
\begin{document}
\noindent See the following article on Wikipedia about the year AD 2017:
\url{https://en.wikipedia.org/wiki/2017}
$2000 + 17 = 2017$
\end{document}
I get:
Which changes the maths environment to the desired font but changes the numbers in the given URL to serif rather than monospaced, which is undesirable.
Does anyone have idea where I'm going wrong and how I can get something that looks like this:
unicode-math
and its\setmathfont
(in combination withfontspec
)? – TeXnician Apr 17 '17 at 14:05