# keystroke package doesn't work with polyglossia in TeXLive 2012

Example file:

\documentclass{article}
\usepackage{fontspec}
\setmainfont[Mapping=tex-text]{Ubuntu}
\usepackage{polyglossia}
\setmainlanguage{russian}
\usepackage{keystroke}
\begin{document}
\keystroke{Q}
\end{document}


Error (when running xelatex test.tex):

! Package polyglossia Error:
The current roman font does not contain the Cyrillic script!

See the polyglossia package documentation for explanation.
Type  H <return>  for immediate help.
...

l.8 \keystroke{Q}


When I compile with TeXLive 2009, the same file works fine. What is wrong?

-
The fact that it "worked" in TeX Live 2009 doesn't say much. Don't load xltxtra, but fontspec and define as main font one that has support for cyrillic. –  egreg Jun 2 '13 at 13:04
@egreg - I updated the example. It now uses fontspec, defines Ubuntu as a new font, but the error is still there. –  Rogach Jun 2 '13 at 13:07

The error message is, unfortunately, not very informative. The keystroke package uses, for its drawings, the sans serif font.

In some cases Polyglossia is not able to extract information about the scripts supported by a font, so you have to help it. But first of all, you have to set a sans serif font. Here's the version with Linux Libertine and Biolinum (I don't have Ubuntu):

\documentclass{article}
\usepackage{fontspec}
\setmainfont[Ligatures=TeX]{Linux Libertine O}
\setsansfont[Ligatures=TeX]{Linux Biolinum O}
\usepackage{polyglossia}
\setmainlanguage{russian}
\usepackage{keystroke}
\begin{document}
\keystroke{Q}
\end{document}


Try with

\setsansfont[Ligatures=TeX]{Ubuntu}


and, if the message is still there, add

\newfontfamily{\cyrillicfontsf}[Ligatures=TeX]{Ubuntu}

-