mario
mario

Reputation: 624

tikz, text along path, and \newline

In a M(not-)WE as below, is there a way to insert \newline, \'{e}, \textbf{...} and similar commands? The simple minded solution, just insert them, does not seem to work. I get a Runaway argument?

\documentclass {beamer}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,intersections}
\usetikzlibrary{calc, arrows, decorations.markings, decorations.text, arrows.meta}

\begin{document}
    \begin{frame}

    \begin{tikzpicture}
    \path (0 :4cm) node (x) {AAAAAA} 
    (180:4cm) node (y) {BBBBB need \newline here CCCCC};
    \def\myshift#1{\raisebox{1ex}}
    \draw [-{Stealth[length=3mm, width=2mm]}, thick, postaction={decorate, decoration={text along path, text align=center, text={|\sffamily\myshift|AAAAAA}}] (y) to [bend left=45]  (x);
    \def\myshift#1{\raisebox{-2.5ex}}
    \draw [-{Stealth[length=3mm, width=2mm]}, thick, postaction={decorate, decoration={text along path, reverse path, text align=center, text={|\sffamily\myshift|Ok Ok   } }}] (x) to [bend left=45] (y);
\end{tikzpicture}

\end{frame}
\end{document}

Upvotes: 0

Views: 990

Answers (1)

If you specify the text width for the node, you can use \newline:

\documentclass {beamer}
\usepackage{tikz}
\usetikzlibrary{decorations.pathreplacing,intersections}
\usetikzlibrary{calc, arrows, decorations.markings, decorations.text, arrows.meta}

\begin{document}
    \begin{frame}

    \begin{tikzpicture}
    \path (0 :4cm) node (x) {AAAAAA} 
    (180:4cm) node[text width=4cm] (y) {BBBBB need \newline here CCCCC};
\end{tikzpicture}

\end{frame}
\end{document}

Upvotes: 1

Related Questions