8

I have

\begin{tikzpicture}[->,auto,node distance=3cm,
  thick,main node/.style={draw,font=\bfseries}]
  \node[main node] (111) at (0,1) {$X_{1,1}^{(1)}$};
  \node[main node] (121) at (0,2) {$X_{1,2}^{(1)}$};
  \node[main node] (1n1) at (0,4) {$X_{1,n}^{(1)}$};
  \node[main node] (211) at (0,6) {$X_{2,1}^{(1)}$};
  \node[main node] (221) at (0,7) {$X_{2,2}^{(1)}$};
  \node[main node] (2n1) at (0,9) {$X_{2,n}^{(1)}$};
  \node[main node] (n11) at (0,11) {$X_{n,1}^{(1)}$};
  \node[main node] (n21) at (0,12) {$X_{n,2}^{(1)}$};
  \node[main node] (nn1) at (0,14) {$X_{n,n}^{(1)}$};
  \node[main node] (112) at (2.5,1) {$X_{1,1}^{(2)}$};
  \node[main node] (122) at (2.5,2) {$X_{1,2}^{(2)}$};
  \node[main node] (1n2) at (2.5,4) {$X_{1,n}^{(2)}$};
  \node[main node] (212) at (2.5,6) {$X_{2,1}^{(2)}$};
  \node[main node] (222) at (2.5,7) {$X_{2,2}^{(2)}$};
  \node[main node] (2n2) at (2.5,9) {$X_{2,n}^{(2)}$};
  \node[main node] (n12) at (2.5,11) {$X_{n,1}^{(2)}$};
  \node[main node] (n22) at (2.5,12) {$X_{n,2}^{(2)}$};
  \node[main node] (nn2) at (2.5,14) {$X_{n,n}^{(2)}$};
  \node[main node] (11k) at (6,1) {$X_{1,1}^{(k)}$};
  \node[main node] (12k) at (6,2) {$X_{1,2}^{(k)}$};
  \node[main node] (1nk) at (6,4) {$X_{1,n}^{(k)}$};
  \node[main node] (21k) at (6,6) {$X_{2,1}^{(k)}$};
  \node[main node] (22k) at (6,7) {$X_{2,2}^{(k)}$};
  \node[main node] (2nk) at (6,9) {$X_{2,n}^{(k)}$};
  \node[main node] (n1k) at (6,11) {$X_{n,1}^{(k)}$};
  \node[main node] (n2k) at (6,12) {$X_{n,2}^{(k)}$};
  \node[main node] (nnk) at (6,14) {$X_{n,n}^{(k)}$};
  \node[main node] (11n2) at (9.5,1) {$X_{1,1}^{(n-2)}$};
  \node[main node] (12n2) at (9.5,2) {$X_{1,2}^{(n-2)}$};
  \node[main node] (1nn2) at (9.5,4) {$X_{1,n}^{(n-2)}$};
  \node[main node] (21n2) at (9.5,6) {$X_{2,1}^{(n-2)}$};
  \node[main node] (22n2) at (9.5,7) {$X_{2,2}^{(n-2)}$};
  \node[main node] (2nn2) at (9.5,9) {$X_{2,n}^{(n-2)}$};
  \node[main node] (n1n2) at (9.5,11) {$X_{n,1}^{(n-2)}$};
  \node[main node] (n2n2) at (9.5,12) {$X_{n,2}^{(n-2)}$};
  \node[main node] (nnn2) at (9.5,14) {$X_{n,n}^{(n-2)}$};
  \node[main node] (11n1) at (12,1) {$X_{1,1}^{(n-1)}$};
  \node[main node] (12n1) at (12,2) {$X_{1,2}^{(n-1)}$};
  \node[main node] (1nn1) at (12,4) {$X_{1,n}^{(n-1)}$};
  \node[main node] (21n1) at (12,6) {$X_{2,1}^{(n-1)}$};
  \node[main node] (22n1) at (12,7) {$X_{2,2}^{(n-1)}$};
  \node[main node] (2nn1) at (12,9) {$X_{2,n}^{(n-1)}$};
  \node[main node] (n1n1) at (12,11) {$X_{n,1}^{(n-1)}$};
  \node[main node] (n2n1) at (12,12) {$X_{n,2}^{(n-1)}$};
  \node[main node] (nnn1) at (12,14) {$X_{n,n}^{(n-1)}$};
  \path
    (111) edge (112)
        edge (122)
        edge (1n2)
    (121) edge (112)
        edge (122)
        edge (1n2)
    (1n1) edge (112)
        edge (122)
        edge (1n2)
    (121) edge[--,dashed] (1n1);
