# Using setmonofont with Bera Sans Mono in Beamer produces garbled output

I am using Bera Sans Mono as the monospaced font for typesetting code listings using the listings package. This is done for slides which are produced using beamer and XeLaTeX. My preamble includes the following (which used to work before a recent update to the MikTeX engine, the fontspec package, and the above-mentioned packages):

\usepackage{fontspec}
\setmonofont{Bera Sans Mono}[Scale=0.9] % for code listings beramono is used
\newfontfamily\quotefont{Linux Libertine O}[Ligatures=TeX] % selects Libertine for quotation marks

The output produced is:

If I do not use \setmonofont and have the following preamble instead, the correct output is produced:

\usepackage{fontspec}
\usepackage[scaled]{beramono}
\usepackage[T1]{fontenc}
\newfontfamily\quotefont{Linux Libertine O}[Ligatures=TeX] % selects Libertine for quotation marks

Why am I unable to use \setmonofont{Bera Sans Mono}[Scale=0.9] (which used to work before)?

1. XeLaTeX is able to find the font
2. \setmonofont appears to work correctly with other fonts, just not Bera Sans Mono.
• A minimal (non) working example? – egreg Sep 2 '15 at 12:35
• Probably xetex and/or xdvipdfmx is finding a wrong font. This can happen if there are two versions of a font on a system. Add \XeTeXtracingfonts= 1 to your document, and then compile on the command line with xelatex --nopdf file and xdvipdfmx -vv file.xdv then the log and the terminal output will show the pathes of the fonts used. – Ulrike Fischer Sep 2 '15 at 13:30
• I should have checked first. There is no opentype font "bera sans mono", it is a type1 font. You shouldn't load it with \setmonofont.Try \setmonofont{Bitstream Vera Sans Mono}[Scale=0.9]` instead. – Ulrike Fischer Sep 2 '15 at 13:54
• @UlrikeFischer Thank you! Your suggestion to use the Bitstream font worked and helped to clear up some misunderstandings on my part. Do you want to post this as a formal answer? – Steve Sep 3 '15 at 7:59