Graphics, Figures & Tablesis this a table? (arrows in the table) please help

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
gcheer3
Posts: 41
Joined: Wed Jun 25, 2008 4:39 pm

is this a table? (arrows in the table) please help

Post by gcheer3 »

I have no idea how to construct this in latex
I am thinking making a normal table, take off the borders inside the table. But I still have no idea on how to make the arrow in between and how to put characters above the arrow. Thanks a lot for your help or any hints.
Attachments
2.jpg
2.jpg (20.78 KiB) Viewed 4560 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

is this a table? (arrows in the table) please help

Post by gmedina »

Hi,

you could use some of the packages designed for creation of graphics (PSTricks or PGF/TikZ).
1,1,2,3,5,8,13,21,34,55,89,144,233,...
gcheer3
Posts: 41
Joined: Wed Jun 25, 2008 4:39 pm

Re: is this a table? (arrows in the table) please help

Post by gcheer3 »

Thank you, Gmedina.

Could you please tell me some details? or is there is any webpage talk about using
PSTricks or PGF/TikZ to deal with the table like this?
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

is this a table? (arrows in the table) please help

Post by gmedina »

1,1,2,3,5,8,13,21,34,55,89,144,233,...
gcheer3
Posts: 41
Joined: Wed Jun 25, 2008 4:39 pm

Re: is this a table? (arrows in the table) please help

Post by gcheer3 »

Thanks again, gmedina.
I looked through the examples in the link you gave me. But seems my graph is not similar to any of them. I am a beginner of latex. I don't know how to make the program for the whole table. Could you tell me which example I should use? So I can just modify the code from the example. Thanks a lot.
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

is this a table? (arrows in the table) please help

Post by localghost »

Read Chapter 16 (Matrices and Alignment, p. 172ff) of the pgf/tikZ manual and use one of the examples as a basic structure.


Best regards
Thorsten
User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

is this a table? (arrows in the table) please help

Post by gmedina »

Hi gcheer3,

the following code could be used as a starting point:

Code: Select all

\documentclass{article}
\usepackage[margin=2cm]{geometry}% to prevent a bad box
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{positioning,shapes,calc}

\begin{document}

\begin{tikzpicture}[node distance=6mm and 11mm,
text height=1ex,text depth=1ex]

% nodes in the first row
\node (b1) {0};
\node (c1) [right=of b1] {1};
\node (d1) [right=of c1] {2};
\node (aux1) [right=of d1] {};
\node (e1) [right=of aux1] {3};
\node (aux2) [right=of e1] {};
\node (aux3) [right=of aux2] {};
\node (f1) [right=of aux3] {4};

% nodes in the second row
\node (b2) [below=of b1] {1};
\node (a2) [left=of b2] {0};
\node (c2) [below=of c1] {1};
\node (d2) [below=of d1] {1};
\node (e2) [below=of e1] {--};
\node (f2) [below=of f1] {--};

% nodes in the third row
\node (a3) [below=of a2] {1};
\node (b3) [below=of b2] {0};
\node (c3) [below=of c2] {$\omega_1$};
\node (d3) [below=of d2] {$\omega_1+\omega_2$};
\node (e3) [below=of e2] {$\omega_1+\omega_2+\omega_3$\hspace*{.5cm}};
\node (f3) [below=of f2] {--};

% nodes in the fourth row
\node (a4) [below=of a3] {2};
\node (b4) [below=of b3] {0};
\node (c4) [below=of c3] {0};
\node (d4) [below=of d3] {$\omega_1\omega_2$};
\node (e4) [below=of e3]%
  {$\omega_1\omega_2+\omega_1\omega_3+\omega_2\omega_3$};
\node[text width=3cm, text centered] (f4) [below=of f3] %
  {$\omega_1\omega_2+\omega_1\omega_3+\omega_1\omega_4$\\%
   $\omega_2\omega_3+\omega_2\omega_4+\omega_3\omega_4$};

% some other nodes
\node (n) at ($(a3)+(-7mm,0mm)$) {$n$};
\node (N) at ($(aux1)+(0mm,7mm)$) {$N$};

% drawing the frame
\draw[very thick] ($(b2)+(-1cm,.7cm)$) rectangle ($(f4)+(2.5cm,-1cm)$);

