[XeTeX] using open type fonts for fancyvrb verbatim environments

Ed Morehouse emorehouse at wesleyan.edu
Thu Mar 10 15:40:12 CET 2011

I'm trying to use an OTF font for text within a fancyvrb Verbatim environment
but can't figure out how to make it work.  Here's a small example to give an
idea of what I'm trying to do:

\newfontfamily \codefont{XITS Math}

    ∀ α ∈ ℕ . ∃ β ∈ ℕ . β > α

This produces the warning:

LaTeX Font Warning: Font shape `EU1/codefont/m/n' undefined
(Font)              using `EU1/lmr/m/n' instead on input line 7.

[1] (./minimal.aux)

LaTeX Font Warning: Some font shapes were not available, defaults substituted.

I also tried using "XITSMath" directly as the fontfamily argument, to no avail.
 I get the impression that fontspec and fancyvrb have different ideas of what a
font family is.

In general, fancyvrb seems to do okay with Unicode, and if I add
"\setmonofont{XITS Math}" to the preamble and leave away the fontfamily argument
to the \Verbatim environment, the text renders properly.  The only problem with
this is that I don't want all verbatim text in XITS Math font, just

I'm running XeLaTeX and all packages from TeXLive-2010 (MacTeX).

Any ideas?

-Ed Morehouse

More information about the XeTeX mailing list