基于上一个问题我问了一下,我创建了以下内容:
\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}
{\renewcommand{\arraystretch}{1.5}\begin{tabular}{r@{\qquad}l}
\(u\)\tikzmark{d0} & \(\D{v}\)\\
\(\dd{u}{x}\)\tikzmark{d1} & \tikzmark{i1}\(\int \D{v} \D{x}\)\\
\(\dd[2]{u}{x}\)\tikzmark{d2} & \tikzmark{i2}\(\int\left(%
\int\D{v}\D{x}\right)\D{x}\)\\
\(\dd[3]{u}{x}\)\tikzmark{d3} & \tikzmark{i3}\(\int\left(\int\left(%
\int\D{v}\D{x}\right)\D{x}\right)\D{x}\)\\
\(\cdots\)\tikzmark{d4} & \tikzmark{i4}\(\cdots\)\\
0 & \tikzmark{i5}\(\cdots\)
\end{tabular}}
\tikz[remember picture]{\foreach \d/\i in {d0/i1,d1/i2,d2/i3,d3/i4,d4/i5}{
\draw[overlay] (pic cs:\d) to[out=0,in=180] (pic cs:\i);
}}
\end{document}
这种方法效果很好;但是线条似乎是从基线开始的,而我认为如果线条从线的中心开始(与分数线对齐),效果会更好。我可以使用约 0.6ex 的 yshift 来实现这一点,但有没有更好的方法?
答案1
矩阵方法:
\documentclass{standalone}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[fleqn]{mathtools}
\usepackage{array}
\usepackage{tikz}
\usetikzlibrary{positioning, matrix}
\newcommand*{\dd}[3][]{\tfrac{\mathrm{d}^{#1}#2}{\mathrm{d}#3^{#1}}}
\newcommand*{\D}[1]{\mathop{}\!\mathrm{d} #1}
\begin{document}
\begin{tikzpicture}
\matrix [matrix of nodes, nodes={anchor=west,minimum width=5mm, minimum height=1cm,
inner sep=0pt},
row sep=0cm, column sep=10mm]
{
|(d0)| \(u\) & \(\D{v}\) \\
|(d1)| \(\dd{u}{x}\) & |(i1)| \(\int \D{v} \D{x}\) \\
|(d2)| \(\dd[2]{u}{x}\) & |(i2)| \(\int\left(\int\D{v}\D{x}\right)\D{x}\) \\
|(d3)| \(\dd[3]{u}{x}\) & |(i3)| \(\int\left(\int\left(\int\D{v}\D{x}\right)\D{x}\right)\D{x}\) \\
|(d4)| \(\cdots\) & |(i4)| \(\cdots\) \\
0 & |(i5)| \(\cdots\) \\
};
\foreach \d/\i in {d0/i1,d1/i2,d2/i3,d3/i4,d4/i5}{
\draw[overlay] (\d) to[out=0,in=180] (\i);
}
\end{tikzpicture}
\end{document}