I use XeTeX with C-language code inside verbatims. The aim is that my students can perform copy/paste from the resulting PDF document into their programming IDE.

Using XeTeX is great because I can use system fonts instead of LaTeX fonts. I wanted to substitute the typewriter font to the system "Courier" font. I used : \setmonofont[Scale=MatchLowercase,Ligatures=NoCommon}{Courier}

This works great. However, single and double quotes are then replaced by tilted single and double quotes. The result is that it remains in the copy/paste code, that can no longer compile.

Is it possible to ask XeTeX or fontspec or something to use the exact kind of quote used in the verbatim instead of a tilted one ?

Regards ! Mike

  • Welcome to TeX.SX! Please post a compilable code example (MWE) that we can copy and paste to help you. – TeXnician Oct 27 '17 at 14:41
  • please edit typo NoCommon] not NoCommon} – user4686 Oct 27 '17 at 15:01
  • I can not reproduce your problem with \begin{verbatim}, (on next line) "Hello", and (on next line) \end{verbatim} and Mac OS system Courier font (which with \XeTeXtracingfonts1 one sees it finds in /System/Library/Fonts/Courier.dfont with the command \setmonofont of your post) – user4686 Oct 27 '17 at 15:03

It doesn't happen. I tried to compile the minimal document




"Hello" world 'this' is nice


with TeX Live from release 2012 to 2019/pretest and the output is always

enter image description here

If I copy from the PDF file and paste here, I get

"Hello" world 'this' is nice

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.