答案1
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark,calc}
\usepackage{booktabs}
\begin{document}
\begin{tabular}{ccc}
\toprule
Probability & 1 & 2\\
\midrule
0.4 & 0.4 & 0.4 \\
0.3 & 0.3 & 0.3 \\
0.1 & 0.1 & \tikzmark{f}0.2 \\
0.1 & 0.1\tikzmark{e} & 0.1 \\
0.06\tikzmark{a}& \tikzmark{c}0.1\tikzmark{d} & \\
0.04\tikzmark{b}& & \\
\bottomrule
\end{tabular}
\begin{tikzpicture}[remember picture,overlay]
\draw[->] ($(pic cs:a)+(0.1,0.1)$) -- ($(pic cs:c)+(-0.1,0.1)$);
\draw[->] ($(pic cs:b)+(0.1,0.1)$) -- ++(0.3,0) |- ($(pic cs:c)+(-0.1,0)$);
\draw[->] ($(pic cs:e)+(0,0.1)$) to[out=0,in=180] ($(pic cs:f)+(0,0.1)$);
\draw[->] ($(pic cs:d)+(0,0.1)$) to[out=0,in=210] ($(pic cs:f)+(0,0)$);
\end{tikzpicture}
\end{document}
您必须运行pdflatex
两次才能传播位置信息。
答案2
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern}
\usepackage[frenchb]{babel}
\usepackage{array}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tabular}{|cccccc|}
\hline
\multicolumn{3}{|c}{Original source} & \multicolumn{3}{c|}{source reduction}\\
\hline
Symbol & Probability & 1 & 2 & 3 & 4 \\
\emph{a2} & 0.4 & 0.4 & 0.4 & 0.4 & \tikz[overlay,
remember picture]
\node[name=06, anchor=base] {0.6}; \\
\emph{a6} & 0.3 & 0.3 & 0.3 & 0.3 & \\
\emph{a1} & 0.1 & 0.1 & 0.2 & 0.3 & \\
\emph{a4} & 0.1 & 0.1 & 0.1 & & \\
\emph{a3} & \tikz[overlay, remember picture] \node[name=006, anchor=base] {0.06}; & \tikz[overlay, remember picture] \node[name=01, anchor=base] {0.1};& & & \\
\emph{a5} & \tikz[overlay, remember picture] \node[name=004, anchor=base] {0.04}; & & & & \\
\hline
\end{tabular}
\tikz[overlay, remember picture] \draw [->] (006) -- (01);
\tikz[overlay, remember picture] \draw [->] (004) -| ($(004)+(8mm,0)$) |- (01);
\end{document}