I'm not able to get a mono-spaced font working when I use the fontspec
package on my OSX install of TeX Live 2016. I'm able to specify and render other fonts such as Adobe Garamond Pro and Helvetica Neue, but when I try to use Courier New for my monofont, the font that renders is not Courier or even a fixed width font; I'm pretty sure it's Computer Modern or a similar variable-width font.
Note that I get the following warning when I compile this; when I remove the fontspec
package and \setmainfont
calls, my \texttt
text shows up properly as a fixed-width font. However, the other fonts are not as I wish (Garamond, Helvetica), so I'm trying to get this working using fontspec
. I also tried \usepackage{courier}
with fontspec
but the problem persisted. I also tried using other fixed-width fonts, such as Inconsolata in my \setmonofont
call; there were no warnings (it found the font) but it still rendered Computer Modern. When I remove the \setmonofont
completely, it still does the same thing.
I found a number of SO posts related to missing fonts, but nothing with this particular issue, nor my apparent interaction with fontspec
. I frankly don't even know what EU1/pcr/m/it is, and am not sure how to debug this problem. I'd appreciate any debugging tips, as well as the solution to this problem.
LaTeX Font Warning: Font shape `EU1/pcr/m/it' undefined
(Font) using `EU1/pcr/m/n' instead on input line 85.
Here's the document:
\documentclass[12pt]{article}
\linespread{1.25}
% TODO: this is causing monofonts to break
\usepackage{fontspec}
\setromanfont{Adobe Garamond Pro}
\setsansfont{Helvetica Neue}
\setmonofont{Courier New}
%\usepackage{courier} % also tried this and it also doesn't work
\begin{document}
\textit{italics here}
\textbf{bold here}
\texttt{monospaced here code\_goes\_here}
{\ttfamily This text is using the \textbf{Andale} \textit{Mono} font}
\end{document}
Details about my latex build:
pdfTeX 3.14159265-2.6-1.40.17 (TeX Live 2016)
kpathsea version 6.2.2
Copyright 2016 Han The Thanh (pdfTeX) et al.
There is NO warranty. Redistribution of this software is
covered by the terms of both the pdfTeX copyright and
the Lesser GNU General Public License.
For more information about these matters, see the file
named COPYING and the pdfTeX source.
Primary author of pdfTeX: Han The Thanh (pdfTeX) et al.
Compiled with libpng 1.6.21; using libpng 1.6.21
Compiled with zlib 1.2.8; using zlib 1.2.8
Compiled with xpdf version 3.04
Best Answer
this works fine with
xelatex
orlualatex
: