\poemtitle \versewidth 的中心

\poemtitle \versewidth 的中心

平均能量损失

\documentclass[a5paper,11pt]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{verse}
\usepackage{showframe}
\setlength{\leftmargini}{0em}
\begin{document}
\newcommand{\attrib}[1]{%
\nopagebreak{\raggedleft\footnotesize\textit{#1}\par}}

\poemtitle{Fleas}
%\settowidth{\versewidth}{You can’t tell a he from a she.}
\begin{verse}%[\versewidth]
What a funny thing is a flea. \\
You can’t tell a he from a she. \\
But he can. And she can. \\
Whoopee! \\
\end{verse}
\attrib{2015}

\end{document}

并输出

在此处输入图片描述

我想要的是\poemtitle的中心\versewidth。它如何改变我的 MWE 中的宏?

答案1

\poemtitle用于\@vstypeptitle打印(参见 verse.sty)。我修改了它以使用\parbox

注意,\vspace在新页面的顶部会被忽略。如果想在那里添加间隙,请使用 \vspace*。

\documentclass[a5paper,11pt]{book}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{lmodern}
\usepackage{verse}
\usepackage{showframe}
\setlength{\leftmargini}{0em}
\begin{document}
\newcommand{\attrib}[1]{%
\nopagebreak{\raggedleft\footnotesize\textit{#1}\par}}

\makeatletter
\renewcommand{\@vstypeptitle}[1]{%
  \vspace{\beforepoemtitleskip}%
  \noindent\parbox{\versewidth}{\poemtitlefont #1}%
  \vspace{\afterpoemtitleskip}%
}%
\makeatother

\settowidth{\versewidth}{You can’t tell a he from a she.}
\poemtitle{Fleas}
\begin{verse}%[\versewidth]
What a funny thing is a flea. \\
You can’t tell a he from a she. \\
But he can. And she can. \\
Whoopee! \\
\end{verse}
\attrib{2015}

\end{document}

跳蚤

答案2

当诗节块在一行上居中时,Poemscol 会调整标题的水平位置。您可以调整水平位置的工作方式。

在下面的例子中,行\settowidth{\versewidth}{While the brass clock mumbled to itself like a nun.}采用短语“While the brass clock mumbled to itself like a nun”(最长的一行)的宽度,并使用它来设置长度的值。(诗歌环境的开始)的\versewidth可选参数将诗歌置于长度的中心,该长度刚刚由命令定义。[\versewidth]\begin{poem}\versewidth\settowidth

\versewidth或者,您也可以使用 以外的其他长度作为 的可选参数来移动诗句块\begin{poem},例如\begin{poem}[3em]

这是一个有效的例子:

\documentclass{article}
\usepackage{fancyhdr,geometry,keyval,ifthen,mparhack}
\usepackage{poemscol}
\stanzaatbottom{*}
\nostanzaatbottom{\relax}
\geometry{textwidth=4in,textheight=6.75in,headheight=14pt,paperwidth=6in,paperheight=9in}
\begin{document}
\centertitles
\poemtitle{The Funeral Day}

\settowidth{\versewidth}{While the brass clock mumbled to itself like a nun.}
\epigraph{Suffield, Connecticut, 1952\\ This is a long prose block 
which I have added to show that issuing  centertitles will 
move a large text block towards the center of the page, with an 
amount specified by you but not center it line by line.}

\begin{poem}[\versewidth]
\begin{stanza}
Later, we folded our hands in his tidy room.\verseline
Patience taught us nothing: we sat for hours\verseline
While the brass clock mumbled to itself like a nun.\verseline
The shadows in the eaves began\verseline
To knot up all the air. And then outside\verseline
This bird just sang and sang and sang.\verseline
What was it to him? Where did he get the right?\verseline
I got up to close the window\end{stanza}

\begin{stanza}
And there I saw the tobacco-fields\verseline
Moving their shrouds in the dusk.\verseline
The wind came thoughtlessly over the wide cloth\verseline
And lifted the white undersides of leaves.\verseline
I didn't close the window. When I sat back down,\verseline
I didn't say what I had seen.\end{stanza}
\end{poem}

\end{document}

相关内容