I'm unable to get the non-curly quotation marks ('upquotes') to print inside any of the PythonTeX (v=0.14) environments. Here's my MWE:


x = 'some text'
x = 'some text'


All I'm doing to compile it is:

latex f.tex
pythontex f.tex
latex f.tex

No errors or anything show up, but I get this as output:

pythontex upquote problem

It's the same with every PythonTeX command/environment. Explicitly passing [upquote=true] to PythonTeX doesn't help either.

I'm happy to use pygments or minted or anything that will get it happening. Thanks!

  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Symbol 1 Apr 12 '15 at 3:39

Recent versions of Pygments hard-code quotes in a way that breaks upquote compatibility. I opened an issue at the Pygments site regarding this some time ago, but it hasn't yet been addressed.

In the meantime, you can patch the faulty Pygments code by adding the following to your preamble.


This assumes that you are using the default style. If not, then substitute \PYG<style>Zsq.

The most recent version of minted (which I also maintain) automatically detects and patches the faulty Pygments code. The next version of pythontex will contain the same patching code if Pygments isn't fixed before then.

  • Works perfectly! Thanks. I actually have another PythonTeX question for you! I haven't had any luck with --verbose. I just get 'This is PythonTeX 0.14', and errors/warnings. I'd love to have some indication of how far along the compilation is. Also, are you going to TUG in Darmstadt, because I so owe you a beer. – interro_gator Apr 13 '15 at 2:59
  • @interro_gator I don't think I'll be able to make it to the TUG meeting this year. Maybe next year. --verbose provides a little more detail about the number of sessions running, but currently doesn't give anything like a progress bar. Something like that might be a good idea, if Python's multiprocessing can be coaxed into providing the requisite information. – G. Poore Apr 13 '15 at 12:12
  • Shame about TUG! I think --verbose will suffice for now. I deleted my earlier comment about being able to display progress bars from each session, as I can see how multiprocessing would make this sort of impossible to do well. But I suppose a simple Doing session x of y would be pretty awesome, as my thesis now takes about an hour to compile! At present I just open up the .out files and watch the progress bar get printed in there. One other thing, a long shot: have you heard of anybody who has written a syntax highlighter (e.g. for Sublime Text) for TeX+PythonTeX? I came up empty there. – interro_gator Apr 13 '15 at 23:01
  • @interro_gator I'm not aware of any syntax highlighting. That would definitely be useful. – G. Poore Apr 14 '15 at 2:22
  • Alright. I'll probably try to make one soon, and will let you know where to get it, in case others want it. Currently all my strings are highlighted as illegal TeX, which isn't good. Thanks again for all your hard work on PythonTeX! – interro_gator Apr 14 '15 at 7:53

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.