Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Latex Help

Tags:
  1. Jun 5, 2013 #1
    Hello,

    I have the following Latex code, and I need to draw an arrow that connect each column by the corresponding entry in the last (separated) row, e.g.: the column [x_0^{(1)} x_0^{(2)} ... x_0^{(M)}]^T with the entry x_0^{(R)} and so on. How can I do that?

    Code (Text):
    \documentclass{article}
    \usepackage{tikz}
    \usepackage{amsmath}
    \usetikzlibrary{matrix}
    \begin{document}

    \tikzset{
        table/.style={
            matrix of nodes,
            row sep=-\pgflinewidth,
            column sep=-\pgflinewidth,
            nodes={
                rectangle,
                draw=black,
                align=center
            },
            minimum height=1.5em,
            text depth=0.5ex,
            text height=2ex,
            nodes in empty cells,
    %%
            %every even row/.style={
                %nodes={fill=gray!20}
            %},
            column 1/.style={
                nodes={text width=2em,font=\bfseries}
            },
                    column 2/.style={
                nodes={text=red}
            },
                    column 3/.style={
                nodes={text=blue}
            },
                    column 5/.style={
                nodes={text=violet}
            },
            row 5/.style={
                nodes={
                    fill=gray!20,
                    %text=black,
                    font=\bfseries
                }
            }
        }
    }

    \begin{tikzpicture}

    \matrix (first) [table,text width=6em]
    {
    $\mathbf{x}^{(1)}$   & $x_0^{(1)}$ & $x_1^{(1)}$ & $\cdots$ & $x_{N-1}^{(1)}$ \\
    $\mathbf{x}^{(2)}$   & $x_0^{(2)}$ & $x_1^{(2)}$ & $\cdots$ & $x_{N-1}^{(2)}$ \\
    $\vdots$             & $\vdots$    & $\vdots$    & $\ddots$ & $\vdots$ \\
    $\mathbf{x}^{(M)}$   & $x_0^{(M)}$ & $x_1^{(M)}$ & $\cdots$ & $x_{N-1}^{(M)}$ \\[10mm]
    $\mathbf{x}^{(R)}$   & $x_0^{(R)}$ & $x_1^{(R)}$ & $\cdots$ & $x_{N-1}^{(R)}$ \\
    };


    \end{tikzpicture}
    \end{document}
    Thanks in advance
     
  2. jcsd
  3. Jun 5, 2013 #2

    Hepth

    User Avatar
    Gold Member

    I did one for you. I checked out this site for examples, always love learning new latex packages.

    www.texample.net/tikz/examples/feature/arrows/

    Basically I labelled to areas using the label maker for nodes : |[name=a]|

    Then after the matrix I drew an arrow from a to b. So repeat wherever you need it.

    Code (Text):
    \matrix (first) [table,text width=6em]
    {
    $\mathbf{x}^{(1)}$   & $x_0^{(1)}$ & $x_1^{(1)}$ & $\cdots$ & $x_{N-1}^{(1)}$ \\
    $\mathbf{x}^{(2)}$   & $x_0^{(2)}$ & $x_1^{(2)}$ & $\cdots$ & $x_{N-1}^{(2)}$ \\
    $\vdots$             & $\vdots$    & $\vdots$    & $\ddots$ & $\vdots$ \\
    |[name=a]| $\mathbf{x}^{(M)}$   & $x_0^{(M)}$ & $x_1^{(M)}$ & $\cdots$ & $x_{N-1}^{(M)}$\\[10mm]
    |[name=b]| $\mathbf{x}^{(R)}$   & $x_0^{(R)}$ & $x_1^{(R)}$ & $\cdots$ & $x_{N-1}^{(R)}$ \\
    };
     \draw[->,thick] (a) edge (b);
     
     
  4. Jun 5, 2013 #3
    Perfect. Look very nice. Thanks
     
  5. Jun 5, 2013 #4
    Another question: How can I remove a cell completely?
     
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook




Similar Discussions: Latex Help
  1. LaTeX Help (Replies: 5)

  2. Help on LaTeX (Replies: 1)

  3. LaTeX picture help (Replies: 1)

  4. Latex Help (Replies: 9)

  5. LaTeX help (Replies: 2)

Loading...