当我使用该verse
软件包时,如果一行末尾有断行,则单个诗句不会正确对齐。我该如何将其更改为正确对齐?
\documentclass[twocolumn]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{verse}
\begin{document}
\begin{verse}
This verse is very long and therefore will be typeset across two lines.
\end{verse}
\end{document}
答案1
默认情况下(无论使用article
或scrartcl
),verse
环境不会以不规则的方式排版文本。
如果你想在环境中使用不规则的文本verse
,你可以使用etoolbox
打包并添加
\AtBeginEnvironment{verse}{\raggedright}
回到序言。完整的例子:
\documentclass[twocolumn, fontsize=10pt]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{verse}
\usepackage{etoolbox}
\AtBeginEnvironment{verse}{\raggedright}
\begin{document}
\poemtitle{In the beginning}
\settowidth{\versewidth}{And objects at rest tended to remain at rest}
\begin{verse}[\versewidth]
Then God created Newton, \\
And objects at rest tended to remain at rest, \\
And objects in motion tended to remain in motion, \\
And energy was conserved
and momentum was conserved
and matter was conserved \\
And God saw that it was conservative. \\
\end{verse}
\end{document}
输出:
仅用于比较,获得的输出注释掉了\AtBeginEnvironment
上面的示例代码中的行:
也许更好的方法是使用
\AtBeginEnvironment{verse}{\RaggedRight}
加载后ragged2e
包裹。