1

I have the following code.

I cannot for the life of me find a way to lay the table under the pink figure ..

code reproduction

\documentclass{article}

\usepackage[english]{babel}
\usepackage{tikz}
\usetikzlibrary{arrows,automata}
\usepackage{adjustbox}

\begin{document}

\begin{adjustbox}{center}
\begin{tikzpicture}[->, >=stealth', shorten >= 2pt, auto, node distance=8cm, thick]
\tikzstyle{every edge}=[draw=black,thick]
\tikzstyle{every state}=[fill=white, draw=black, thick, text=black, scale=1]
\node[state] (1) {\tikz \draw[->,very thick] (0,1) -- (1,0);};
\path (1) edge [loop left] node[left] {
\fbox{\scalebox{.5}{\tikz \filldraw[draw=red,fill=red!20] rectangle (3,3);}}
\\
\\
\begin{tabular}[b]{ll}
p: 78\%&\\[2ex]
$\mu$: -7\% & $\sigma$: 7\%\\
$\alpha$: 0.38 & N: 11977
\end{tabular}
} (1);
\end{tikzpicture}\end{adjustbox}

\end{document}

any help? thx ! :-)

David Carlisle
  • 757,742
Ricardo Cruz
  • 1,770
  • 1
  • 22
  • 34
  • 3
    You're actually requesting a line-break inside a TikZ node. This is discussed in Manual/automatic line breaks and text alignment in TikZ nodes which suggests wrapping the content-to-break in a tabular (amongst other things). – Werner Aug 13 '13 at 05:58
  • Do you still want the box level with the material on the right, or should the whole left node (including table) be vertically centered, or.... – Andrew Swann Aug 13 '13 at 06:27
  • Werner, thx for the info – Ricardo Cruz Aug 13 '13 at 06:35
  • Andrew, I would like to put the table below the pink figure (for that particular node) – Ricardo Cruz Aug 13 '13 at 06:36
  • I confirm that using tabular is a possible work-around. – Ricardo Cruz Aug 13 '13 at 06:40
  • Richard Cruz, in your comments you should write @ before the user name you are addressing so that an alert is generated for that user. It was clear to me that you want the box vertically above the table, but how do you want all of that node placed relative to the loop? – Andrew Swann Aug 13 '13 at 06:44
  • 1
    I would suggest to skip the box commands (scalebox, fbox) and use tikz for that. You can then draw the rectangle with a node command using minimum height/width and name the node \node(box)[draw=red,fill=red!20,minimum height=3cm, minimum width=3cm]{}; You wrap the table in a node of its own, which you can then position easily (e.g. \node [below=0 of box] {\begin{tabular} ...} ) anyway you want. – ted Aug 13 '13 at 07:33
  • @AndrewSwann, thx for the @ tip. The node ought to be as it is (to the right, in that case). I just want the table under the figure. – Ricardo Cruz Aug 14 '13 at 21:38
  • @Werner suggestion works for me. (I will mark it as the solution if you post it below.) – Ricardo Cruz Aug 14 '13 at 21:39
  • @ted, thx for the tip. Yeah, I have found fbox to be problematic. Will try to use tkiz to draw the frame. – Ricardo Cruz Aug 14 '13 at 21:40
  • @RicardoCruz: Since the original problem has been solved in a different post, we can close this as a duplicate. We'll keep this here as a reference to future visitors though. – Werner Aug 15 '13 at 06:51

0 Answers0