# curly apostrophes in fancyvrb verbatim environments

I am actually using the fancyvrb package to have verbatim environments with working commands inside. I am also using the cmun.ttf font (computer modern unicode font), with XeTeX.

When I am using this font without verbatim environment, I have the good one curly apostrophe (’) (U+2019, ou U+02BC).

But, in fancyvrb verbatim environment, of course, I don't have them, but the typewriter one (').

How could I set the curly one as variant for the straight one automatically for verbatim environments ?

\documentclass[9pt]{report}
\usepackage{fontspec, fancyvrb}
\setmainfont{cmun} %what you want MONO font
\DefineVerbatimEnvironment{VRB}{Verbatim}{commandchars=\\\{\}}
\begin{document}
\begin{VRB}
J'écris en \emph{français}.
\end{VRB}
\end{document}

• Have a look at the upquote package. I can't try it since I don't have your fonts. Dec 16 '16 at 19:40

You need to set the mono font, otherwise you get the default Latin Modern without “TeX ligatures”. However, usually ligatures (and curly quotes) are not wanted in typewriter type.

\documentclass{report}
\usepackage{fontspec, fancyvrb}
\setmainfont{CMU Serif}
\setmonofont{CMU Typewriter Text}[Ligatures=TeX]

\DefineVerbatimEnvironment{VRB}{Verbatim}{commandchars=\\\{\}}

\begin{document}

J'écris en \emph{français}.

\begin{VRB}
J'écris en \emph{français}.
\end{VRB}

\end{document}


• Great, I just needed to add the Ligatures=TeX. But as you said, it is not wanted usually in typewriter type. Actually, I just need it for one of my Verbatim Environment. For another, I need the standard mono font (so without curly apostrophes). So I looked for the fontfamily option of fancyvrb, but I don't know how to define the same mono font without ligature option). Dec 17 '16 at 21:32