5

When I quote verse (in a document typeset by XeLaTeX), I would like to be able to place line numbers directly adjacent to the lines, not in the margin to the left. For example:

\documentclass[12pt,oneside,article,letterpaper]{memoir}
\usepackage[margin=1in]{geometry}
\usepackage{lineno}

\newenvironment{mylinenumbers}{%
    \begin{linenumbers*}\modulolinenumbers[5]}{\end{linenumbers*}%
}

\begin{document}

Now let us consider the opening lines:

\begin{mylinenumbers}
\begin{verse}
Arma virumque cano, Troiae qui primus ab oris\\
Italiam, fato profugus, Laviniaque venit\\
litora, multum ille et terris iactatus et alto\\
vi superum saevae memorem Iunonis ob iram;\\
multa quoque et bello passus, dum conderet urbem,\\
inferretque deos Latio, genus unde Latinum,\\
Albanique patres, atque altae moenia Romae.\\
Musa, mihi causas memora, quo numine laeso,\\
quidve dolens, regina deum tot volvere casus\\
insignem pietate virum, tot adire labores\\
impulerit. Tantaene animis caelestibus irae?
\end{verse}
\end{mylinenumbers}

The verse environment indents the lines of verse, as I would like it to do (since I am quoting it in the midst of a longer document), but then this leaves the line numbers stranded out in the margin, rather than appearing right next to the verse.

How can I place the line numbers just to the left of the lines of verse?

(I should note that I would like the numbers to appear within the body text and not the margin for another reason as well, namely that I am producing a document which must have 1-inch margins in the strict sense that nothing may be closer to the edge of the page than 1 inch. Following this constraint will be much easier if I don't have to worry about LaTeX placing anything in the margin.)

3

You can adjust the separation between line numbers and text by \setlength\linenumbersep{-8mm} Adjust the value as suitable.

\documentclass[12pt,oneside,article,letterpaper]{memoir}
\usepackage[margin=1in]{geometry}
\usepackage{lineno}

\newenvironment{mylinenumbers}{%
    \setlength\linenumbersep{-8mm}         %% here
    \begin{linenumbers*}\modulolinenumbers[5]}{\end{linenumbers*}%
}


\begin{document}

Now let us consider the opening lines:

\begin{mylinenumbers}
\begin{verse}
Arma virumque cano, Troiae qui primus ab oris\\
Italiam, fato profugus, Laviniaque venit\\
litora, multum ille et terris iactatus et alto\\
vi superum saevae memorem Iunonis ob iram;\\
multa quoque et bello passus, dum conderet urbem,\\
inferretque deos Latio, genus unde Latinum,\\
Albanique patres, atque altae moenia Romae.\\
Musa, mihi causas memora, quo numine laeso,\\
quidve dolens, regina deum tot volvere casus\\
insignem pietate virum, tot adire labores\\
impulerit. Tantaene animis caelestibus irae?
\end{verse}
\end{mylinenumbers}
\end{document}

enter image description here

  • This poem is in Latin. ;-) – egreg Apr 18 '15 at 15:22
  • @egreg: That is why I don't understand it. :-) – user11232 Apr 18 '15 at 15:23
  • Thank you! That's just what I was looking for. (It's the beginning of Vergil's Aeneid.) – Alex Roberts Apr 19 '15 at 16:17
  • @AlexRoberts Thanks. egreg already educated me about it. :-) – user11232 Apr 19 '15 at 22:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.