TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

 a ladder diagram

This is a ladder diagram I need help in drawing it using Tikz, please help me.

share|improve this question
5  
People appreciate if you indicate what you have tried. Did you read the manual for the tikz-cd package, for example? – Benjamin McKay Mar 10 at 18:45
    
The manual you mentioned have just the basic and simple examples – s k Mar 10 at 20:03
4  
An given a little thought those examples should be enough to produce something that looks like this. At the moment this question is more like: please make this for me, a type of question generally disliked here. At least show a bit of effort – daleif Mar 10 at 20:12
    
@daleif. No, you are wrong it's not like this. – s k Mar 10 at 20:37

You can use a \foreach loop like this:

\documentclass[tikz,border=2pt]{standalone}
\usetikzlibrary{positioning,quotes}
\begin{document}

\begin{tikzpicture}
  \node(g-0){$G_{i_0}$};
  \node(h-0)[below right=1cm of g-0]{$h_{j_0}$};
  \foreach \i [count=\j from 0]in {1,...,3}{
  \ifnum\i<3{
    \node [right=2cm of g-\j](g-\i){$G_{i_\i}$}; 
    \node [right=2cm of h-\j](h-\i){$H_{j_\i}$};
  }\else{
    \node [right=2cm of g-\j](g-\i){$G_{i_\i} \dots$}; 
    \node [right=2cm of h-\j](h-\i){$\dots$};
  }\fi
  \path (g-\j) edge[<-,"$\lambda_{i_\j i_\i}$"] (g-\i) edge[<-] (h-\j);
  \path (h-\j) edge[<-] (g-\i) edge[<-,"$\mu_{j_\j j_\i}$"] (h-\i);
  }
\end{tikzpicture}

\end{document}

enter image description here

share|improve this answer
    
Thanks AboAmmar, I appreciate your help – s k Mar 10 at 20:12

Here's an implementation with tikz-cd:

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz-cd}

\begin{document}

\[
\begin{tikzcd}[column sep=small]
G_{i_0} &&
  G_{i_1} \arrow[ll,swap,"\lambda_{i_0,i_1}"] \arrow[dl] &&
  G_{i_2} \arrow[ll,swap,"\lambda_{i_1,i_2}"] \arrow[dl] &&
  G_{i_3}\makebox[0pt][l]{ $\cdots$}
    \arrow[ll,swap,"\lambda_{i_2,i_3}"] \arrow[dl] &&
\\
& H_{j_0} \arrow[ul] &&
  H_{j_1} \arrow[ll,swap,"\mu_{j_0,j_1}"] \arrow[ul] &&
  H_{j_2} \arrow[ll,swap,"\mu_{j_1,j_2}"] \arrow[ul] &&
  \cdots \arrow[ll,swap,"\mu_{j_2,j_3}"]
\end{tikzcd}
\]

\end{document}

enter image description here

share|improve this answer

The package xymatrix is also good at this sort of diagram.

A ladder-style diagram

\documentclass[border=5mm]{standalone}
\usepackage[arrow,matrix,pdf]{xy}
\begin{document}
\begin{xymatrix}@C20pt{
    G_{i_0}\ar@{<-}[rr]^{\lambda_{{i_0},{i_1}}}\ar@{<-}[rd] &&
    G_{i_1}\ar@{<-}[rr]^{\lambda_{{i_1},{i_2}}}\ar@{<-}[rd] && 
    G_{i_2}\ar@{<-}[rr]^{\lambda_{{i_2},{i_3}}}\ar@{<-}[rd] && 
    G_{i_3}\rlap{$\cdots$}\ar@{<-}[rd] \\
  & H_{j_0}\ar@{<-}[rr]^{\mu_{{j_0},{j_1}}}\ar@{<-}[ru] &&
    H_{j_1}\ar@{<-}[rr]^{\mu_{{j_1},{j_2}}}\ar@{<-}[ru] && 
    H_{j_2}\ar@{<-}[rr]^{\mu_{{j_2},{j_3}}}\ar@{<-}[ru] &&
    H_{j_3}\rlap{$\cdots$} \\
} 
\end{xymatrix}
\end{document}

Notes

  • Options to the xy package: arrow defines the \ar... command; matrix defines the xymatrix environment; and pdf makes the output look better.

  • The syntax of the xymatrix environment is [setup]{rows...}. Here the setup is @C20pt which sets the cell spacing to 20pt.

  • The rows are like a regular tabular - & to delimit cells \\ to mark lines.

  • Each cell consists of some maths mode text, followed by one or more arrows.

  • The \ar syntax is: \ar @{style} [direction] ^{upper label}.

  • Labels and styles are optional.

  • Style @{<-} draws a reverse arrow.

  • Direction [rr] extends the arrow two cells to the right, [ru] one right, one up, and so on...

  • I used \rlap for the dots at the end, in order to get the spacing right.

share|improve this answer

And how about a luamplib version, showing off some Unicode maths?

enter image description here

\documentclass[border=5mm]{standalone}
\usepackage{unicode-math}
\setmathfont[math-style=upright]{Neo Euler}
\usepackage{luamplib}
\begin{document}
\mplibtextextlabel{enable}
\begin{mplibcode}
vardef connect(expr a, b) = 
  drawarrow a--b cutbefore fullcircle scaled 22 shifted a
                 cutafter  fullcircle scaled 22 shifted b
enddef;                
beginfig(1);
c = r = 42;

string upper_node_name, upper_arrow_mark, 
       lower_node_name, lower_arrow_mark; 

pair A,B,C,D;       

ahangle := 25; % slim arrow heads

for i=0 upto 2:

  upper_node_name := "$G_{i_" & decimal i & "}$";
  lower_node_name := "$H_{i_" & decimal i & "}$";
  upper_arrow_mark := "$λ_{i_" & decimal i & ",i_" & decimal (i+1) & "}$";
  lower_arrow_mark := "$μ_{i_" & decimal i & ",i_" & decimal (i+1) & "}$";

  A := (2c*i,0);         B := A shifted (2c,0);
  C := A shifted (c,-r); D := C shifted (2c,0);

  label(upper_node_name, A);
  label(lower_node_name, C);
  label.top(upper_arrow_mark, 1/2[A,B]);
  label.top(lower_arrow_mark, 1/2[C,D]);

  connect(B,A);
  connect(C,A);
  connect(B,C);
  connect(D,C);

endfor

label("$G_{i_3}$\rlap{$\cdots$}", B);
label("$\cdots$", D);

endfig;
\end{mplibcode}
\end{document}
share|improve this answer
    
That's an elegant way of getting some space around the expressions. I typically draw the labels as a pic and then do cutbefore bbox label1 etc. – Aditya Mar 11 at 22:42
    
@Aditya - thank you - I think a rounded "invisible" boundary often looks nicer but I have hard coded the 22 here. You could use something like fullcircle scaled abs(urcorner label1-llcorner label1) to get a more automatic size. A superellipse shape can also look nice. – Thruston Mar 11 at 23:48

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.