19

Consider the MWE below that outputs the following arrow

enter image description here

Is it possible to bend such a node so it looks like

enter image description here

(sorry for the quality, I'm not a photoshop artist). If possible I would like the font readable and just create an arrow that bends to the right.

Do you know if there is any way?

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{shapes.arrows}
\tikzstyle{arrownode}
  = [ shape=single arrow
    , single arrow head extend=.75em
    , single arrow head indent=.25em
    , minimum width=3em
    , draw
    , font=\sc
    ]
\begin{document}
    \begin{tikzpicture}
        \node[arrownode] at (0,0) {foobar};
    \end{tikzpicture}
\end{document}
12

With TikZ v3.00, you can use nonlinear transformations to do fantastic things. The problem here is the text since TikZ also puts the node text into a box and hopes for the best. And thus everything in the box gets affected by the same transformation that TikZ sees the box handle(for example add \hspace{3cm} to the node contents).

\documentclass[]{article}
\usepackage{tikz}
\usetikzlibrary{shapes.arrows}
\usepgflibrary{curvilinear}
\usepgfmodule{nonlineartransformations}
\tikzset{arrownode/.style={
    shape=single arrow,
    single arrow head extend=.75em,
    single arrow head indent=.25em,
    minimum width=3em,
    draw,
    }
}
\begin{document}
    \begin{tikzpicture}
        {
        \pgfsetcurvilinearbeziercurve
        {\pgfpoint{0mm}{30mm}}
        {\pgfpoint{15mm}{30mm}}
        {\pgfpoint{30mm}{15mm}}
        {\pgfpoint{30mm}{0mm}}
        \pgftransformnonlinear{%
            \pgfpointcurvilinearbezierorthogonal%
            {\csname pgf@x\endcsname}%
            {\csname pgf@y\endcsname}%
        }%
        \node[arrownode,transform shape nonlinear=true] at (3,0) {why no rotation?};
        }
    \end{tikzpicture}
\end{document}

enter image description here

You can however switch to text decorations and I have not really looked carefully how Mark Wibrow coded the transformations but maybe you can make the text accept the current transformation matrix (I don't know yet). So if you replace the above node with

\node[arrownode,transform shape nonlinear=true] (a) at (3,0) {\phantom{Why not rotating?}};
\path[decoration={text along path,
                text={Why not rotating?},
                text align=center,
                raise=-0.5ex
                },postaction={decorate}](a.west) -- (a.east);

you will get

enter image description here

Notice that the point you place the node matters since the transfomation is nonlinear so in this example if you put your node further, the more pronounced the effect will be. And you can see the top white space coming in from the transformed canvas Play around with the bezier curve coordinates and you'll get ridiculous results :)

  • Is the decoration meant to take so long? I've waited five minutes to render two letters in non-regular font size, I'm using the latest PGF releases as far as I know. – 1010011010 Apr 13 '14 at 15:44

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.