有沒有辦法知道 LaTeX 在定理前後留下的垂直空間是多少?

有沒有辦法知道 LaTeX 在定理前後留下的垂直空間是多少?

我想知道是否可以輸入一些程式碼來查找 LaTeX 在定理之前和之後留下的垂直空間(以 cm 或 pt 為單位)。

我在用著

\documentclass[12pt]{article}

\usepackage{amsfonts, amsthm, amsmath, amssymb}

答案1

透過重複材料得出的荒謬例子定理、定義、範例中的非斜體文本

\documentclass{article}
\usepackage{mathtools,amsthm,kantlipsum}

\newtheoremstyle{crampedthm}% <name>
{\topsep}% <Space above>
{-3pt}% <Space below>
{\itshape}% <Body font>
{3cm}% <Indent amount>
{\bfseries\itshape}% <Theorem head font>
{:}% <Punctuation after theorem head>
{.5em}% <Space after theorem headi>
{}% <Theorem head spec (can be left empty, meaning `normal')>


\theoremstyle{crampedthm}
\newtheorem{cthm}{Tight Theorem}

\begin{document}
\kant[1]
\begin{cthm}
Roses are red $\iff$ sky is blue such that it is self-evident that this 
theorem is true.
\end{cthm}
\kant[1-2]
\end{document}

在此輸入影像描述

答案2

以下是常見長度宏的列表維基教科書。但正如我從評論中看到的,您已經知道這\topsep就是您需要的長度宏。如果你想知道長度宏的長度,你所要做的就是放置

\the\textwidth

在您的文件中,它將輸出以 pt 為單位的長度。就我個人而言,我更喜歡使用公制距離,所以我通常只是將 pt 長度放入沃爾夫拉姆阿爾法以獲得精確的轉換。

相關內容