2

I have created the following "table" as part of a larger document:

\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[fleqn]{mathtools}
\usepackage{tikz}
\usetikzlibrary{positioning}

\newcommand*{\dd}[3][]{\tfrac{\mathrm{d}^{#1}#2}{\mathrm{d}#3^{#1}}}
\newcommand*{\D}[1]{\mathop{}\!\mathrm{d} #1}

\begin{document}
\begin{tikzpicture}[node distance=0.5ex and 1em]
  \node (d0) {\(u\)};
  \node[right=of d0] (i0) {\(\D{v}\)};
  \node[below=of d0] (d1) {\(\dd{u}{x}\)};
  \node[right=of d1] (i1) {\(\int \D{v} \D{x}\)};
  \node[below=of d1] (d2) {\(\dd[2]{u}{x}\)};
  \node[right=of d2] (i2) {\(\int\left(\int\D{v}\D{x}\right)\D{x}\)};
  \node[below=of d2] (d3) {\(\cdots\)};
  \node[right=of d3] (i3) {\(\int\left(\int\left(\int\D{v}\D{x}\right)\D{x}%
    \right)\D{x}\)};
  \node[below=of i3] (i4) {\(\cdots\)};

  \draw (d0.east) -- (i1.west) (d1.east) -- (i2.west) (d2.east) -- (i3.west);
\end{tikzpicture}
\end{document}

Now this is okay (perhaps a little worse than that). How can I improve this design? I was thinking that to make the lines all straight making the first column right-aligned and the second column left-aligned would help, but I do not know how to do this. Any suggestions?

1 Answers1

1

Not sure exactly what you are looking for, but here is one option is to use the to syntax and specify an out= and in= angles.

enter image description here

Code:

\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[fleqn]{mathtools}
\usepackage{tikz}
\usetikzlibrary{positioning}

\newcommand{\dd}[3][]{\tfrac{\mathrm{d}^{#1}#2}{\mathrm{d}#3^{#1}}} \newcommand{\D}[1]{\mathop{}!\mathrm{d} #1}

\tikzset{My Line Style/.style={out=0, in=180, thick, blue, shorten <=-0.5ex, shorten >=-0.5ex, distance=1.0em, -stealth}}

\begin{document} \begin{tikzpicture}[node distance=0.5ex and 1em] \node (d0) {(u)}; \node[right=of d0] (i0) {(\D{v})}; \node[below=of d0] (d1) {(\dd{u}{x})}; \node[right=of d1] (i1) {(\int \D{v} \D{x})}; \node[below=of d1] (d2) {(\dd[2]{u}{x})}; \node[right=of d2] (i2) {(\int\left(\int\D{v}\D{x}\right)\D{x})}; \node[below=of d2] (d3) {(\cdots)}; \node[right=of d3] (i3) {(\int\left(\int\left(\int\D{v}\D{x}\right)\D{x}% \right)\D{x})}; \node[below=of i3] (i4) {(\cdots)};

\draw[My Line Style] (d0.east) to (i1.west); \draw[My Line Style] (d1.east) to (i2.west); \draw[My Line Style] (d2.east) to (i3.west); \end{tikzpicture} \end{document}

Peter Grill
  • 223,288
  • Ah that does look somewhat better. I was thinking that if I also did those alignments the arrows would all be the same. Is there a way to make the first column right-aligned and the second left-aligned? – carloabelli Mar 11 '16 at 03:35
  • I would recommend you not try to do a table in tikz. Use a tabular environment for the table and use tikzmark to mark the points where you want to draw the lines to/from. This example should get you started: Inserting an image properly in a table, but there are numerous other examples on this site. – Peter Grill Mar 11 '16 at 03:48