越南语中有一类诗歌(七六八之歌),歌词如下
LIPSUM
Lorem ipsum dolor sit amet, consectetur adipiscing
Elit, sed do eiusmod tempor incididunt ut
Labore et dolore magna aliqua. Ut
Enim ad minim veniam, quis nostrud exercitation ullamco
Laboris nisi ut aliquip ex ea commodo
Consequat. Duis aute irure dolor in reprehenderit
In voluptate velit esse cillum dolore
Eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat.
Lipsum, 2018
(两个 7 字句子之后是一个 6 字句子,然后是一个 8 字句子,然后是另外两个 7 字句子,依此类推)
这首诗的对齐方式需要如上所示。
JosephHarriott 的回答在 2 级诗句方面给了我很大帮助。但是,我无法编辑它以便输出 3 级诗句。
n
另外,是否可以为任意值制作一个-level 诗句n
?(现在这不是必需的,但将来可能会对我有帮助)。
任何帮助都将不胜感激。提前致谢!
答案1
此第一版仅按文本输入,并按缩进。因此,它与页边距左对齐,并且可以将中间诗句跨页边界拆分。
\documentclass[12pt]{article}
\usepackage{listofitems}
\newcommand\defineverse[1]{%
\setsepchar{,}%
\greadlist*\vindent{#1}%
}
\newcommand\setverse[1]{%
\par\noindent%
\setsepchar{\\}%
\readlist*\versedata{#1}%
\ifnum\listlen\versedata[]=\listlen\vindent[]\relax%
\foreachitem\x\in\versedata{%
\ifnum\xcnt=1\relax\else\\\fi%
\mbox{}\hspace{\vindent[\xcnt]\dimexpr\verseindent\relax}%
\x%
}%
\else%
\textit{Line count does not correspond to verse definition.}
\fi%
\par%
}
\def\verseindent{1em}
\begin{document}
\defineverse{1,1,2,0,1,1,2,0}
\setverse{
Lorem ipsum dolor sit amet, consectetur adipiscing\\
Elit, sed do eiusmod tempor incididunt ut\\
Labore et dolore magna aliqua. Ut\\
Enim ad minim veniam, quis nostrud exercitation ullamco\\
Laboris nisi ut aliquip ex ea commodo\\
Consequat. Duis aute irure dolor in reprehenderit \\
In voluptate velit esse cillum dolore\\
Eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat.}
\bigskip Try to set a poorly composed verse:
\setverse{A\\b\\c\\d}
\end{document}
这是将每节经文堆叠在一起的版本。因此,它可以轻松居中。但经文不能跨页。
\documentclass[12pt]{article}
\usepackage{listofitems,stackengine}
\newcommand\defineverse[1]{%
\setsepchar{,}%
\greadlist*\vindent{#1}%
}
\newcommand\setverse[2][]{%
\par%
\ifx\relax#1\relax\else\centerline{#1}\medskip\fi%
\setsepchar{\\}%
\readlist*\versedata{#2}%
\ifnum\listlen\versedata[]=\listlen\vindent[]\relax%
\savebox\stackedbox{}%
\foreachitem\x\in\versedata{%
\stackengine{0pt}{\usebox{\stackedbox}}{%
\mbox{\strut}%
\hspace{\vindent[-\xcnt]\dimexpr\verseindent\relax}%
\versedata[-\xcnt]}{O}{l}{T}{F}{S}%
}%
\centerline{\usebox{\stackedbox}}%
\else%
\textit{Line count does not correspond to verse definition.}
\fi%
\par\medskip%
}
\newcommand\attribution[1]{%
\centerline{\hspace{\wd\stackedbox}\makebox[0pt][r]{#1}}%
\par
}
\def\verseindent{1em}
\begin{document}
\defineverse{1,1,2,0,1,1,2,0}
\setverse[Lipsum]{
Lorem ipsum dolor sit amet, consectetur adipiscing\\
Elit, sed do eiusmod tempor incididunt ut\\
Labore et dolore magna aliqua. Ut\\
Enim ad minim veniam, quis nostrud exercitation ullamco\\
Laboris nisi ut aliquip ex ea commodo\\
Consequat. Duis aute irure dolor in reprehenderit \\
In voluptate velit esse cillum dolore\\
Eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat.}%
\setverse{
Lorem ipsum dolor sit amet, consectetur\\
Elit, sed do eiusmod tempor incididunt ut\\
Labore et dolore magna aliqua. Ut\\
Enim ad minim veniam, quis nostrud exercitation\\
Laboris nisi ut aliquip ex ea commodo\\
Consequat. Duis aute irure dolor in reprehenderit \\
In voluptate velit esse cillum dolore\\
Eu fugiat nulla pariatur. Excepteur sint occaecat.}%
\attribution{Lipsum, 2018}
\bigskip Try to set a poorly composed verse:
\fbox{\setverse{A\\b\\c\\d}}
\end{document}
答案2
你可以尝试使用该verse
包。
\documentclass{report}
\usepackage{verse}
\begin{document}
\begin{verse}
\indentpattern{0010} % line indents
\begin{patverse}
First line \\
Second line \\
Third line \\
\hspace{-\vgap}Fourth line \\
\end{patverse}
\begin{patverse}
Fifth line \\
Sixth line \\
Seventh line \\
\hspace{-\vgap}Eifgth line \\
\end{patverse}
\end{verse}
\end{document}
有关更多信息,请参阅verse
包文档( )。> texdoc verse
编辑
我已更新上述答案,显示出更好的结果。
% verseprob.tex SE 462211
\documentclass{report}
\usepackage{verse}
\begin{document}
\indentpattern{00100} % line indents
\poemtitle{First verse}
\begin{verse}[0.13\textwidth] % move verse to the right (centering)
\begin{patverse}
First line \\
Second line \\
Third line \\
\hspace{-\vgap}Fourth line \\
\end{patverse}
\begin{patverse}
Fifth line \\
Sixth line \\
Seventh line \\
\hspace{-\vgap}Eigth line \\
\end{patverse}
\end{verse}
\poemtitle{Second verse}
\begin{verse} % verse near left margin
\begin{patverse}
First line \\
Second line \\
Third line \\
\hspace{-\vgap}Fourth line \\
\end{patverse}
\begin{patverse}
Fifth line \\
Sixth line \\
Seventh line \\
\hspace{-\vgap}Eigth line \\
\end{patverse}
\end{verse}
\end{document}