# Line Arrows for Tabular Integration Table

I've recently reviewed this question to try to make a table for Integration by parts:

Tabular integration by parts

I tried using the code sample from it but LaTeX gives me a rendering error with the tikz arrows (and I don't know what it was so I just removed the tikz code entirely); however, it does not when I just use the table. My code is below:

    \documentclass{article}
\usepackage{gensymb}
\usepackage{graphicx}
\usepackage[fleqn]{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage[usenames,dvipsnames]{color}
\usepackage{fullpage}
\usepackage{cancel}
\usepackage{easylist}
\usepackage{booktabs}
\usepackage{xparse}
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{framed}
\usepackage{tcolorbox}
\usepackage[fleqn]{amsmath}
\usepackage{framed,varwidth}
\usepackage{enumitem, color, amssymb}
\providecommand{\e}[1]{\ensuremath{\times 10^{#1}}}
\begin{document}
1. $\displaystyle{\int x^6\cdot e^x dx}$ \\
\newline
Make a table of u and its derivatives \& dv and its integrals...
$\renewcommand{\arraystretch}{1.5} \begin{array}{c @{\hspace*{1.0cm}} c}\toprule D & I \\\cmidrule{1-2} x^6\tikzmark{Left 1} & \tikzmark{Right 1}e^x \\ 6x^5\tikzmark{Left 2} & \tikzmark{Right 2}e^x \\ 30x^4 \tikzmark{Left 3} & \tikzmark{Right 3}e^x \\ 120x^3 \tikzmark{Left 4} & \tikzmark{Right 4}e^x \\ 360x^2 \tikzmark{Left 5} & \tikzmark{Right 5} e^x \\ 720x \tikzmark{Left 6} & \tikzmark{Right 6} e^x \\ 720 \tikzmark{Left 7} & \tikzmark{Right 7} e^x \\ 0 \tikzmark{Left 8} & \tikzmark{Right 8} e^x \\\bottomline \end{array}$

\DrawArrow{Left 1}{Right 2}{$+$}
\DrawArrow{Left 2}{Right 3}{$-$}
\DrawArrow{Left 3}{Right 4}{$+$}
\DrawArrow{Left 4}{Right 5}{$-$}
\DrawArrow{Left 5}{Right 6}{$+$}
\DrawArrow{Left 6}{Right 7}{$-$}
\DrawArrow{Left 7}{Right 8}{$+$}
\end{document}


Is there an alternative to the post I linked to make the arrows & the plus or minus signs?

• Er... well... what error? If this is due to differing versions of PGF, one alternative (to not having arrows) is to (1) update the code or (2) update your system (whichever is applicable). – cfr Feb 1 '15 at 1:28
• Are all those packages really necessary to help you? Will I not be able to reproduce the problem if I don't have them all installed? [It surely isn't necessary to load half of them twice, in any case.] – cfr Feb 1 '15 at 1:28
• I can edit my post to include all my code so it can be rendered but it'll be a little more lengthier...it must be clashing with something else in my document. Would you like the full code? – cbutcher12 Feb 1 '15 at 1:29
• No. We need a minimal working example (MWE) that illustrates your problem. Note that there is a second solution using pstricks. So that's another alternative. Also, tikzmark is now available as a TiKZ library. – cfr Feb 1 '15 at 1:32
• Probably you wanted \bottomrule? – cfr Feb 1 '15 at 2:12

Here is the corrected version of your code:

## Changes:

1. Included the required \tikzmark, \DrawArrow and related macros from the linked question and eliminated the unnecessary packages.
2. Used enumerate to number it -- am assuming that there may be more.
3. Added trailing % following the calls to \DrawArrow.
4. Used \dots instead of ....
5. Replaced \bottomrule with \bottomline.

## Code:

\documentclass{article}
\usepackage{booktabs}
\usepackage{xparse}
\usepackage{tikz}
\usetikzlibrary{calc}

\tikzset{Arrow Style/.style={text=black, font=\boldmath}}

\newcommand{\tikzmark}[1]{%
\tikz[overlay, remember picture, baseline] \node (#1) {};%
}
\newcommand*{\XShift}{0.5em}
\newcommand*{\YShift}{0.5ex}
\NewDocumentCommand{\DrawArrow}{s O{} m m m}{%
\begin{tikzpicture}[overlay,remember picture]
\draw[->, thick, Arrow Style, #2]
($(#3.west)+(\XShift,\YShift)$) --
($(#4.east)+(-\XShift,\YShift)$)
node [midway,above] {#5};
\end{tikzpicture}%
}

\begin{document}
\begin{enumerate}
\item $\displaystyle{\int x^6\cdot e^x dx}$

Make a table of $u$ and its derivatives \& $\mathrm{d}v$ and its integrals\dots
$\renewcommand{\arraystretch}{1.5} \begin{array}{c @{\hspace*{1.0cm}} c}\toprule D & I \\\cmidrule(lr){1-2} x^6 \tikzmark{Left 1} & \tikzmark{Right 1} e^x \\ 6x^5 \tikzmark{Left 2} & \tikzmark{Right 2} e^x \\ 30x^4 \tikzmark{Left 3} & \tikzmark{Right 3} e^x \\ 120x^3 \tikzmark{Left 4} & \tikzmark{Right 4} e^x \\ 360x^2 \tikzmark{Left 5} & \tikzmark{Right 5} e^x \\ 720x \tikzmark{Left 6} & \tikzmark{Right 6} e^x \\ 720 \tikzmark{Left 7} & \tikzmark{Right 7} e^x \\ 0 \tikzmark{Left 8} & \tikzmark{Right 8} e^x \\\bottomrule \end{array}%$
% --------
\DrawArrow{Left 1}{Right 2}{$+$}% <-- Don't forget there.
\DrawArrow{Left 2}{Right 3}{$-$}%
\DrawArrow{Left 3}{Right 4}{$+$}%
\DrawArrow{Left 4}{Right 5}{$-$}%
\DrawArrow{Left 5}{Right 6}{$+$}%
\DrawArrow{Left 6}{Right 7}{$-$}%
\DrawArrow{Left 7}{Right 8}{$+$}%
\end{enumerate}
\end{document}

• The enumerating and dot are preference but I like the rest! – cbutcher12 Feb 7 '15 at 1:51
• I apologize for accidentally not clicking the green arrow from Feb. 7th at 1:51... – cbutcher12 Jun 11 '15 at 7:18
• Okay, I'll differentiate next time...thanks! – cbutcher12 Jun 11 '15 at 23:44