\end{tikzpicture}

I just want simple lines, no arrows. How to manage with edge to achieve that? Thanks

  • 1
    Use a single - instead of a double one for switching off the arrow locally. – Jake Apr 16 '12 at 6:10
  • 3
    What about removing -> from the options to the tikzpicture environment? – egreg Apr 16 '12 at 6:11
9

It's also beneficial to use matrix nodes to reduce the typing labor. I used to a small Excel file to strip down the node names and to populate the matrix.

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix[matrix of math nodes, nodes={draw,font=\bfseries},row sep ={1cm,between origins},column sep={2cm,between origins}] (m) {
X_{n,n}^{(1)} &[0.5cm] X_{n,n}^{(2)} &[2cm] X_{n,n}^{(k)} &[1cm] X_{n,n}^{(n-2)} &[0.5cm] X_{n,n}^{(n-1)}\\[1cm]
X_{n,2}^{(1)} &        X_{n,2}^{(2)} &      X_{n,2}^{(k)} &      X_{n,2}^{(n-2)} &        X_{n,2}^{(n-1)}\\
X_{n,1}^{(1)} &        X_{n,1}^{(2)} &      X_{n,1}^{(k)} &      X_{n,1}^{(n-2)} &        X_{n,1}^{(n-1)}\\[1cm]
X_{2,n}^{(1)} &        X_{2,n}^{(2)} &      X_{2,n}^{(k)} &      X_{2,n}^{(n-2)} &        X_{2,n}^{(n-1)}\\[1cm]
X_{2,2}^{(1)} &        X_{2,2}^{(2)} &      X_{2,2}^{(k)} &      X_{2,2}^{(n-2)} &        X_{2,2}^{(n-1)}\\
X_{2,1}^{(1)} &        X_{2,1}^{(2)} &      X_{2,1}^{(k)} &      X_{2,1}^{(n-2)} &        X_{2,1}^{(n-1)}\\[1cm]
X_{1,n}^{(1)} &        X_{1,n}^{(2)} &      X_{1,n}^{(k)} &      X_{1,n}^{(n-2)} &        X_{1,n}^{(n-1)}\\[1cm]
X_{1,2}^{(1)} &        X_{1,2}^{(2)} &      X_{1,2}^{(k)} &      X_{1,2}^{(n-2)} &        X_{1,2}^{(n-1)}\\
X_{1,1}^{(1)} &        X_{1,1}^{(2)} &      X_{1,1}^{(k)} &      X_{1,1}^{(n-2)} &        X_{1,1}^{(n-1)}\\
};
  \path[thick]
    (m-7-1) edge (m-7-2)
        edge (m-8-2)
        edge (m-9-2)
    (m-8-1) edge (m-7-2)
        edge (m-8-2)
        edge (m-9-2)
    (m-9-1) edge (m-7-2)
        edge (m-8-2)
        edge (m-9-2)
    (m-7-1) edge[-,dashed] (m-8-1);
\end{tikzpicture}
\end{document}

enter image description here

15

There is no arrow with edge by default, but you have turned on arrows for all lines in the tikzpicture with the -> argument:

\begin{tikzpicture}[->,auto,node distance=3cm,
   thick,main node/.style={draw,font=\bfseries}]

Remove -> and there are no arrows.

Or as commented by Jake, use - as an argument to the \path (or edge) to remove the arrows locally.

\path[-]
(111) edge (112)
    edge (122)
    edge (1n2)
(121) edge (112)
    edge (122)
    edge (1n2)
(1n1) edge (112)
    edge (122)
    edge (1n2)
(121) edge[dashed] (1n1);

You could also put the \path drawing the lines in a scope environment and use the same argument. Could be convenient if you had several \path/\draw commands for which you wanted to apply this.

\begin{scope}[-]
  \path
  (111) edge (112)
      edge (122)
      edge (1n2)
    (121) edge (112)
      edge (122)
      edge (1n2)
  (1n1) edge (112)
      edge (122)
       edge (1n2)
  (121) edge[dashed] (1n1);
\end{scope}

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.