![\hypertarget 和枚举环境中不需要的水平空间](https://linux22.com/image/467900/%5Chypertarget%20%E5%92%8C%E6%9E%9A%E4%B8%BE%E7%8E%AF%E5%A2%83%E4%B8%AD%E4%B8%8D%E9%9C%80%E8%A6%81%E7%9A%84%E6%B0%B4%E5%B9%B3%E7%A9%BA%E9%97%B4.png)
环境enumerate
和其星号对应的环境enumerate*
在 下的行为略有不同\hypertarget
。后者enumerate*
会增加不必要的水平间距。
以下描述性 MWE
\documentclass[12pt]{book}
\usepackage[shortlabels, inline]{enumitem}
\usepackage[hypertexnames=false]{hyperref}
\begin{document}
Compare and contrast
\begin{enumerate}
\item \hypertarget{spacing-nostar-correct-1}{} No extra space here.
\item \hypertarget{spacing-nostar-correct-2}{} Nor any extra space here.
\end{enumerate}
with the following:
\begin{enumerate*}
\item \hypertarget{spacing-star-incorrect-1}{} An extra space here. %% <<- Notice the space after hypertarget in code.
\item \hypertarget{spacing-star-incorrect-2}{} And an extra space here.
\end{enumerate*} %% <<- Notice the space after hypertarget in code.
and with:
\begin{enumerate*}
\item \hypertarget{spacing-star-correct-1}{}No extra space here.
\item \hypertarget{spacing-star-correct-2}{}Nor any extra space here.
\end{enumerate*}
\end{document}
预期间距用绿色矩形标记,非预期间距用红色菱形标记。当空格出现\hypertarget
在 中enumerate*
但未出现在 中时,会添加一些额外间距enumerate
。
有什么比手动删除代码中的间距更好的解决方案吗?