格式化诗句:如何更改所有偶数​​行的缩进?

格式化诗句:如何更改所有偶数​​行的缩进?

是否可以将一段诗句格式化如下: 所需格式的示例

(抱歉,这个例子不是英文的,因为我手头没有这种格式的英文文本。)

我的意思是以下格式:

诗句的每个偶数行都有缩进,而奇数行没有。我想为不同长度的诗句自动缩进,这样我就不需要手动更改每个偶数行的缩进。

答案1

来自 verse 包的手册:

\documentclass{article}
\usepackage{verse}
\begin{document}



\settowidth{\versewidth}{In a cavern, in a canyon,}
\poemtitle{Clementine}
\begin{verse}[\versewidth]
\poemlines{2}
\begin{altverse}
\flagverse{1.} In a cavern, in a canyon, \\
Excavating for a mine, \\
Lived a miner, forty-niner, \label{vs:49} \\
And his daughter, Clementine. \\!
\end{altverse}
\begin{altverse}
\flagverse{\textsc{chorus}} Oh my darling, Oh my darling, \\
Oh my darling Clementine. \\
Thou art lost and gone forever, \\
Oh my darling Clementine \\!
\end{altverse}
\poemlines{0}
\end{verse}
\end{document}

打印出来的诗句图片

patverse* 环境可能也会有帮助。

答案2

临时解决方案。需要对其进行完善,特别是将定义移到外部verse

\documentclass{article}

\begin{document}

\let\oldnl=\\

\newcount\evenv
\begin{verse}
\evenv1\relax%
\def\\{\advance\evenv by1\ifodd\evenv\oldnl\else\oldnl\hspace*{2em}\fi}%
$\,$\\
To be, or not to be, that is the question—\\
Whether 'tis Nobler in the mind to suffer\\
The Slings and Arrows of outrageous Fortune,\\
Or to take Arms against a Sea of troubles,\\
And by opposing end them? To die, to sleep—\\
No more; and by a sleep, to say we end\\
The Heart-ache, and the thousand Natural shocks\\
That Flesh is heir to? 'Tis a consummation\\
Devoutly to be wished. To die, to sleep,\\
To sleep, perchance to Dream; Aye, there's the rub,
\end{verse}

\end{document}

在此处输入图片描述

答案3

这种诗歌的格式与希伯来圣经诗歌所采用的格式类似。

scripture该软件包支持这一点,具有充足的灵活性和定制选项。

% TeX Program = lualatex

\documentclass{article}
\usepackage{babel}
\babelprovide[import,main]{churchslavic-oldcyrillic}
\babelfont{rm}{Noto Serif}
\usepackage{scripture}
\scripturesetup{
  poetry/leftmargin=0pt
}
\begin{document}
\begin{scripture}
  \begin{poetry}
    Дѣтищь, видя яблоко на древѣ красное,
    многим трудом приложит стяжати оное.

    Егда же, стяжав, узрит внутрь червие быти,
    суетны труды своя обыче хулити.
    
    Тако иже похотми искушен бывает,
    утѣхи ради плотски много ся труждает.
  \end{poetry}
\end{scripture}
\end{document}

输出

相关内容