[Tex/LaTex] Tabular integration by parts

tables

All I am trying to do is write an integration by parts table in LaTeX. I can't seem to find an .tex code examples anywhere though I have seen pictures of such tables in PDF form (like at http://cazelais.disted.camosun.bc.ca/187/parts.pdf for example). Hopefully someone can let me know real quick.

Best Answer

I assume you are asking about the tabular method of integration by parts, and one way would be to use tikzmark to note the location of the points and the after the table draw the arrows between the appropriate points:

enter image description here

Note:

  • This does require two runs. First one to determine the locations, and the second to do the drawing.

  • The \tikzmark is from Adding a large brace next to a body of text.

  • You can globally alter the style of the arrows via Arrow Style.

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}
\[
    \renewcommand{\arraystretch}{1.5}
    \begin{array}{c @{\hspace*{1.0cm}} c}\toprule
       D & I \\\cmidrule{1-2}
      x^2\tikzmark{Left 1} & \tikzmark{Right 1}e^2x \\
      2x \tikzmark{Left 2} & \tikzmark{Right 2}\frac{1}{2} e^{2x} \\      
      2  \tikzmark{Left 3} & \tikzmark{Right 3}\frac{1}{4} e^{2x} \\      
      0  \tikzmark{Left 4} & \tikzmark{Right 4}\frac{1}{8} e^{2x} \\\bottomrule
    \end{array}
\]
%-----------------------------------------
\DrawArrow[draw=red]{Left 1}{Right 2}{$+$}%
\DrawArrow[draw=brown]{Left 2}{Right 3}{$-$}%
\DrawArrow[draw=blue]{Left 3}{Right 4}{$+$}%
\end{document}
Related Question