是否可以将标记仅附加到文本中的某个位置,而不是部分、子部分等?
这就是我想要实现的目标:
\begin{document}
Alex (see~\ref{alex}) is a boy,
Jessica (see~\ref{jessica}) is a girl.
[...]
\label{alex}\ref{alex}: Alex Johnson: 4 y.o.
\label{jessica}\ref{jessica}: Jessica D.: 5 y.o.
\end{document}
Run Code Online (Sandbox Code Playgroud)
我想要得到这样的东西:
Alex (see 1) is a boy,
Jessica (see 2) is a girl.
[...]
1: Alex Johnson: 4 y.o.
2: Jessica D.: 5 y.o.
Run Code Online (Sandbox Code Playgroud)
说得通?
这是解决方案:
\newcounter{foo}
Alex (see~\ref{alex}) is a boy,
Jessica (see~\ref{jessica}) is a girl.
[...]
\refstepcounter{foo}\thefoo\label{alex}: Alex Johnson: 4 y.o.
\refstepcounter{foo}\thefoo\label{jessica}: Jessica D.: 5 y.o.
Run Code Online (Sandbox Code Playgroud)