Пакет Poetry странным образом изменяет вертикальное пространство вокруг заголовков разделов

Пакет Poetry странным образом изменяет вертикальное пространство вокруг заголовков разделов

Используя 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}

введите описание изображения здесь

Связанный контент