Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In minted's default style, as well as a few others (emacs for instance), comments and other stuff like C preprocessor commands show up in a very un-code-like italic font, as shown in the 2 examples below.

I'm using this environment:

\newminted[cpp]{cpp}{frame=lines,framesep=2mm}

How could I change the font to a more console-like one? I tried playing with the fontfamily or fontseries minted options, but I didn't seem to get anywhere with that (I don't know what values to give to them aside from the ones that minted.pdf states they support, and even those seem to either not do anything or break the code completely).

My configuration is Mac OS X Lion, using Latexian as editor, and latest TexLive from MacPorts - versions shown below.

texlive-latex @23089_0+doc
texlive-bin @2011_3+motif+x11

weird font in comments and preprocessor commands

weird font in comments

share|improve this question

migrated from stackoverflow.com Nov 21 '11 at 19:35

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

    
You should try fontfamily=tt,fontshape=\upshape for upright typewriter font. –  Werner Nov 21 '11 at 18:29
    
I tried changing my minted definition to \newminted[cpp]{cpp}{fontfamily=tt,fontshape=\upshape,frame=lines,framesep=2mm}‌​, but when compiling this in Latexian, pdftex hangs on 100% cpu while waiting for the .pyg output. If I remove fontshape=\upshape, it doesn't hang but it looks the same. –  Dan Nov 21 '11 at 21:05
    
Could you include a minimal working example (MWE) with some code that you want to change the formatting of? –  Werner Nov 21 '11 at 21:16
add comment

1 Answer

up vote 1 down vote accepted

Two things:

  1. the font is “console-like” (that is, monospaced); it just happens to be also italic – which, by the way, is a completely valid formatting style and not that unusual (I usually use such a styling).

  2. The italic formatting for comments is supplied by the Pygments style sheet, which supersedes the general font setting (since it’s more specific). In order to change it, you need to create and register an own stylesheet.

share|improve this answer
    
Thanks! Yeah, I agree it is indeed monospaced, but personally I find it so much harder to read, probably because of the curliness of that specific font than the italics themselves. –  Dan Apr 1 '13 at 15:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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