詩のパッケージはセクションの見出しの周りの垂直スペースを奇妙な方法で変更します

詩のパッケージはセクションの見出しの周りの垂直スペースを奇妙な方法で変更します

パッケージを使用するとpoetry、セクション タイトルの周囲に一定のスペースを確保するのに問題があります。私の詩はすべて、 として与えられるタイトルで始まります\section。2 つの詩が同じページに配置されることもあります。詩が複数のページにまたがることもあります (現在のpoem- 環境は で一時停止され\\*、画像付きの PDF が取り込まれ、詩は 1 行目の先頭で で再開されます\*)。ただし、これによりタイトルの前のスペースが変更されます。つまり、「オーバーフロー テキスト」とタイトルの距離は、同じページで開始および終了する詩と下のセクション タイトルとの距離よりも小さくなります。

プレーン テキストではこの問題は発生しません。つまり、ページが通常のテキストで始まり、その後に新しいセクションが続く場合、セクション タイトルの前のスペースは、ページが新しいセクションで始まった場合と同じです。

スペースセクション タイトルは、タイトルの後に詩が続くか、通常のテキストが続くかによって変わりますが、少なくともそれは一貫しており、オーバーフローの有無によって変わることはありません。ただし、タイトルがpoem1 ページに含まれている場合と比較して、2 ページに分割されている場合、次のタイトルの前に小さいながらも目立つスペースが環境によって消費されることがあります。

MWE は、さまざまな組み合わせをすべて示したかったため、やや長めになっています。セクション 2 と 3 の周囲のスペースの違いが主な問題です。他のセクションはコントラストのためにあります。パッケージはpoetryMikTeX にダウンロードすると別のパッケージと衝突する可能性があるため、ローカルで実行するとコンパイルされない可能性があります。Overleaf の例は、こちらでご覧いただけます。https://www.overleaf.com/read/qggmxspxsxms

MWE:

\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}

ここに画像の説明を入力してください

関連情報