[Tex/LaTex] minted : changing fontfamily to support UTF8 chars

fontsminted

I'd like to print out the output of a "/usr/bin/tree" command.

For instance :

/etc/puppet/hieradata/
├── common.yaml
└── virtual
    ├── false.yaml
    └── true.yaml

My idea was to put this in a minted environment. But the fontfamily would not contain the UTF8 caracters like :

Missing character: There is no ├ in font [lmroman10-regular]:mapping=tex-text!

I tried some other fontfamilies (like dejavusansmono), but no luck with this.

Is there a fontfamily wich provides these characters ?

Best Answer

I used xelatex and the CMU Typewriter Text font.


These fonts are proved to work:

  • CMU Typewriter Text
  • DejaVu Sans Mono
  • Liberation Mono
  • Linux Libertine Mono O

These are proved to fail:

  • Latin Modern Mono (shows no symbol)
  • Bitstream Vera Sans Mono (shows boxes)
  • Droid Sans Mono (shows boxes)
  • Nimbus Mono L (shows no symbol)

Typeset with xelatex -shell-escape.

\documentclass{article}
\pagestyle{empty}% for cropping
\usepackage{fontspec,minted}
\setmonofont{CMU Typewriter Text}
\begin{document}
\begin{minted}{text}
/etc/puppet/hieradata/
├── common.yaml
└── virtual
    ├── false.yaml
    └── true.yaml
\end{minted}
\end{document}

enter image description here

Related Question