6

I want to get a spiral as shown in this post: Text spirals with TikZ enter image description here at the same time, I need to use Cyrillic: "Пример: нужно написать по спирали это предложение."

I found a way to change the language to Greek: Text spirals with TikZ using greek text

Doing by analogy, I realized that I should use lines such as:

\usepackage[english,russian]{babel}
 \usepackage[T2A]{fontenc}
 \selectlanguage{russian}

but I didn't manage to get the result

\documentclass[tikz,border=5]{standalone}
 \usepackage[english,russian]{babel}
 \usepackage[T2A]{fontenc}
    \usetikzlibrary{decorations.text}
    \begin{document}
    \selectlanguage{russian}
    \begin{tikzpicture}[
      decoration={
        reverse path,
        text effects along path,
        text={Пример: нужно написать по спирали это предложение.},
        text effects/.cd,
          text along path,
          character count=\i, character total=\n,
          characters={scale=1-\i/\n}
        }
    ]
    \draw [decorate] (0,0) 
        \foreach \i [evaluate={\r=(\i/2000)^2;}] in {0,5,...,2880}{ -- (\i:\r)}; 
    \end{tikzpicture}
    \end{document}

1 Answer 1

4

You need to brace each letter, which can be done with \text_map_function:nN, fully expanding the result.

\documentclass{article}
\usepackage[T2A]{fontenc}
\usepackage[english,russian]{babel}

\usepackage{tikz}
\usetikzlibrary{decorations.text}

\ExplSyntaxOn
\NewExpandableDocumentCommand{\bracetext}{m}
 {
  \text_map_function:nN {#1} \__anton_brace:n
 }
\cs_new:Nn \__anton_brace:n { {#1} }
\ExplSyntaxOff

\begin{document}

\begin{tikzpicture}[
  decoration={
    reverse path,
    text effects along path,
    text/.expanded=\bracetext{Пример: нужно написать по спирали это предложение.},
    text effects/.cd,
    text along path,
    character count=\i,
    character total=\n,
    characters={scale=1-\i/\n}
    }
]
\draw [decorate] (0,0) 
    \foreach \i [evaluate={\r=(\i/2000)^2;}] in {0,5,...,2880}{ -- (\i:\r)}; 
\end{tikzpicture}

\end{document}

enter image description here

1
  • I can't run this code either in overleaf or in TeXstudio...
    – Антон
    Feb 22 at 2:52

You must log in to answer this question.

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