This question came from our site for professional and enthusiast programmers.

I remember being bugged for this problem time ago, but forgot the result of my investigations. I kind of remember that it was an issue of font enconding, not TeX, and perhaps that changing tt font to courier solved the problem. But I can be misremembering.
–
JLDiazJul 14 '12 at 23:19

Could you add a picture of the problematic output?
–
doncherryJul 15 '12 at 10:57

Not quite related to the q., but searching for the problem led me here: Outside of verbatim, you can use \char18 and \char13 to get ` and ' characters.
–
MohanNov 20 '12 at 11:13

Reading "real apostrophe" confused me. Wikipedia had this to say about apostrophes: 'There are several types of apostrophe character in Unicode: ( ' ) Vertical typewriter apostrophe (Unicode name apostrophe or apostrophe-quote), U+0027, inherited from ASCII. ( ’ ) Punctuation apostrophe (or typographic apostrophe; right single quotation mark; single comma quotation mark), U+2019. Serves as both an apostrophe and closing single quotation mark. This is the preferred character to use for apostrophe according to the Unicode standard.' So, talk about programming only. B'marked the question though.
–
ChristianFeb 24 '13 at 22:59

Thank you. The upquote package is exactly what I was looking for.
–
Raymond HettingerJul 15 '12 at 0:04

If I understand this right, it seems using the upquote package will change all apostrophes? Yikes. That's not what I want. In most places, the slanted apostrophe looks nice for indicating derivatives, but I'd like to be able to control the occasional vertical apostrophe.
–
Travis BemroseMar 13 at 2:08

@TravisBemrose No, apostrophes will be changed only in verbatim modes.
–
egregMar 13 at 7:19

What counts as verbatim mode? Is that "regular" text, when I'm not in math mode?
–
Travis BemroseMar 31 at 16:41

1

@TravisBemrose What's in the argument of \verb, inside a verbatim environment (and also in alltt).
–
egregMar 31 at 16:42