
我正在嘗試在當前的 ODE 講座中使用 LaTeX,並用於mdframed
“盒裝命題”,以使讀者更容易區分公式和證明。
這就是我用來創建盒裝環境「提案」的內容
\usepackage{mdframed}
\usepackage{xcolor}
\definecolor{superlightred}{HTML}{F5F5F5}
\newmdtheoremenv[backgroundcolor=superlightred]{proposition}{Satz}[chapter]
我的問題是,這似乎包括命題頂部比底部更多的間距。看看這裡
頂部幾乎包含了一整條空間,而底部則顯得有些狹窄。如何改變這種行為以均勻間距甚至增加底部間距?
答案1
proposition
您可以使用第一個可選參數中傳遞的選項來調整環境的間距newmdtheoremenv
。具體來說,您可以透過設定innertopmargin
為 0 或根據需要設定為負值來刪除任何內部邊距。有關更多詳細信息,請參閱文件的mdframed
。
值得注意的是,文件中的其他長度可能會影響mdframed
環境邊距的行為。下面的例子顯示了 的影響parskip
,但我不認為它是唯一影響的長度。
\documentclass{book}
\usepackage{amsthm}
\usepackage{mdframed}
\usepackage{xcolor}
\setlength{\parskip}{0pt}
\definecolor{superlightred}{HTML}{F5F5F5}
\newmdtheoremenv[backgroundcolor=superlightred]{proposition}{Satz}[chapter]
\newmdtheoremenv[backgroundcolor=superlightred,
innertopmargin=0pt]{notopmarginproposition}{Satz}[chapter]
\newmdtheoremenv[backgroundcolor=superlightred,
innertopmargin=-2pt]{negativetopmarginproposition}{Satz}[chapter]
\begin{document}
\chapter{}
\begin{proposition}
Here is the proposition with default settings.
\end{proposition}
\begin{notopmarginproposition}
Here is the proposition with \textnormal{\texttt{innertopmargin=0pt}}.
\end{notopmarginproposition}
\begin{negativetopmarginproposition}
Here is the proposition with \textnormal{\texttt{innertopmargin=-2pt}}.
\end{negativetopmarginproposition}
\end{document}
答案2
我遇到了完全相同的問題,發現如果我amsthm
從序言中刪除包裹,多餘的上邊距就會消失。我不能說你的問題是由同樣的問題引起的,但可能是類似的問題。