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.

I'm having a problem setting the font of a minted environment in a beamer frame to the particular font I want. I want the area to be in Inconsolata (or at least a monospaced font with a slash through the 0 (zero))

\documentclass{beamer}
\usepackage{minted}
\usepackage{inconsolata}
\definecolor{bg}{rgb}{0.5,0.5,0.5}
\begin{document}
\begin{frame}[fragile]
\frametitle{Example}
0123456789
\begin{minted}[frame=lines,linenos=true,gobble=2]{html}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
"http://www.w3.org/TR/html4/strict.dtd">
<html>
 <head>
  <meta http-equiv="Content-Type" 
    content="text/html; charset=UTF-8">
  <meta http-equiv="Content-Language" 
    content="en-us">
   <title>Our first web page!</title>
 </head>
 <body>
  <p>Hello World!</p>
 </body>
</html>
\end{minted}
\end{frame}
\end{document}

This compiles but does not set the font for minted area. Help! (also the background color doesn't seem to get set...)

This is the output I get.

 $ pdflatex -shell-escape foo.tex               4:55PM
 This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
  \write18 enabled.
 entering extended mode
 (./foo.tex
 LaTeX2e <2009/09/24>
 Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
 yphenation, farsi, arabic, croatian, bulgarian, ukrainian, russian, czech, slov
 ak, danish, dutch, finnish, french, basque, ngerman, german, german-x-2009-06-1
 9, ngerman-x-2009-06-19, ibycus, monogreek, greek, ancientgreek, hungarian, san
 skrit, italian, latin, latvian, lithuanian, mongolian2a, mongolian, bokmal, nyn
 orsk, romanian, irish, coptic, serbian, turkish, welsh, esperanto, uppersorbian
 , estonian, indonesian, interlingua, icelandic, kurmanji, slovenian, polish, po
 rtuguese, spanish, galician, catalan, swedish, ukenglish, pinyin, loaded.
 (/usr/share/texmf/tex/latex/beamer/base/beamer.cls
 (/usr/share/texmf/tex/latex/beamer/base/beamerbasercs.sty)
 Document Class: beamer 2010/06/21 development version 3.10 A class for typesett
 ing presentations (rcs-revision a6b1a8434d30)
 (/usr/share/texmf/tex/latex/beamer/base/beamerbasemodes.sty
 (/usr/share/texmf/tex/latex/beamer/base/beamerbasedecode.sty))
 (/usr/share/texmf/tex/latex/beamer/base/beamerbaseoptions.sty
 (/usr/share/texmf-texlive/tex/latex/graphics/keyval.sty))
 (/usr/share/texmf-texlive/tex/latex/geometry/geometry.sty
 (/usr/share/texmf-texlive/tex/generic/oberdiek/ifpdf.sty)
 (/usr/share/texmf-texlive/tex/generic/oberdiek/ifvtex.sty)
 (/usr/share/texmf-texlive/tex/xelatex/xetexconfig/geometry.cfg))
 (/usr/share/texmf-texlive/tex/latex/base/size11.clo)
 (/usr/share/texmf/tex/latex/pgf/basiclayer/pgfcore.sty
 (/usr/share/texmf-texlive/tex/latex/graphics/graphicx.sty
 (/usr/share/texmf-texlive/tex/latex/graphics/graphics.sty
 (/usr/share/texmf-texlive/tex/latex/graphics/trig.sty)
 (/etc/texmf/tex/latex/config/graphics.cfg)
 (/usr/share/texmf-texlive/tex/latex/pdftex-def/pdftex.def)))
 (/usr/share/texmf/tex/latex/pgf/systemlayer/pgfsys.sty
 (/usr/share/texmf/tex/latex/pgf/utilities/pgfrcs.sty
 (/usr/share/texmf/tex/generic/pgf/utilities/pgfutil-common.tex)
 (/usr/share/texmf/tex/generic/pgf/utilities/pgfutil-latex.def
 (/usr/share/texmf-texlive/tex/latex/ms/everyshi.sty))
 (/usr/share/texmf/tex/generic/pgf/utilities/pgfrcs.code.tex))
 (/usr/share/texmf/tex/generic/pgf/systemlayer/pgfsys.code.tex
 (/usr/share/texmf/tex/generic/pgf/utilities/pgfkeys.code.tex
 (/usr/share/texmf/tex/generic/pgf/utilities/pgfkeysfiltered.code.tex))
 (/usr/share/texmf/tex/generic/pgf/systemlayer/pgf.cfg)
 (/usr/share/texmf/tex/generic/pgf/systemlayer/pgfsys-pdftex.def
 (/usr/share/texmf/tex/generic/pgf/systemlayer/pgfsys-common-pdf.def)))
 (/usr/share/texmf/tex/generic/pgf/systemlayer/pgfsyssoftpath.code.tex)
 (/usr/share/texmf/tex/generic/pgf/systemlayer/pgfsysprotocol.code.tex))
 (/usr/share/texmf/tex/latex/xcolor/xcolor.sty
 (/etc/texmf/tex/latex/config/color.cfg))
 (/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcore.code.tex
 (/usr/share/texmf/tex/generic/pgf/math/pgfmath.code.tex
 (/usr/share/texmf/tex/generic/pgf/math/pgfmathcalc.code.tex
 (/usr/share/texmf/tex/generic/pgf/math/pgfmathutil.code.tex)
 (/usr/share/texmf/tex/generic/pgf/math/pgfmathparser.code.tex)
 (/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.code.tex
 (/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.basic.code.tex)
 (/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.trigonometric.code.tex)
 (/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.random.code.tex)
 (/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.comparison.code.tex)
 (/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.base.code.tex)
 (/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.round.code.tex)
 (/usr/share/texmf/tex/generic/pgf/math/pgfmathfunctions.misc.code.tex)))
 (/usr/share/texmf/tex/generic/pgf/math/pgfmathfloat.code.tex))
 (/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorepoints.code.tex)
 (/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorepathconstruct.code.tex)
 (/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorepathusage.code.tex)
 (/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorescopes.code.tex)
 (/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcoregraphicstate.code.tex)
 (/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcoretransformations.code.tex)
 (/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorequick.code.tex)
 (/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcoreobjects.code.tex)
 (/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorepathprocessing.code.tex)
 (/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorearrows.code.tex)
 (/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcoreshade.code.tex)
 (/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcoreimage.code.tex
 (/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcoreexternal.code.tex))
 (/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorelayers.code.tex)
 (/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcoretransparency.code.tex)
 (/usr/share/texmf/tex/generic/pgf/basiclayer/pgfcorepatterns.code.tex)))
 (/usr/share/texmf/tex/latex/pgf/utilities/xxcolor.sty)
 (/usr/share/texmf-texlive/tex/latex/hyperref/hyperref.sty
 (/usr/share/texmf-texlive/tex/generic/ifxetex/ifxetex.sty)
 (/usr/share/texmf-texlive/tex/latex/oberdiek/hycolor.sty
 (/usr/share/texmf-texlive/tex/latex/oberdiek/xcolor-patch.sty))
 (/usr/share/texmf-texlive/tex/latex/hyperref/pd1enc.def)
 (/usr/share/texmf-texlive/tex/*emphasized text*generic/oberdiek/etexcmds.sty
 (/usr/share/texmf-texlive/tex/generic/oberdiek/infwarerr.sty))
 (/usr/share/texmf-texlive/tex/latex/latexconfig/hyperref.cfg)
 (/usr/share/texmf-texlive/tex/latex/oberdiek/kvoptions.sty
 (/usr/share/texmf-texlive/tex/generic/oberdiek/kvsetkeys.sty))
 Implicit mode OFF; no redefinition of LaTeX internals
 (/usr/share/texmf-texlive/tex/latex/ltxmisc/url.sty)
 (/usr/share/texmf-texlive/tex/generic/oberdiek/bitset.sty
 (/usr/share/texmf-texlive/tex/generic/oberdiek/intcalc.sty)
 (/usr/share/texmf-texlive/tex/generic/oberdiek/bigintcalc.sty
 (/usr/share/texmf-texlive/tex/generic/oberdiek/pdftexcmds.sty
 (/usr/share/texmf-texlive/tex/generic/oberdiek/ifluatex.sty)
 (/usr/share/texmf-texlive/tex/generic/oberdiek/ltxcmds.sty))))
 (/usr/share/texmf-texlive/tex/generic/oberdiek/atbegshi.sty)
 Hyperref stopped early
 )
 *hyperref using default driver hpdftex*
 (/usr/share/texmf-texlive/tex/latex/hyperref/hpdftex.def)
 (/usr/share/texmf/tex/latex/beamer/base/beamerbaserequires.sty
 (/usr/share/texmf/tex/latex/beamer/base/beamerbasecompatibility.sty)
 (/usr/share/texmf/tex/latex/beamer/base/beamerbasefont.sty
 (/usr/share/texmf-texlive/tex/latex/amsfonts/amssymb.sty
 (/usr/share/texmf-texlive/tex/latex/amsfonts/amsfonts.sty)))
 (/usr/share/texmf/tex/latex/beamer/base/beamerbasetranslator.sty
 (/usr/share/texmf/tex/latex/beamer/base/translator/translator.sty
 (/usr/share/texmf/tex/latex/beamer/base/translator/translator-language-mappings
 .tex))) (/usr/share/texmf/tex/latex/beamer/base/beamerbasemisc.sty)
 (/usr/share/texmf/tex/latex/beamer/base/beamerbasetwoscreens.sty)
 (/usr/share/texmf/tex/latex/beamer/base/beamerbaseoverlay.sty)
 (/usr/share/texmf/tex/latex/beamer/base/beamerbasetitle.sty)
 (/usr/share/texmf/tex/latex/beamer/base/beamerbasesection.sty)
 (/usr/share/texmf/tex/latex/beamer/base/beamerbaseframe.sty)
 (/usr/share/texmf/tex/latex/beamer/base/beamerbaseverbatim.sty)
 (/usr/share/texmf/tex/latex/beamer/base/beamerbaseframesize.sty)
 (/usr/share/texmf/tex/latex/beamer/base/beamerbaseframecomponents.sty)
 (/usr/share/texmf/tex/latex/beamer/base/beamerbasecolor.sty)
 (/usr/share/texmf/tex/latex/beamer/base/beamerbasenotes.sty)
 (/usr/share/texmf/tex/latex/beamer/base/beamerbasetoc.sty)
 (/usr/share/texmf/tex/latex/beamer/base/beamerbasetemplates.sty
 (/usr/share/texmf/tex/latex/beamer/base/beamerbaseauxtemplates.sty
 (/usr/share/texmf/tex/latex/beamer/base/beamerbaseboxes.sty)))
 (/usr/share/texmf/tex/latex/beamer/base/beamerbaselocalstructure.sty
 (/usr/share/texmf-texlive/tex/latex/tools/enumerate.sty))
 (/usr/share/texmf/tex/latex/beamer/base/beamerbasenavigation.sty)
 (/usr/share/texmf/tex/latex/beamer/base/beamerbasetheorems.sty
 (/usr/share/texmf-texlive/tex/latex/amsmath/amsmath.sty
 For additional information on amsmath, use the `?' option.
 (/usr/share/texmf-texlive/tex/latex/amsmath/amstext.sty
 (/usr/share/texmf-texlive/tex/latex/amsmath/amsgen.sty))
 (/usr/share/texmf-texlive/tex/latex/amsmath/amsbsy.sty)
 (/usr/share/texmf-texlive/tex/latex/amsmath/amsopn.sty))
 (/usr/share/texmf-texlive/tex/latex/amscls/amsthm.sty))
 (/usr/share/texmf/tex/latex/beamer/base/beamerbasethemes.sty))
 (/usr/share/texmf/tex/latex/beamer/base/themes/theme/beamerthemedefault.sty
 (/usr/share/texmf/tex/latex/beamer/base/themes/font/beamerfontthemedefault.sty)

 (/usr/share/texmf/tex/latex/beamer/base/themes/color/beamercolorthemedefault.st
 y)
 (/usr/share/texmf/tex/latex/beamer/base/themes/inner/beamerinnerthemedefault.st
 y)
 (/usr/share/texmf/tex/latex/beamer/base/themes/outer/beamerouterthemedefault.st
 y))) (/home/dkerschner/texmf/tex/latex/minted/minted.sty
 (/usr/share/texmf-texlive/tex/latex/fancyvrb/fancyvrb.sty
 Style option: `fancyvrb' v2.7a, with DG/SPQR fixes, and firstline=lastline fix 
 <2008/02/07> (tvz)) (/usr/share/texmf-texlive/tex/latex/float/float.sty)
 (/usr/share/texmf-texlive/tex/latex/base/ifthen.sty)
 (/usr/share/texmf-texlive/tex/latex/tools/calc.sty)
 (/usr/share/texmf-texlive/tex/latex/ifplatform/ifplatform.sty
 (/usr/share/texmf-texlive/tex/generic/oberdiek/catchfile.sty) (./foo.w18)))/usr/bin/pygmentize

 (/usr/share/texmf-texlive/tex/latex/inconsolata/inconsolata.sty
 (/usr/share/texmf-texlive/tex/latex/base/textcomp.sty
 (/usr/share/texmf-texlive/tex/latex/base/ts1enc.def))) (./foo.aux)
 (/usr/share/texmf-texlive/tex/latex/base/ts1cmr.fd)
 *geometry auto-detecting driver*
 *geometry detected driver: pdftex*
 (/usr/share/texmf-texlive/tex/context/base/supp-pdf.mkii
 [Loading MPS to PDF converter (version 2006.09.02).]
 ) ABD: EveryShipout initializing macros
 (/usr/share/texmf-texlive/tex/latex/hyperref/nameref.sty
 (/usr/share/texmf-texlive/tex/latex/oberdiek/refcount.sty)) (./foo.out)
 (./foo.out)
 (/usr/share/texmf/tex/latex/beamer/base/translator/dicts/translator-basic-dicti
 onary/translator-basic-dictionary-English.dict)
 (/usr/share/texmf/tex/latex/beamer/base/translator/dicts/translator-bibliograph
 y-dictionary/translator-bibliography-dictionary-English.dict)
 (/usr/share/texmf/tex/latex/beamer/base/translator/dicts/translator-environment
 -dictionary/translator-environment-dictionary-English.dict)
 (/usr/share/texmf/tex/latex/beamer/base/translator/dicts/translator-months-dict
 ionary/translator-months-dictionary-English.dict)
 (/usr/share/texmf/tex/latex/beamer/base/translator/dicts/translator-numbers-dic
 tionary/translator-numbers-dictionary-English.dict)
 (/usr/share/texmf/tex/latex/beamer/base/translator/dicts/translator-theorem-dic
 tionary/translator-theorem-dictionary-English.dict) (./foo.pyg) (./foo.nav)
 (./foo.vrb (./foo.out.pyg
 (/usr/share/texmf-texlive/tex/latex/inconsolata/ot1fi4.fd)

 LaTeX Font Warning: Font shape `OT1/fi4/m/it' undefined
 (Font)              using `OT1/fi4/m/n' instead on input line 2.


 LaTeX Font Warning: Font shape `OT1/fi4/bx/n' undefined
 (Font)              using `OT1/fi4/m/n' instead on input line 4.

 ))

 LaTeX Font Warning: Font shape `OT1/cmss/m/n' in size <4> not available
 (Font)              size <5> substituted on input line 25.

 [1{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./foo.aux)

 LaTeX Font Warning: Size substitutions with differences
 (Font)              up to 1.0pt have occurred.


 LaTeX Font Warning: Some font shapes were not available, defaults substituted.

  )
 (see the transcript file for additional information){/usr/share/texmf-texlive/f
 onts/enc/dvips/inconsolata/fi4-ot1tt.enc}</usr/share/texmf-texlive/fonts/type1/
 public/inconsolata/Inconsolata.pfb></usr/share/texmf-texlive/fonts/type1/public
 /amsfonts/cm/cmr6.pfb></usr/share/texmf-texlive/fonts/type1/public/amsfonts/cm/
 cmss10.pfb></usr/share/texmf-texlive/fonts/type1/public/amsfonts/cm/cmss12.pfb>

 Output written on foo.pdf (1 page, 42698 bytes).
 Transcript written on foo.log.
share|improve this question
add comment

2 Answers 2

Acoording to inconsolata manual, \usepackage[nott]{inconsolata} doesn't change tt font to inconsolata but you still can use it through \fontfamily{fi4}\selectfont. This way you can use it in your minted environments with fontfamily=fi4 option.

inconsolata manual shows a dashed zero symbol in position 216 of T1 encoding table, but I don't know how to use it.

The problem with disappearing < may be is due to gobble=2 because it removes the 2 first characters of each line. So you need to indent at least 2 characters all your lines within minted environments. (look at second example)

And the problem with your background color was solved in Change the background color of a frame in Beamer. I include the solution in next code, first minted example doesn't use inconsolata and second does.

\documentclass{beamer}
\usepackage{minted}
\usepackage[nott]{inconsolata}
\definecolor{mycolor}{rgb}{0.5,0.5,0.5}
\begin{document}
\setbeamercolor{background canvas}{bg=mycolor!30}
\begin{frame}[fragile]{}
\begin{minted}[frame=lines,linenos=true,gobble=2]{html}
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
       "http://www.w3.org/TR/html4/strict.dtd">
  <html>
  <head>
    <meta http-equiv="Content-Type" 
     content="text/html; charset=UTF-8">
\end{minted}

\begin{minted}[frame=lines,linenos=true,gobble=2,fontfamily=fi4]{html}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
    "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" 
   content="text/html; charset=UTF-8">
<meta http-equiv="Content-Language" 
\end{minted}
\end{frame}
\end{document}

enter image description here

share|improve this answer
    
Yes, but the docs are wrong. I use the font all the time. I've tried just the \usepackage{inconsolata} and it doesn't change the minted environment –  baudtack Oct 21 '11 at 23:50
    
    
This also removes most of the < and > from the output file oddly... –  baudtack Oct 22 '11 at 0:12
    
I also just want to change the minted environment to Inconsolata and leave the rest whatever the default is. –  baudtack Oct 22 '11 at 0:24
    
@docgnome: look at rebuild answer. Hope it helps better than previous one. –  Ignasi Oct 22 '11 at 15:29
show 1 more comment

So I managed to get it to do what I want, but only using XeLaTeX there appears to be a bug in the Inconsolata package where the 0 is not the standard 0 for the font.

\documentclass{beamer}

\usepackage{minted}
\usepackage{fontspec}

\setmonofont{Inconsolata}

\begin{document}
\begin{frame}[fragile]
\frametitle{Example}
0123456789
\begin{minted}[frame=lines,linenos=true,gobble=2]{html}
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
    "http://www.w3.org/TR/html4/strict.dtd">
<html>
   <head>
      <meta http-equiv="Content-Type"
        content="text/html; charset=UTF-8">
      <meta http-equiv="Content-Language"
      content="en-us">
      <title>Our first web page!</title>
  </head>
  <body>
    <p>Hello World!</p>
  </body>
</html>
\end{minted}
\end{frame}
\end{document}
share|improve this answer
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.