4

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}
4
  • 1
    You can't use Cyrillic characters in node names with pdfTeX. See this answer for a more elaborate discussion and possible solution: tex.stackexchange.com/questions/24969/… Nov 11, 2011 at 11:34
  • <sub>Too long for a comment</sub> You can't use special characters in the node names because they must be used in contexts where TeX needs to see only string of characters, while a cyrillic б, for instance, is translated by LaTeX into its internal representation, which is \cyrb, which in turn is subject to further processing that ultimately is transformed into \char"E1 (where hexadecimal E1 is the letter position in the T2A encoding) and this is disallowed in those contexts. This wouldn't happen with a Unicode savvy engine such as xelatex or lualatex.
    – egreg
    Nov 11, 2011 at 13:22
  • 1
    You can post your addition as a self-answer; I've added another comment which tries to explain what's going on.
    – egreg
    Nov 11, 2011 at 13:41
  • 1
    Will do (I have to wait 8 hours to post answers to my own questions until I have 100 rep). Nov 11, 2011 at 15:56

1 Answer 1

4

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

1
  • I had thoughts on posting my addition to the question as a self-answer, but your explanation is much more detailed. Nov 11, 2011 at 19:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .