在 minted 环境之前添加一个空行似乎会对布局产生很大影响。我更希望 latex 始终强制执行一致的布局,而不管\baselineksip
我是否添加了空行。这可能吗?
原因是我希望最终输出中所有 minted 环境的间距一致。不幸的是,我发现很难保持一致。这就是为什么我借助格式化程序和 linters 编写代码。所以我想知道是否有办法强制样式保持一致,或者是否有可用的 linters/格式化程序可以帮助我?
以下是 pdf 输出:
以下是用于生成 pdf 输出的乳胶:
\documentclass[
12pt,%
oneside,%
a4paper%
]{memoir}
\setlength{\parskip}{\baselineskip}%
\setlength{\parindent}{0pt}%
\setlength{\partopsep}{-\baselineskip}
\setlength{\topsep}{0pt}
\usepackage[fleqn]{amsmath}
\usepackage{minted}
\usemintedstyle{tango}
\title{Consistent Spacing Around Environments}
\begin{document}
\setlength{\abovedisplayskip}{-\baselineskip}
\setlength{\belowdisplayskip}{0pt}
\setlength{\abovedisplayshortskip}{-\baselineskip}
\setlength{\belowdisplayshortskip}{0pt}
\setlength{\mathindent}{0pt}
If we have a newline before and after the minted section,
then the rendered spacing above and below is different from when there are no newlines.
Here is the spacing with empty lines above and below.
\begin{minted}{coq}
Inductive regex :=
| empty_set : regex
| empty_string : regex
| symbol : char -> regex
| concat : regex -> regex -> regex
| or : regex -> regex -> regex
.
\end{minted}
Followed by an empty line.
This first spacing is the spacing I want to reproduce below.
Here is a second minted environment without an empty lines.
\begin{minted}{coq}
Inductive regex :=
| empty_set : regex
| empty_string : regex
| symbol : char -> regex
| concat : regex -> regex -> regex
| or : regex -> regex -> regex
.
\end{minted}
Followed by no empty line.
This second spacing is excessive and I want to reduce it to be the same as the first.
\end{document}