10

I would like to draw the following graph: enter image description here

without using any TikZ style library. I have tried putting \phantom to make X and Y aligned, it did not work (don't know why). Additionally, putting multiple alignments &, && etc. doesn't work, although it alignes correctly, now graph spans the whole line, which makes it ugly. I would be grateful for a neat solution.

I don't want any libraries because I think of using this in Mathjax.

1
  • 2
    I wouldn't use TikZ even if you didn't want to use this with MathJax. Since the diagram is simple I'd use something like xypic which provides far easier and more intuitive syntax.
    – Bakuriu
    Mar 30, 2015 at 16:59

4 Answers 4

13

You can use an array, e.g.

\begin{array}{ccccccc}
X_0 & \to & X_1 & \to & X_2 & \to & \dots \\
\downarrow && \downarrow && \downarrow \\ 
Y_0 &  & Y_1 &  & Y_2 &  & \dots
\end{array}

Testing this on http://cdn.mathjax.org/mathjax/latest/test/sample-dynamic.html gives

enter image description here

0
12

For simple diagrams like these you can use the amscd environment:

\documentclass{article}
\usepackage{amscd}
\begin{document}
\[
\begin{CD}
X_0 @>>> X_1 @>>> X_2 @>>> \dots \\
@VVV @VVV @VVV \\
Y_0 @. Y_1 @. Y_2 @. \dots
\end{CD}
\]
\end{document}

Right, left, down and up arrows are denoted by @>>>, @<<<, @VVV and @AAA; an empty arrow is @.; an “equal” vertical arrow is @|, horizontal is @=.

With @>{f}>> you get a label f above the arrow, with @>>{f}> the arrow is below (you can fill both fields), the same for @<<<. It is respectively left and right for the vertical arrows @VVV and @AAA.

enter image description here

Within MathJax you need \require{AMScd}: this is what I get from http://cdn.mathjax.org/mathjax/latest/test/sample-dynamic.html

enter image description here

1
  • I did not know combining \require with MathJax. This is another great take-home know-how for me. Thanks!
    – odea
    Mar 29, 2015 at 14:39
4

With matrix and a horizontal spacing close to the normal one:

$$\begin{matrix}
X_0 & \hskip-7pt\rightarrow \hskip-7pt& X_1 & \hskip-7pt\rightarrow\hskip-7pt &X_2 & \hskip-7pt\cdots\\
\downarrow & &\downarrow & &\downarrow \\
Y_0 & &Y_1 & &Y_2 & \hskip-7pt\cdots 
\end{matrix}$$

enter image description here

3

A simple use of the tabbing environment would suffice:

\documentclass{article}
\begin{document}
\begin{tabbing}
$X_0_$ \= $\longrightarrow$ \= $X_1$ \= $\longrightarrow$ \= $X_2$ \= \ldots \\
$\downarrow$ \> \> $\downarrow$ \> \> $\downarrow$\\
$Y_0_$ \> \> $Y_1$ \> \> $Y_2$ \= \ldots \\
\end{tabbing}
\end{document}

This produces:

enter image description here

No packages needed.

2

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .