詩歌包以奇怪的方式改變了章節標題周圍的垂直空間

詩歌包以奇怪的方式改變了章節標題周圍的垂直空間

使用該poetry包時,我無法在章節標題周圍獲得一致的空間。我所有的詩都以標題開頭,以\section.有時兩首詩放在同一頁上。有時一首詩會超過一頁(poem然後使用 暫停當前環境,包含帶有圖片的 pdf,並在第一行開頭\\*重新開始該詩)。\*然而,這會導致標題之前的空格發生變化。即,「溢出文字」與標題之間的距離小於在同一頁上開始和結束的一首詩與下面的章節標題之間的距離。

純文字不會導致這種情況。也就是說,如果頁面以普通文字開始,則為一個新節,節標題之前的空格與頁面以新節開始時相同。

空間章節標題的變化取決於標題後面是一首詩還是普通文本,但至少這是一致的,它不會根據溢出與否而改變。但是poem,如果下一個標題分為兩頁(與包含在一頁上時相比),則某些因素會導致環境吞噬下一個標題之前的一小部分但明顯的空間。

MWE 有點長,因為我想展示所有不同的組合。第 2 部分和第 3 部分周圍的空間差異是主要問題——其他部分是為了對比。請注意,poetry當下載到 MikTeX 時,該套件似乎與另一個套件發生衝突,因此如果您在本地運行它,它可能無法編譯。此處可查看背頁範例: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}

在此輸入影像描述

相關內容