有没有办法获取文档不同部分之间的精确间距?
我知道这个问题可能听起来有点模糊,所以这里是出现这个问题的背景。
这里有一个代码片段可以让 ntheorem 将较长的定理名称拆分为多行。代码似乎运行良好,但在定理名称后引入了额外的空格。另一方面,我尝试使用 parbox 重新定义 break theoremstyle。间距看起来与默认情况相同,但如果定理名称长于一行,间距会更小。下面是我所谈论的 MWE
\documentclass[11pt]{article}
\usepackage[framed,thmmarks,thref, hyperref]{ntheorem}
\theoremstyle{break}
\theoremseparator{:}
\newtheorem{testt}{theorem}
\begin{document}
\begin{testt}[default style]
body
\end{testt}
\makeatletter
\let\nobreakitem\item
\let\@nobreakitem\@item
\patchcmd{\nobreakitem}{\@item}{\@nobreakitem}{}{}
\patchcmd{\nobreakitem}{\@item}{\@nobreakitem}{}{}
\patchcmd{\@nobreakitem}{\@itempenalty}{\@M}{}{}
\patchcmd{\@xthm}{\ignorespaces}{\nobreak\ignorespaces}{}{}
\patchcmd{\@ythm}{\ignorespaces}{\nobreak\ignorespaces}{}{}
\renewtheoremstyle{break}%
{\item{\theorem@headerfont
##1\ ##2\theorem@separator}\hskip\labelsep\relax\nobreakitem}%
{\item{\theorem@headerfont
##1\ ##2\ (##3)\theorem@separator}\hskip\labelsep\relax\nobreakitem}
\makeatother
\begin{testt}[short name]
solution I found online
\end{testt}
\begin{testt}[very very very very very very long theorem name, should be longer than one line]
solution I found online
\end{testt}
\makeatletter
\renewtheoremstyle{break}%
{\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
##1\ ##2\theorem@separator}\hbox{\strut}}}]}%
{\item[\parbox{\textwidth}{\leftskip\labelsep \theorem@headerfont
##1\ ##2\ (##3)\theorem@separator}\hbox{\strut}]}
\makeatother
\begin{testt}[short name]
my solution
\end{testt}
\begin{testt}[very very very very very very long theorem name, should be longer than one line]
my solution
\end{testt}
\end{document}
现在,我不想说“好的,间距看起来相同/不同”,而是“好的,间距相同/不同”。有没有办法获得行之间的确切间距,而不必猜测?