# Use cmbright with unicode text under XeLaTeX

XeLaTeX has been my preferred LaTeX engine because it straightforwardly handles text in Unicode (UTF-8 encoding). I know this can be done using \usepackage[utf8]{inputenc} with other engines, too, but it appears to me that the handling in XeLaTeX is more uniform, less of a hack; and I'm also fond of its capability to use OpenType fonts.

Now in a new document I chose to use Computer Modern Bright via \usepackage{cmbright} but found that I cannot access characters by directly typing in Unicode. Meaning "---" works, but "—" does not, the same for "\´a" vs "á" etc. First I thought this is because I did not load fontspec, and it's true that as soon as I load the package, unicode works – just not with Computer Modern Bright. If I load fontspec before cmbright I get Latin Modern Roman, if after: Latin Modern Sans.

Is there any way to make this work?

Use the open type version of the fonts:

\documentclass{article}
\usepackage{fontspec}
\setmainfont[ItalicFont=CMU Bright Oblique]{CMU Bright}
\begin{document}
abc  \itshape abc

\end{document}

• Thank you! Two follow-up questions: 1) The cmbright package also installs the font for use in math. I guess to achieve the same I have to use \setmathfont, correct? Is that sufficient to have the exact effect of the package? 2) I found the otf version installed on my system, under texmf-dist/fonts/opentype, but the command as given by you does not work ("CMU Bright" cannot be found). I guess this means I have to install the font as a system font? Or is there another way to reference it? Nov 11 '13 at 18:54
• I don't think that there a open type version of the math fonts. You could try to load the cmbright package and later fontspec with the option no-math. To use the opentype fonts with texlive you can either try the file names instead of the font names, or add the texmf tree to fontconfig - how this is done is described somewhere in the texlive docu. Nov 12 '13 at 10:07
• Thanks again. The document I was talking about is actually just a wrapper for a tikzpicture. Since xelatex also seems to have problems with supporting TikZ' pattern fills, I now have the feeling I'll switch back to pdflatex & inputenc in this case. Nov 12 '13 at 12:08