8

I'm trying to decorate tikz path with cyrillic symbols without any success. I can use ASCII symbols but not cyrillic.

\documentclass{standalone}
\usepackage{tikz}
\usepackage[utf8]{inputenc}
\usepackage[T2A,T1]{fontenc}
\usepackage[english,russian]{babel}

\usetikzlibrary{decorations.text}

\begin{document}

\begin{tikzpicture}

\draw (0,0) circle (1cm);
\path[
   postaction={
     decorate,
     decoration={
       text along path,
       reverse path=false,
       text={very long long text}
     }
  }
] (0,0) circle (1cm);

\end{tikzpicture}

\end{document}

If I put cyrillic symbols in text={} this cause many errors.

UPDATE: I have processed my tex file with XeLaTex and it works partially. It shows only first symbol.

Also I need to pass the text as parameter as follow:

\newcommand\PathWithText[1]{
\draw (0,0) circle (1cm);
\path[
  postaction={
    decorate,
      decoration={
        text along path,
        reverse path=false,
        text={#1}
      }
    }
] (0,0) circle (1cm);
}
\PathWithText{очень длинный текст}
bronislav
  • 493
  • also breaks for other symbols like äöü (just in case someone doesn't have cyrillic symbols). Also very funny result with $a$ as text ;) – someonr Dec 20 '13 at 16:05
  • 2
    You need to enclose them in braces, e.g.: text={{ä}{ö}{ü}}. – Qrrbrbirlbel Dec 20 '13 at 16:19
  • This has to do with the way the text is parsed, one token at a time; but cyrillic letters are multibyte, so the parser gets confused. The same if ä is used in Latin script. The trick by @Qrrbrbirlbel works. – egreg Dec 20 '13 at 16:33
  • @Qrrbrbirlbel Unfortunattely, your solution doesn't work – bronislav Dec 20 '13 at 20:10
  • 2
    Braces as suggested by @Qrrbrbirlbel works but it looks as if for cyrillic you sometimes need more layers of braces. E.g. text={{{о}}{{ч}}{{е}}{{н}}{{ь}}} works, but I also had cases where I needed one additional layer around some chars. – Ulrike Fischer Aug 05 '14 at 10:00
  • May I suggest Ulrike Fischer's as a more appropriate answer to the question than the one that has been checked? Having to switch to another engine; e.g., from pdflatex to xelatex, seems to me more like a way out avoiding the problem, as opposed to solving it. I was having the same kind of trouble with diacritic marks, had the idea to brace the problematic characters, but the problem remained until I followed Ulrike's advice. – Marcos Jun 07 '15 at 00:01

1 Answers1

4

You could use LuaLaTex or XeLaTex like this:

\documentclass{standalone}
\usepackage{tikz}
\usepackage{fontspec}

\usetikzlibrary{decorations.text}

\setmainfont{Liberation Sans} %use some font with cyrillic symbols


\newcommand\PathWithText[1]{
\draw (0,0) circle (1cm);
\path[
  postaction={
    decorate,
      decoration={
        text along path,
        reverse path=false,
        text={#1}
      }
    }
] (0,0) circle (1cm);
}

\begin{document}

\begin{tikzpicture}
\PathWithText{очень длинный текст}
\end{tikzpicture}

\end{document}

result

someonr
  • 8,531