% drawing the arrows
\draw[->] (b2) to (c2);
\draw[->] (c2) to (d2);
\draw[->] (c3) to node [above=0pt-4pt]{$\scriptscriptstyle +$} (d3);
\draw[->] (d3) to node [above=0pt-4pt]{$\scriptscriptstyle +$} (e3);
\draw[->] (d4) to node [above=0pt-4pt]{$\scriptscriptstyle +$} (e4);
\draw[->] (e4) to node [above=0pt-4pt]{$\scriptscriptstyle +$} (f4);
\draw[->] (b2) to node [right]{$\scriptstyle\times\omega_1$} (c3);
\draw[->] (c3) to node [right]{$\scriptstyle\times\omega_2$} (d4);
\draw[->] (c2) to node [right]{$\scriptstyle\times\omega_2$} (d3);
\draw[->] (d3) to node [right]{$\scriptstyle\times\omega_3$} (e4.north west);
\draw[->] (d2) to node [right]{$\scriptstyle\times\omega_3$} (e3.north west);
\draw[->] (e3.south east) to node [right]{\ $\scriptstyle\times\omega_4$} (f4.north west);

\end{tikzpicture}

\end{document} 
The above code is just an example and, as such, it can be highly improved; as localghost has already suggested, the pgfmanual will teach you many more options to improve my example.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

is this a table? (arrows in the table) please help

Post by frabjous »

I'm pretty sure those are just w's, not omegas, so a slight modification of the above:

Code: Select all

    \documentclass{article}
    \usepackage[margin=2cm]{geometry}% to prevent a bad box
    \usepackage{amsmath}
    \usepackage{tikz}
    \usetikzlibrary{positioning,shapes,calc}

    \begin{document}

    \begin{tikzpicture}[node distance=6mm and 11mm,
    text height=1ex,text depth=1ex]

    % nodes in the first row
    \node (b1) {0};
    \node (c1) [right=of b1] {1};
    \node (d1) [right=of c1] {2};
    \node (aux1) [right=of d1] {};
    \node (e1) [right=of aux1] {3};
    \node (aux2) [right=of e1] {};
    \node (aux3) [right=of aux2] {};
    \node (f1) [right=of aux3] {4};

    % nodes in the second row
    \node (b2) [below=of b1] {1};
    \node (a2) [left=of b2] {0};
    \node (c2) [below=of c1] {1};
    \node (d2) [below=of d1] {1};
    \node (e2) [below=of e1] {--};
    \node (f2) [below=of f1] {--};

    % nodes in the third row
    \node (a3) [below=of a2] {1};
    \node (b3) [below=of b2] {0};
    \node (c3) [below=of c2] {$w_1$};
    \node (d3) [below=of d2] {$w_1+w_2$};
    \node (e3) [below=of e2] {$w_1+w_2+w_3$\hspace*{.5cm}};
    \node (f3) [below=of f2] {--};

    % nodes in the fourth row
    \node (a4) [below=of a3] {2};
    \node (b4) [below=of b3] {0};
    \node (c4) [below=of c3] {0};
    \node (d4) [below=of d3] {$w_1w_2$};
    \node (e4) [below=of e3]%
      {$w_1w_2+w_1w_3+w_2w_3$};
    \node[text width=3.5cm, text centered] (f4) [below=of f3] %
      {$w_1w_2+w_1w_3+w_1w_4+$\\%
       $w_2w_3+w_2w_4+w_3w_4$};

    % some other nodes
    \node (n) at ($(a3)+(-7mm,0mm)$) {$n$};
    \node (N) at ($(aux1)+(0mm,7mm)$) {$N$};

    % drawing the frame
    \draw[very thick] ($(b2)+(-1cm,.7cm)$) rectangle ($(f4)+(2.5cm,-1cm)$);

    % drawing the arrows
    \draw[->] (b2) to (c2);
    \draw[->] (c2) to (d2);
    \draw[->] (c3) to node [above=0pt-4pt]{$\scriptscriptstyle +$} (d3);
    \draw[->] (d3) to node [above=0pt-4pt]{$\scriptscriptstyle +$} (e3);
    \draw[->] (d4) to node [above=0pt-4pt]{$\scriptscriptstyle +$} (e4);
    \draw[->] (e4) to node [above=0pt-4pt]{$\scriptscriptstyle +$} (f4);
    \draw[->] (b2) to node [right]{$\scriptstyle\times w_1$} (c3);
    \draw[->] (c3) to node [right]{$\scriptstyle\times w_2$} (d4);
    \draw[->] (c2) to node [right]{$\scriptstyle\times w_2$} (d3);
    \draw[->] (d3) to node [right]{$\scriptstyle\times w_3$} (e4.north west);
    \draw[->] (d2) to node [right]{$\scriptstyle\times w_3$} (e3.north west);
    \draw[->] (e3) to node [right]{\ $\scriptstyle\times w_4$} (f4.north west);

    \end{tikzpicture}

    \end{document} 
But yes, tweaking to your liking is probably still called for.
gcheer3
Posts: 41
Joined: Wed Jun 25, 2008 4:39 pm

Re: is this a table? (arrows in the table) please help

Post by gcheer3 »

Thanks both of you, Gmedina and Thorsten!

Your code is really helpful, and I will read the chapter carefully.

Thanks a loooooot!
Post Reply