不要使用 Poetry 包重置行号

不要使用 Poetry 包重置行号

我希望使用poetry环境时行号不会重置。

考虑一下这个MWE:

\documentclass{article}
\usepackage{poetry}

\setcounter{poemlinenumsevery}{5}

\begin{document}

{\bf First}

\begin{poem}
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\!

Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\!
\end{poem}

{\bf Second}

\begin{poem}
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\!

Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\!
\end{poem}

\end{document}

有没有办法让行号继续计数,即使你已经开始了新的诗句环境?

答案1

向软件包维护者请求增强功能。

如果我理解正确的话,行号可以在不同poem环境中使用辅助计数器及其相关的代码更改来添加到每个行的poem开始和结束,但随后需要重写模数函数。

诗歌

平均能量损失

\documentclass{article}
\usepackage{poetry}

%\setcounter{poemlinenumsevery}{5}

\newcount\oldpoemlineno%
\newcounter{oldpoemline}%



\begin{document}

\textbf{First}

\begin{poem}
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\!

Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\?
\setcounter{oldpoemline}{\the\poemlineno}%
\end{poem}

\textbf{Second}

\begin{poem}*%
\setcounter{poemline}{\theoldpoemline}%
\poemlineno=\thepoemline%
\ifnum\poemlineno=1\poemlineno=\thepoemline\*\fi%
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\!

Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\?
\setcounter{oldpoemline}{\the\poemlineno}%
\end{poem}


\textbf{Third}

\begin{poem}*%
\setcounter{poemline}{\theoldpoemline}%
\poemlineno=\thepoemline%
\ifnum\poemlineno=1\poemlineno=\thepoemline\*\fi%
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\!

Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\
Lorem ipsum dolor sit amet, consectetur adipiscing elit\\?
\setcounter{oldpoemline}{\the\poemlineno}%
\end{poem}

\end{document}

相关内容