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{очень длинный текст}
  • 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 5 '14 at 10:00
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

  • Thanks for suggestion. I am going to see if it feets my needs. Also, please see my updated question. – bronislav Dec 20 '13 at 20:18
  • @bronislav I think, your example works for me. I updated the answer to show that I can see all symbols. – someonr Dec 21 '13 at 3:43
  • thx, you suggestion works perfect. I am going to ask a new question as a continue of this one. – bronislav Dec 21 '13 at 5:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.