3

How can I achieve that the \pic "lightning" will appear in the node's text area? I cannot use it there, so I have commented it out. I know or think it's a completely different "environment" (a text area of the node) but I have seen that it is possible to put there quite complex things, eg.Small tikz decorated arrow between words inside a tikz node Any idea or proposals for another way. Hope I have cleared the prob.

\documentclass[]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\usepackage{tikz}
\usetikzlibrary{positioning,arrows,arrows.meta,calc}


\begin{document}

\tikzset{%
pics/lightning/.style 2 args={code={%
   \draw[ arrows={-Stealth[scale=2]}] (#1) --
      ($(#1)!.4!(#2) + (.1,-.1)$) --
      ($(#1)!.4!(#2) + (-.1,.1)$) --
      (#2);
      }},
information text/.style={rounded corners,fill=red!10,inner sep=1em}%
}%end tikzset

\begin{tikzpicture}%
[%
 every node/.style={%
    inner sep=0pt},%
]%
   %\draw[help lines, use as bounding box] (-7,-3) grid (7,3);
\begin{scope}[ text height=1.0em, text depth=.25em,]

   \node (advbo)                       {\textit{Adverbiale Bestimmung}};
   \node (so)    [left =.9mm of advbo] {\textit{Substantiv}};
   \node (ao)    [left =.9mm of so]    {\textit{Artikel}};
   \node (ko)    [left =.9mm of ao]    {\textit{Komparativ}};

   \node (l)     [below= of ko]        {Lieber};
   \node (e1)    [below= of ao]        {einen};
   \node (s)     [below= of so]        {Spatz};
   \node (i)     [below= of advbo]     {in der Hand,};

   \node (a)     [below=.3mm of l]     {als};
   \node (e2)    [below=.3mm of e1]    {eine};
   \node (t)     [below=.3mm of s]     {Taube};
   \node (ad)    [below=.3mm of i]     {auf dem Dach.};

   \node (ku)    [below= of a]         {\textit{Konjunktion}};
   \node (au)    [below= of e2]        {\textit{Artikel}};
   \node (su)    [below= of t]         {\textit{Substantiv}};
   \node (advbu) [below= of ad]        {\textit{Adverbiale Bestimmung}};
\end{scope}

   \pic [red] {lightning={ko}{l}};
   \pic [red, rotate=180]{lightning={ku}{a}};

   \draw[->,>=stealth', very thick, red, opacity=.5] (ao)    to (e1);
   \draw[->,>=stealth', very thick, red, opacity=.5] (au)    to (e2);

   \draw[->,>=stealth', very thick, red, opacity=.5] (so)    to (s);
   \draw[->,>=stealth', very thick, red, opacity=.5] (su)    to (t);

   \draw[->,>=stealth', very thick, red, opacity=.5] (advbo) to (i);
   \draw[->,>=stealth', very thick, red, opacity=.5] (advbu) to (ad);

   \draw[xshift=2.75cm,yshift=-1.8cm]
      node[right,text width=4cm,information text]
      {
         Parallelismus, der nicht ganz konsequent durchgestaltet ist, denn hier
         %\pic [red] {lightning={ao}{t}}%HELP APPRECIATED HERE
         stimmen die Wortarten nicht "uberein.
      };
   \pic [red] {lightning={ao}{ad}};%IT WORKS BUT NOT ABOVE?!
\end{tikzpicture}
\end{document}
3
  • 2
    You can try \tikz\pic [red] {lightning={ao}{t}}; but be aware that nesting tikzpictures can have side effects. May 26, 2016 at 12:27
  • 1
    @Ulrike Fischer, a "\tikz" and a "semi-colon" and it works, many thanks for sharing your knowhow.
    – gizeh
    May 26, 2016 at 12:37
  • A slightly safer approach is to use a \savebox, but you won't have access to coordinates (ao) and (t). May 26, 2016 at 16:03

1 Answer 1

2

It is a lot easier to show than explain.

\documentclass[]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}

\usepackage{tikz}
\usetikzlibrary{positioning,arrows,arrows.meta,calc}

\newsavebox{\tempbox}

\begin{document}

\tikzset{%
pics/lightning/.style 2 args={code={%
   \draw[ arrows={-Stealth[scale=2]}] (#1) --
      ($(#1)!.4!(#2) + (.1,-.1)$) --
      ($(#1)!.4!(#2) + (-.1,.1)$) --
      (#2);
      }},
information text/.style={rounded corners,fill=red!10,inner sep=1em}%
}%end tikzset

\savebox{\tempbox}{\tikz{\coordinate (a) at (0,0);
  \coordinate (b) at (4cm,-1cm);
  \pic [red] {lightning={a}{b}};}}

\begin{tikzpicture}%
[%
 every node/.style={%
    inner sep=0pt},%
]%
   %\draw[help lines, use as bounding box] (-7,-3) grid (7,3);
\begin{scope}[ text height=1.0em, text depth=.25em,]

   \node (advbo)                       {\textit{Adverbiale Bestimmung}};
   \node (so)    [left =.9mm of advbo] {\textit{Substantiv}};
   \node (ao)    [left =.9mm of so]    {\textit{Artikel}};
   \node (ko)    [left =.9mm of ao]    {\textit{Komparativ}};

   \node (l)     [below= of ko]        {Lieber};
   \node (e1)    [below= of ao]        {einen};
   \node (s)     [below= of so]        {Spatz};
   \node (i)     [below= of advbo]     {in der Hand,};

   \node (a)     [below=.3mm of l]     {als};
   \node (e2)    [below=.3mm of e1]    {eine};
   \node (t)     [below=.3mm of s]     {Taube};
   \node (ad)    [below=.3mm of i]     {auf dem Dach.};

   \node (ku)    [below= of a]         {\textit{Konjunktion}};
   \node (au)    [below= of e2]        {\textit{Artikel}};
   \node (su)    [below= of t]         {\textit{Substantiv}};
   \node (advbu) [below= of ad]        {\textit{Adverbiale Bestimmung}};
\end{scope}

   \pic [red] {lightning={ko}{l}};
   \pic [red, rotate=180]{lightning={ku}{a}};

   \draw[->,>=stealth', very thick, red, opacity=.5] (ao)    to (e1);
   \draw[->,>=stealth', very thick, red, opacity=.5] (au)    to (e2);

   \draw[->,>=stealth', very thick, red, opacity=.5] (so)    to (s);
   \draw[->,>=stealth', very thick, red, opacity=.5] (su)    to (t);

   \draw[->,>=stealth', very thick, red, opacity=.5] (advbo) to (i);
   \draw[->,>=stealth', very thick, red, opacity=.5] (advbu) to (ad);


   \draw[xshift=2.75cm,yshift=-1.8cm]
      node[right,text width=4cm,information text]
      {
         Parallelismus, der nicht ganz konsequent durchgestaltet ist, denn hier
         \usebox{\tempbox}
         stimmen die Wortarten nicht "uberein.
      };
   \pic [red] {lightning={ao}{ad}};%IT WORKS BUT NOT ABOVE?!
\end{tikzpicture}
\end{document}
4
  • I think a path picture is better to use then all TikZ syntax is available instead of boxing it.
    – percusse
    May 26, 2016 at 18:00
  • @percusse - I don't see how you could use that here. You don't want to overlay the text, you want to displace it. May 27, 2016 at 2:30
  • @percusse, unfortunately I cannot understand your proposal. Don't know how to use "path picture". Can you give an idea of it in code snippet?
    – gizeh
    May 27, 2016 at 10:48
  • @JohnKormylo, I have not yet worked with \savebox. I don't penetrate the security aspects, too less practice. Nice thing of the whole doc was the lack of coordinates. But nevertheless thnks for your lines of code. Something new to learn
    – gizeh
    May 27, 2016 at 10:57

You must log in to answer this question.

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