3

Obviously I need a background color for the rightsided text. Code is from the Tantau manual, p.45. It's a riddle for me at the time. Something wrong with the node which keeps the text? For any answer I would be very appreciated. Sorry my pidgeon-english. Also I cannot post the code in a simple manner (manually 4 spaces for every line?) To see the result of the code on this side would be great.

\documentclass[]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{setspace}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows}

\begin{document}

\begin{tikzpicture}%
[%node distance=5mm,
 text height=1.0em,
 text depth=.25em,
 every node/.style={%
    %rectangle,draw=black,
    inner sep=0pt},%
 %information text/.style={rounded corners,fill=red!10,inner sep=1em}
]
   %\draw[help lines, use as bounding box] (-7,-3) grid (7,3);

   \node (advbo)  {Adverbiale Bestimmung};
   %\node (po)                       {Pronomen};
   \node (po)    [left =.9mm of advbo]                   {Pronomen};
   \node (vo)    [left =.9mm of po]  {Verb};
   \node (advo)  [left =.9mm of vo]  {Adverb};
   %\node (advbo) [right=.5mm of po] {Adverbiale Bestimmung};

   \node (s) [below= of advo] {Schnell};
   \node (li) [below= of vo] {lief}; 
   \node (e1) [below= of po] {er};
   \node (h) [below= of advbo] {hin,};

   %\node (la) [below= of s] {langsam};
   \node (la) [below=.3mm of s] {langsam};
   \node (k) [below=.3mm of li] {kam};
   \node (e2) [below=.3mm of e1] {er};
   \node (z) [below=.3mm of h] {zur"uck.};

   \node (advu) [below= of la] {Adverb};
   \node (vu) [below= of k] {Verb};
   \node (pu) [below= of e2] {Pronomen};
   \node (advbu) [below= of z] {Adverbiale Bestimmung};

   \draw[->,>=stealth', very thick, red, opacity=.5] (advo)  to (s);
   \draw[->,>=stealth', very thick, red, opacity=.5] (advu)  to (la);

   \draw[->,>=stealth', very thick, red, opacity=.5] (vo)    to (li);
   \draw[->,>=stealth', very thick, red, opacity=.5] (vu)    to (k);

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

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

   \draw[xshift=2.75cm,yshift=-.75cm]
      %node[right,text width=4cm,information text]
      node[right,text width=4cm,rounded corners,fill=red!10,inner sep=1em]
      {
         Parallelisierte Satzkonstruktionen ergeben, wenn man sie    untereinanderstellt, immer parallele Verbindungslinien.
      };
\end{tikzpicture}

\end{document}
  • I have found out that the code of the text node right is correct by putting it outside of the tikzpicture environment. But I am in this e., so is there a solution possible? – gizeh May 24 '16 at 16:26
2

The problem comes from text height and text depth defined in tikzpicture options. In this way, they apply to all nodes, and right hand text is a node, so its vertical size is defined by these values.

If you doesn't use text height and text depth, all other nodes won't be aligned, so it's not convenient to suppress them.

As I don't know how to forget previous values of text height/depth the best solution I can provide is apply these parameters to a particular scope where all little nodes are defined. And declare the right text node outside from it.

\documentclass[]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{setspace}
\usepackage{tikz}
\usetikzlibrary{positioning,arrows}

\begin{document}

\begin{tikzpicture}%
[%node distance=5mm,
% text height=1.0em,
% text depth=.25em,
 every node/.style={%
    %rectangle,draw=black,
    inner sep=0pt},%
 %information text/.style={rounded corners,fill=red!10,inner sep=1em}
]
   %\draw[help lines, use as bounding box] (-7,-3) grid (7,3);

\begin{scope}[text height=1.0em, text depth=.25em]
   \node (advbo)  {Adverbiale Bestimmung};
   %\node (po)                       {Pronomen};
   \node (po)    [left =.9mm of advbo]                   {Pronomen};
   \node (vo)    [left =.9mm of po]  {Verb};
   \node (advo)  [left =.9mm of vo]  {Adverb};
   %\node (advbo) [right=.5mm of po] {Adverbiale Bestimmung};

   \node (s) [below= of advo] {Schnell};
   \node (li) [below= of vo] {lief}; 
   \node (e1) [below= of po] {er};
   \node (h) [below= of advbo] {hin,};

   %\node (la) [below= of s] {langsam};
   \node (la) [below=.3mm of s] {langsam};
   \node (k) [below=.3mm of li] {kam};
   \node (e2) [below=.3mm of e1] {er};
   \node (z) [below=.3mm of h] {zur"uck.};

   \node (advu) [below= of la] {Adverb};
   \node (vu) [below= of k] {Verb};
   \node (pu) [below= of e2] {Pronomen};
   \node (advbu) [below= of z] {Adverbiale Bestimmung};
\end{scope}

   \draw[->,>=stealth', very thick, red, opacity=.5] (advo)  to (s);
   \draw[->,>=stealth', very thick, red, opacity=.5] (advu)  to (la);

   \draw[->,>=stealth', very thick, red, opacity=.5] (vo)    to (li);
   \draw[->,>=stealth', very thick, red, opacity=.5] (vu)    to (k);

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

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

   \draw[xshift=2.75cm,yshift=-1.8cm]
      %node[right,text width=4cm,information text]
      node[right,text width=4cm, rounded corners,fill=red!10,inner sep=1em]
      {
         Parallelisierte Satzkonstruktionen ergeben, wenn man sie    untereinanderstellt, immer parallele Verbindungslinien.
      };
\end{tikzpicture}

\end{document}

enter image description here

  • Thank you very much, great to receive so fast a solving answer. Too less practice of mine, but now I got a new feeling for "scope". Thank you! – gizeh May 24 '16 at 18:01

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.