What I want to do: Draw a node decorated with bumps, but with the decoration starting from the right (ie, opposite to the usual) of the node.
Why I want to do it: I will have a node hiding the part of the bumps that connects weirdly, but I want to be able to chose where this connection is made. Luckily, I only need "left of the node" and "right of the node".
What I thought was the solution: I thought I could use shape border rotate
, so that only the border would be rotated. Define:
\newcommand{\drawprost}[2][Prost!]{ \node [draw, decorate,decoration={bumps,mirror}, #2, postaction={decorate,decoration={markings,mark=at position 1 with {\arrow[line width=5pt,blue]{>}}}}] {#1};}
Now the following two commands work as expected:
\drawprost{shape=trapezium,shape border rotate=180} \drawprost{shape=trapezium,shape border rotate=0}
with the ugly blue arrow being rotated 180 degrees in the second drawing. But without shape=trapezium
or with shape=ellipse
, this fails miserably.
An ugly solution: The only solution I came up with is (using ellipse
, otherwise I don't even have a solution):
\drawprost[\phantom{Prost!}]{rotate=180,shape=ellipse,label=center:Prost!}
that is, phantom
ing the label, and redrawing it.
Question: Is there a better way to do it? Bonus point for a method that would shift the start of the decoration (rotate) at any given point :-)
Full code
\documentclass{article} \usepackage{tikz} \usetikzlibrary{decorations,decorations.pathmorphing,shapes,decorations.markings} \begin{document} \begin{tikzpicture} \newcommand{\drawprost}[2][Prost!]{ \node [draw, decorate,decoration={bumps,mirror}, #2, postaction={decorate,decoration={markings,mark=at position 1 with {\arrow[line width=5pt,blue]{>}}}}] {#1};} \newlength\yshift % I get the expected result only with trapezium. \foreach \shape in {,shape=trapezium,shape=ellipse} \foreach \rotate in {0, 180} { \expandafter\drawprost\expandafter{% \shape,yshift=\yshift,shape border rotate=\rotate}; \global\advance\yshift -2cm } % What I do want: \drawprost[\phantom{Prost!}]{yshift=\yshift,rotate=180,shape=ellipse,label=center:Prost!} \end{tikzpicture} \end{document}
shift only
,pre
andpost
stated in the manual for decorations?\documentclass
and the appropriate packages so that those trying to help don't have to recreate it.\phantom
ing. Thanks!