首先,我已经看到并读过这个问题这似乎是一个不同的但可能相关的问题。
我正在使用mdframed
2013 年的 1.9b 版本和 LuaLaTeX。
现在我遇到的问题可以通过以下 MWE 重现。
\documentclass[a4paper,fontsize=12pt,twoside=false,onecolumn,final,openany,parskip=full,chapterprefix=false]{scrreprt}
\usepackage[framemethod=tikz]{mdframed}
\mdfsetup{nobreak=true}
\def\a{Here goes some really boring text which we use to fill the paragraph, but which is shorter than the standard lipsum and blindtext paragraph. }
\begin{document}
\chapter{chapter title}
\begin{mdframed}
some text box
\end{mdframed}
\a
\section{section title}
\begin{mdframed}
some text box
\end{mdframed}
\a
\subsection{subsection title}
\begin{mdframed}
some text box
\end{mdframed}
\a
\chapter{chapter title}
Now with some text prior to the \texttt{mdframed} environment. To show the effect of that on vertical spacing.
\begin{mdframed}
some text box
\end{mdframed}
\a
\section{section title}
Now with some text prior to the \texttt{mdframed} environment. To show the effect of that on vertical spacing.
\begin{mdframed}
some text box
\end{mdframed}
\a
\subsection{subsection title}
Now with some text prior to the \texttt{mdframed} environment. To show the effect of that on vertical spacing.
\begin{mdframed}
some text box
\end{mdframed}
\a
\end{document}
让我通过截图展示一下。我有一个文档,其中我使用mdframed
环境来引用文档,紧接着标题部分。现在对比一下垂直位置mdframed
以下两个例子中的框:
现在我不确定这是否是我的个人喜好问题,因为我知道 LaTeX 在各处的间距上投入了大量精力。但我觉得很奇怪,在第一个例子中,框mdframed
基本上粘在标题上,然后是似乎属于标题的垂直跳跃;而在第二个例子中,垂直间距看起来更合理。
mdframed
即使环境mdframed
位于节标题之后,我怎样才能产生类似于第二个示例中的垂直间距?或者我可以使用其他替代方法吗mdframed
?
编辑:顺便说一句\begin{mdframed}[skipabove=\baselineskip]
(即使使用 1em 或 1ex 代替\baselineskip
)在章节标题下方也没有效果。
答案1
也许你可以改变tcolorbox
。您的示例的结果看起来更好:
\documentclass[a4paper, fontsize=12pt, twoside=false, onecolumn, final, openany, parskip=full, chapterprefix=false]{scrreprt}
\usepackage{tcolorbox}
\def\a{Here goes some really boring text which we use to fill the paragraph, but which is shorter than the standard lipsum and blindtext paragraph. }
\tcbset{sharp corners, colback=white, colframe=black, boxrule=1pt}
\begin{document}
\chapter{chapter title}
\begin{tcolorbox}
some text box
\end{tcolorbox}
\a
\section{section title}
\begin{tcolorbox}
some text box
\end{tcolorbox}
\a
\subsection{subsection title}
\begin{tcolorbox}
some text box
\end{tcolorbox}
\a
\chapter{chapter title}
Now with some text prior to the \texttt{mdframed} environment. To show the effect of that on vertical spacing.
\begin{tcolorbox}
some text box
\end{tcolorbox}
\a
\section{section title}
Now with some text prior to the \texttt{mdframed} environment. To show the effect of that on vertical spacing.
\begin{tcolorbox}
some text box
\end{tcolorbox}
\a
\subsection{subsection title}
Now with some text prior to the \texttt{mdframed} environment. To show the effect of that on vertical spacing.
\begin{tcolorbox}
some text box
\end{tcolorbox}
\a
\end{document}