![诗歌包以奇怪的方式改变章节标题周围的垂直空间](https://linux22.com/image/448683/%E8%AF%97%E6%AD%8C%E5%8C%85%E4%BB%A5%E5%A5%87%E6%80%AA%E7%9A%84%E6%96%B9%E5%BC%8F%E6%94%B9%E5%8F%98%E7%AB%A0%E8%8A%82%E6%A0%87%E9%A2%98%E5%91%A8%E5%9B%B4%E7%9A%84%E5%9E%82%E7%9B%B4%E7%A9%BA%E9%97%B4.png)
使用该poetry
包时,我无法在章节标题周围获得一致的空间。我所有的诗歌都以标题开头,以 表示\section
。有时两首诗会设置在同一页上。有时一首诗会跨越多页(当前poem
环境随后会暂停\\*
,包含带有图片的 pdf 并\*
在第一行的开头重新开始诗歌)。然而,这会导致标题前的空间发生变化。也就是说,“溢出文本”与标题之间的距离小于在同一页开始和结束的诗歌与下面的章节标题之间的距离。
纯文本不会导致这种情况。也就是说,如果页面以普通文本开始,然后是新章节,则章节标题前的空间与页面以新章节开始的空间相同。
空间后章节标题会根据标题后面是诗歌还是普通文本而变化,但至少这是一致的,它不会根据溢出与否而变化。但是,poem
如果标题被分成两页,与包含在一页中相比,某些因素会导致环境在下一个标题之前占用一小块但明显的空间。
MWE 有点长,因为我想展示所有不同的组合。第 2 和第 3 节周围的空间差异是主要问题——其他部分是为了对比。请注意,poetry
下载到 MikTeX 时,该包似乎与另一个包发生冲突,因此如果您在本地运行它,它可能无法编译。可在此处查看 Overleaf 示例:https://www.overleaf.com/read/qggmxspxsxms
梅威瑟:
\documentclass{article}
\usepackage{poetry}\poemlinenumsfalse
\setlength{\parindent}{0pt}
\begin{document}
\section{The very first, -/P}
\begin{poem}
Poem poem, please behave\\
So my peace of mind you save\\*
\newpage
\* Type-setting is a nightmare\\
This is a poem\\-
\end{poem}
\section{First, P/P}
\begin{poem}
Poem poem, please behave\\
So my peace of mind you save\\
Type-setting is a nightmare\\
This is a poem\\-
\end{poem}
\section{Following, P/P}
\begin{poem}
Poem poem, please behave\\
So my peace of mind you save\\
Type-setting is a nightmare\\
This is a poem\\-
\end{poem}
\newpage
Type-setting is a nightmare
This is plain text
\section{First, T/P}
\begin{poem}
Poem poem, please behave\\
So my peace of mind you save\\
Type-setting is a nightmare\\
This is a poem\\-
\end{poem}
\section{Following, P/P}
\begin{poem}
Poem poem, please behave\\
So my peace of mind you save\\
Type-setting is a nightmare\\
This is a poem\\-
\end{poem}
\newpage
Type-setting is a nightmare
This is plain text
\section{First, T/T}
Text Text, please behave
So my peace of mind you save
Type-setting is a nightmare
This is plain text
\section{Following, T/T}
Text text, please behave
So my peace of mind you save
Type-setting is a nightmare
This is plain text
\section{Following, T/T}
Text text, please behave
So my peace of mind you save
Type-setting is a nightmare
This is plain text
\newpage
\section{Top of page, T/P}
\begin{poem}
Poem poem, please behave\\
So my peace of mind you save\\*
\newpage
\* Type-setting is a nightmare\\
This is a poem\\-
\end{poem}
\section{First, P/T}
Type-setting is a nightmare
This is plain text
\section{Following, T/P}
\begin{poem}
Poem poem, please behave\\
So my peace of mind you save\\
Type-setting is a nightmare\\
This is a poem\\-
\end{poem}
\section{Following, P/T}
Text text, please behave
So my peace of mind you save
Type-setting is a nightmare
This is a poem
\end{document}
答案1
我没能弄清楚你的间距问题到底是什么。我从未使用过该poetry
软件包。我不知道这是否有帮助。我修改了你的代码以使用软件包verse
(警告我开发了它)而不是软件包poetry
,并使用verse
\poemtitle{...}
代替\section{...}
作为诗歌标题。
% poemprob.tex SE 640836
\documentclass{article}
\usepackage{verse}
%\usepackage{poetry}\poemlinenumsfalse
\setlength{\parindent}{0pt}
\begin{document}
\tableofcontents
\poemtitle{The very first, -/P}
\begin{verse}
Poem poem, please behave\\
So my peace of mind you save\\*
\newpage
\* Type-setting is a nightmare\\
This is a poem\\-
\end{verse}
\poemtitle{First, P/P}
\begin{verse}
Poem poem, please behave\\
So my peace of mind you save\\
Type-setting is a nightmare\\
This is a poem\\-
\end{verse}
\poemtitle{Following, P/P}
\begin{verse}
Poem poem, please behave\\
So my peace of mind you save\\
Type-setting is a nightmare\\
This is a poem\\-
\end{verse}
\newpage
Type-setting is a nightmare
This is plain text
\poemtitle{First, T/P}
\begin{verse}
Poem poem, please behave\\
So my peace of mind you save\\
Type-setting is a nightmare\\
This is a poem\\-
\end{verse}
\poemtitle{Following, P/P}
\begin{verse}
Poem poem, please behave\\
So my peace of mind you save\\
Type-setting is a nightmare\\
This is a poem\\-
\end{verse}
\newpage
Type-setting is a nightmare
This is plain text
\section{First, T/T}
Text Text, please behave
So my peace of mind you save
Type-setting is a nightmare
This is plain text
\section{Following, T/T}
Text text, please behave
So my peace of mind you save
Type-setting is a nightmare
This is plain text
\section{Following, T/T}
Text text, please behave
So my peace of mind you save
Type-setting is a nightmare
This is plain text
\newpage
\poemtitle{Top of page, T/P}
\begin{verse}
Poem poem, please behave\\
So my peace of mind you save\\*
\newpage
\* Type-setting is a nightmare\\
This is a poem\\-
\end{verse}
\section{First, P/T}
Type-setting is a nightmare
This is plain text
\poemtitle{Following, T/P}
\begin{verse}
Poem poem, please behave\\
So my peace of mind you save\\
Type-setting is a nightmare\\
This is a poem\\-
\end{verse}
\section{Following, P/T}
Text text, please behave
So my peace of mind you save
Type-setting is a nightmare
This is a poem
\end{document}
%%%%%% ORIGINAL MWE FOLLOWS %%%%%%%%%%%%%%
\documentclass{article}
{poetry}\poemlinenumsfalse
\setlength{\parindent}{0pt}
\begin{document}
\section{The very first, -/P}
\begin{poem}
Poem poem, please behave\\
So my peace of mind you save\\*
\newpage
\* Type-setting is a nightmare\\
This is a poem\\-
\end{poem}
\section{First, P/P}
\begin{poem}
Poem poem, please behave\\
So my peace of mind you save\\
Type-setting is a nightmare\\
This is a poem\\-
\end{poem}
\section{Following, P/P}
\begin{poem}
Poem poem, please behave\\
So my peace of mind you save\\
Type-setting is a nightmare\\
This is a poem\\-
\end{poem}
\newpage
Type-setting is a nightmare
This is plain text
\section{First, T/P}
\begin{poem}
Poem poem, please behave\\
So my peace of mind you save\\
Type-setting is a nightmare\\
This is a poem\\-
\end{poem}
\section{Following, P/P}
\begin{poem}
Poem poem, please behave\\
So my peace of mind you save\\
Type-setting is a nightmare\\
This is a poem\\-
\end{poem}
\newpage
Type-setting is a nightmare
This is plain text
\section{First, T/T}
Text Text, please behave
So my peace of mind you save
Type-setting is a nightmare
This is plain text
\section{Following, T/T}
Text text, please behave
So my peace of mind you save
Type-setting is a nightmare
This is plain text
\section{Following, T/T}
Text text, please behave
So my peace of mind you save
Type-setting is a nightmare
This is plain text
\newpage
\section{Top of page, T/P}
\begin{poem}
Poem poem, please behave\\
So my peace of mind you save\\*
\newpage
\* Type-setting is a nightmare\\
This is a poem\\-
\end{poem}
\section{First, P/T}
Type-setting is a nightmare
This is plain text
\section{Following, T/P}
\begin{poem}
Poem poem, please behave\\
So my peace of mind you save\\
Type-setting is a nightmare\\
This is a poem\\-
\end{poem}
\section{Following, P/T}
Text text, please behave
So my peace of mind you save
Type-setting is a nightmare
This is a poem
\end{document}
答案2
我不确定我是否理解了这个问题。在诗歌文档中,有 \poemtopskip 和 \poembotskip 用于管理环境前后的空格。
\documentclass{article}
%https://tex.stackexchange.com/questions/640836/poetry-package-changes-vertical-space-around-section-headings-in-strange-ways/640918#640918
\usepackage{poetry}\poemlinenumsfalse
\setlength{\parindent}{0pt}
\usepackage{paracol}
\usepackage[margin=2cm]{geometry}
\begin{document}
Default
\begin{paracol}{2}
\section{With the environment poem}
\begin{poem}
Poem poem, please behave\\
So my peace of mind you save\\
Type-setting is a nightmare\\
This is a poem\\-
\end{poem}
\textbf{Some text}
\switchcolumn
\section{Without the environment poem}
Poem poem, please behave
So my peace of mind you save
Type-setting is a nightmare
This is a poem
\textbf{Some text}
\end{paracol}
\rule{\linewidth}{0.4pt}
Modified
\begin{paracol}{2}
\section{With the environment poem}
\poemtopskip=0pt%<---- modif 1em by default
\poembotskip=0pt%<---- modif 1em by default
%\setlength{\poemindent}{1in}%<---- for the indent 0pt by default
\begin{poem}
Poem poem, please behave\\
So my peace of mind you save\\
Type-setting is a nightmare\\
This is a poem\\-
\end{poem}
\textbf{Some text}
\switchcolumn
\section{Without the environment poem}
Poem poem, please behave
So my peace of mind you save
Type-setting is a nightmare
This is a poem
\textbf{Some text}
\end{paracol}
\end{document}