[Tex/LaTex] How to typeset Cyrillic characters in tikzpicture nodes

cyrillictikz-pgf

So I have this tikzpicture environment (dot2texi-generated):

\documentclass{beamer}

\usepackage[T2A,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,russian]{babel}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes}

\begin{document}

\begin{frame}[fragile]
\begin{tikzpicture}[>=latex,line join=bevel,]
%%
\node (а) at (5bp,51bp) [draw,ellipse] {а};
  \node (б) at (5bp,5bp) [draw,ellipse] {б};
  \draw [->] (а) ..controls (5bp,39.554bp) and (5bp,29.067bp)  .. (б);
%
\end{tikzpicture}
\end{frame}

\end{document}

with Cyrillic "а" and "б" nodes. pdfLaTeX, though, gives me the following error:

! Missing \endcsname inserted.
<to be read again> 
                   \T2A\cyra 
l.4 \node (а) at (5bp,51bp) [draw,ellipse] {а};

So the question is: how to use Cyrillic characters in tikzpicture nodes?

UPD:

I should've actually include contents of original dot2tex environment. Andrey has given the basic idea of a possible solution: instead of

\begin{dot2tex}[]
  digraph { "а" -> "б" };
\end{dot2tex}

one can use:

\begin{dot2tex}[]
  digraph { a [label="а"]; b [label="б"]; a -> b }
\end{dot2tex}

Best Answer

You should distinguish between a node name and a node label. The first is how TeX references a node, and must be in ASCII. The second is how TeX presents the node, and may be anything TeX understands. See here:

\documentclass{beamer}

\usepackage[T2A,T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english,russian]{babel}
\usepackage{tikz}
\usetikzlibrary{arrows,shapes}

\begin{document}

\begin{frame}[fragile]
\begin{tikzpicture}[>=latex,line join=bevel,]
%%
\node (Moscow) at (5bp,51bp) [draw,ellipse] {Москва};
  \node (SPb) at (5bp,5bp) [draw,ellipse] {Санкт-Петербург};
  \draw [->] (Moscow) ..controls (5bp,39.554bp) and (5bp,29.067bp)  .. (SPb);
%
\end{tikzpicture}
\end{frame}

\end{document}

enter image description here