1

I'm typesetting a bunch of poetry some lines of which have what are essentially marginal labels, all of which I want to be right justified against the right-hand margin. When I use \hfill, they do not align.

What can I use other than \hfill to insert an arbitrary amount of whitespace that ensures all of the labels are right-justified?

Here's my MWE:

\documentclass{memoir}

\begin{document}

\begin{verse}
Lorem ipsum dolor sit amet,\hfill\emph{antistrophe 1} \\
\end{verse}

\begin{verse}
consectetur adipiscing elit.\hfill\emph{strophe 2} \\
\end{verse}

\begin{verse}
Donec malesuada aliquet cursus.\hfill\emph{antistrophe 2} \\
\end{verse}

\begin{verse}
Pellentesque vitae dolor a dolor malesuada\hfill\emph{strophe 3} \\
\end{verse}

\begin{verse}
sodales quis vel arcu. Quisque in varius est.\hfill\emph{antistrophe 3} \\
\end{verse}

\end{document}

And here's the output it generates:

here's the output

I would like all of the numbers to be lined up with each other, against the right-hand margin.

1 Answer 1

0

You need to use a stronger infinity than \hfill and also to remove the \rightmargin.

\documentclass{memoir}

\newcommand{\versecomment}[1]{%
  \unskip
  \hspace{0pt plus 1filll}%
  \emph{#1}%
  \hspace*{-\rightmargin}%
}

\begin{document}

\noindent X\dotfill X

\begin{verse}
Lorem ipsum dolor sit amet, \versecomment{antistrophe 1} \\
consectetur adipiscing elit.\versecomment{strophe 2} \\
Donec malesuada aliquet cursus.\versecomment{antistrophe 2} \\
Pellentesque vitae dolor a dolor malesuada\versecomment{strophe 3} \\
sodales quis vel arcu. Quisque in varius est.\versecomment{antistrophe 3} \\
\end{verse}

\end{document}

enter image description here

1
  • This works great, thanks; I did change \hspace*{-\rightmargin} to \hspace*{+\rightmargin}, because otherwise the comments overlapped with the line numbers. Mar 5 at 10:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .