答案1
基于这个最近的答案:
\documentclass{article}
\usepackage{color}
\usepackage{tikz}
\usepackage{mathtools}
\usetikzlibrary{tikzmark,calc,,arrows,shapes,decorations.pathreplacing}
\tikzset{every picture/.style={remember picture}}
\begin{document}
This is just some filler text to get a longer line so we can show off that the vertical spacing is about right. The set
%
\vspace{2em}% add some vertical space so the arrows don't run into the text
\begin{equation}
\{(\overset{\mathstrut\tikzmark{f1}}{\textcolor{green!50!black}{1}}, 2), (\textcolor{green!50!black}{3}, 4), \dots, (\overset{\mathstrut\tikzmark{fx}}{\textcolor{green!50!black}{x}},y)\}
\end{equation}
\begin{tikzpicture}[remember picture,overlay]
\coordinate (f1) at (pic cs:f1);
\coordinate (fx) at (pic cs:fx);
\path (f1) ++(.1em, 2em) node (f1text) {$F(1)$};
\draw[->] (f1text) -> (f1);
\path (f1text -| fx) ++(.1em, 0) node (fxtext) {$F(x)$};
\draw[->] (fxtext) -> (fx);
\end{tikzpicture}
%
has arrows pointing to it.
\end{document}
我使用将要引用的元素\overset
放在上面。这些标记的位置随后可在 中找到。然后我使用这些节点计算相对坐标来放置文本,确保它们垂直对齐。\tikzmark
tikzpicture
因为图片是覆盖,所以我们需要手动添加一些空间以确保标签不会与前面的文本重叠。
您需要编译该文档两次才能使箭头指向正确的位置。