有没有办法使用 verse 包创建以下布局?
\documentclass{article}
\usepackage{verse}
\usepackage[utf8]{inputenc}
\usepackage[margin=1.3in]{geometry}
\newcommand{\attrib}[1]{\nopagebreak\noindent
\makebox[\dimexpr(\versewidth)+2em][r]{\footnotesize#1\hspace{-2em}}}
\begin{document}
\settowidth\versewidth{What if tomorrow the war could be over?}
\begin{flushright}
\parbox{\versewidth}{
This is a war and we are soldiers. \\
What if tomorrow the war could be over? \\
Isn't that worth fighting for? \\
Isn't that worth dying for? \\
\attrib{Morpheus}
}
\end{flushright}
\begin{flushleft}
\parbox{\versewidth}{
This is a war and we are soldiers. \\
What if tomorrow the war could be over? \\
Isn't that worth fighting for? \\
Isn't that worth dying for? \\
\attrib{Morpheus}
}
\end{flushleft}
\end{document}
是否可以在不使用 \makebox 定位作者(\attrib)的情况下做到这一点?
我对排版和 LaTeX 都只是个初学者。我的经验仅限于网站开发。
答案1
你应该用最广泛的诗句作为论据\settowidth\versewidth
;这是我的建议:
\documentclass{article}
\usepackage{verse}
\newcommand{\attrib}[1]{\nopagebreak\noindent
\makebox[\dimexpr(\textwidth+\versewidth)/2][r]{\footnotesize#1\hspace{-2em}}}
\begin{document}
\settowidth\versewidth{What if tomorrow the war could be over?}
\begin{verse}[\versewidth]
This is a war and we are soldiers. \\
What if tomorrow the war could be over? \\
Isn't that worth fighting for? \\
Isn't that worth dying for? \\
\end{verse}
\attrib{Morpheus}
\end{document}
您可以通过对定义中的间距进行操作来控制属性的“缩进”。