8

In the literature of sequence transformations, some algorithms are nicely represented as lozenge diagrams, e.g.

Wynn epsilon

or in an extended form,

Wynn table

I could probably cheat and use matrix, array or some such construct, but might there be a better way to render these in LaTeX?

7

I would use TikZ to draw such diagrams. Here's a small example drawing your diagram:

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{matrix}
\begin{document}
\begin{tikzpicture}
\matrix (m) [matrix of math nodes, row sep=2em, column sep=2em] {%
      & \varepsilon_k^{(n)}   &  \\
  \varepsilon_{k-1}^{(n+1)} & &  \varepsilon_{k+1}^{(n)} \\
      & \varepsilon_k^{(n+1)} &  \\ };
\path[-stealth] (m-2-1) edge (m-1-2) edge (m-3-2) ;
\path[stealth-] (m-2-3) edge (m-3-2) edge (m-1-2) ;
\end{tikzpicture}
\end{document} 

Output:

alt text

Alternative packages for such diagrams are xy-pic, amscd and PSTricks.

For more TikZ examples visit the TikZ example gallery or this blog TikZ category.

For the extended diagram, a matrix would be sufficient. But you could use the TikZ matrix of math nodes feature as well as in the first example, thus you could benefit from all features of TikZ like arrows, labelling, positioning and many more.

6
  • Hmm... as I suspected, I would require a package for this. Is there really no native way to do these lozenges in TeX/LaTeX?
    – user914
    Aug 20 '10 at 18:19
  • You won't get nice arrows.
    – Caramdir
    Aug 20 '10 at 18:26
  • What are your reasons not to use a package? I would understand if you don't have TikZ installed, but amscd and xy-pic should be available on many systems.
    – Stefan Kottwitz
    Aug 20 '10 at 18:33
  • 1
    Stefan: Well not very deep reasons, admittedly: the computer where I do the typesetting isn't mine to modify. But maybe I can coax the owner into letting me install TikZ. :)
    – user914
    Aug 20 '10 at 22:46
  • 2
    That's an important reason. Show him the TikZ example gallery texample.net/tikz/examples , what can be done with TikZ, it might convince him. ;-)
    – Stefan Kottwitz
    Aug 20 '10 at 23:45
1

I agree with Stefan, TikZ would be the best way to go:

\documentclass[parskip]{scrartcl}
\usepackage[margin=15mm]{geometry}
\usepackage{tikz}
\usetikzlibrary{arrows,scopes}
\usepackage{ifthen}

\begin{document}

\begin{tikzpicture}[x={(2cm,-0.5cm)},y={(0cm,-1cm)}]
    \foreach \x in {-1,...,3}
    {   \foreach \y in {0,...,3}
        {   \ifthenelse{\x=-1}{\xdef\more{=0}}{\ifthenelse{\x=0}{\xdef\more{=S_\y}}{\xdef\more{}}}
            \node[right] at (\x,\y) {$\epsilon_{\x}^{(\y)}\more$};
            \ifthenelse{\x=3}{\draw[dotted] (\x+0.5,\y) -- (\x+1,\y);}{}
            \ifthenelse{\y=3}{\draw[dotted] (\x+0.2,\y+0.5) -- (\x+0.2,6-\x/2);}{}
        }
    }
\end{tikzpicture}

\begin{tikzpicture}[x={(2cm,-1cm)},y={(0cm,-2cm)}]
    \node (l) at (0,0) {$\epsilon^{n+1}_{k-1}$};
    \node (b) at (2,0) {$\epsilon^{n+1}_{k-1}$};
    \node (t) at (2,-2) {$\epsilon^{n+1}_{k-1}$};
    \node (r) at (4,-2) {$\epsilon^{n+1}_{k-1}$};
    \draw[-latex] (l.20) -- (t.200);
    \draw[-latex] (l.340) -- (b.160);
    \draw[-latex] (t.340) -- (r.160);
    \draw[-latex] (b.20) -- (r.200);
\end{tikzpicture}

\end{document}

enter image description here

1

For the first diagram you could use any package that is used for drawing commutative diagrams. I usually use TikZ (see also Commutative Diagramms using TikZ).

The second picture can be typeset like this:

\documentclass{article}
\usepackage{amsmath}
\renewcommand\epsilon\varepsilon
\begin{document}
\[ 
\begin{matrix}
    \epsilon_{-1}^{(0)} = 0 &                          &                    &                    & \\
                            & \epsilon_{0}^{(0)} = S_0 &                    &                    & \\
    \epsilon_{-1}^{(1)} = 0 &                          & \epsilon_{1}^{(0)} &                    & \\
                            & \epsilon_{0}^{(1)} = S_1 &                    & \epsilon_{2}^{(0)} & \\
    \epsilon_{-1}^{(2)} = 0 &                          & \epsilon_{1}^{(1)} &                    & \ddots \\
    \vdots                  & \epsilon_{0}^{(2)} = S_2 &                    & \epsilon_{2}^{(1)} & \\
    \vdots                  & \vdots                   & \epsilon_{1}^{(1)} &                    & \ddots \\
    \vdots                  & \vdots                   & \vdots             & \epsilon_{2}^{(2)} & \\
    \vdots                  & \vdots                   & \vdots             & \vdots             & \ddots \\
\end{matrix}
\]
\end{document}

enter image description here

1
  • Caramdir (I'll reply here in your answer): Well if I don't need the arrows, like in the extended diagram, what would be the proper way of using matrix (or any of the other similar commands)?
    – user914
    Aug 20 '10 at 22:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy