I am using the verse package to set poetry with the book class. I am using \poemlines{5} to display line numbers every 5 lines.

However, the line numbers show in the right margin regardless of page side. How can I display line numbers in the left margin on even pages, and in the right on odd?

My code is as follows:







book01.tex only contains content. The above code gives me the following output:

screenshot of pdf output

  • 3
    Welcome to TeX.SE! Please show us a short compilable TeX code resulting in your issue. Then we do not have to guess what you are doing ...
    – Mensch
    Jul 30 at 21:10
  • @Mensch apologies, I have added my code and a screenshot of the current output. Jul 31 at 8:59
  • The doc says: "By default the numbers are typeset at the distance \vrightskip into the right margin. If you want line numbers set at the left use the \verselinenumbersleft declaration."
    – DG'
    Jul 31 at 9:03
  • @DG' thanks, I have seen that. What I want to know is how I can apply that only even pages, so the numbers alternate between left & right margin. Jul 31 at 9:17

1 Answer 1


I have to admit that I don't know why you would want alternating line numbers in the first place. But here we go. A quick and dirty hack would be defining a new numbering type that checks if the current page is odd: \newcommand*{\verselinenumbersalternating}{\def\@vstypelinenum{\ifodd\thepage\@vstypelinenumright\else\@vstypelinenumleft\fi}}

Caution if a number lands immedeatly below a page break the number might not be set in the correct margin.





    Once upon a midnight dreary, while I pondered, weak and weary, \\
    Over many a quaint and curious volume of forgotten lore, \\
    While I nodded, nearly napping, suddenly there came a tapping, \\
    As of some one gently rapping, rapping at my chamber door. \\
    "'Tis some visitor," I muttered, "tapping at my chamber door- \\
    Only this, and nothing more." \\!

    Ah, distinctly I remember it was in the bleak December, \\
    And each separate dying ember wrought its ghost upon the floor. \\
    Eagerly I wished the morrow;- vainly I had sought to borrow \\
    From my books surcease of sorrow- sorrow for the lost Lenore- \\
    For the rare and radiant maiden whom the angels name Lenore- \\
    Nameless here for evermore. \\!

    And the silken, sad, uncertain rustling of each purple curtain \\
    Thrilled me- filled me with fantastic terrors never felt before; \\
    So that now, to still the beating of my heart, I stood repeating, \\
    "'Tis some visitor entreating entrance at my chamber door- \\
    Some late visitor entreating entrance at my chamber door;- \\
    This it is, and nothing more." \\!

    Presently my soul grew stronger; hesitating then no longer, \\
    "Sir," said I, "or Madam, truly your forgiveness I implore; \\
    But the fact is I was napping, and so gently you came rapping, \\
    And so faintly you came tapping, tapping at my chamber door, \\
    That I scarce was sure I heard you"- here I opened wide the door;- \\
    Darkness there, and nothing more. \\!

    Deep into that darkness peering, long I stood there wondering, fearing, \\
    Doubting, dreaming dreams no mortal ever dared to dream before; \\
    But the silence was unbroken, and the stillness gave no token, \\
    And the only word there spoken was the whispered word, "Lenore?" \\
    This I whispered, and an echo murmured back the word, "Lenore!"- \\
    Merely this, and nothing more. \\!

    Back into the chamber turning, all my soul within me burning, \\
    Soon again I heard a tapping somewhat louder than before. \\
    "Surely," said I, "surely that is something at my window lattice: \\
    Let me see, then, what thereat is, and this mystery explore- \\
    Let my heart be still a moment and this mystery explore;- \\
    'Tis the wind and nothing more!" \\!

    Open here I flung the shutter, when, with many a flirt and flutter, \\
    In there stepped a stately Raven of the saintly days of yore; \\
    Not the least obeisance made he; not a minute stopped or stayed he; \\
    But, with mien of lord or lady, perched above my chamber door- \\
    Perched upon a bust of Pallas just above my chamber door- \\
    Perched, and sat, and nothing more. \\!

    Then this ebony bird beguiling my sad fancy into smiling, \\
    By the grave and stern decorum of the countenance it wore. \\
    "Though thy crest be shorn and shaven, thou," I said, "art sure no craven, \\
    Ghastly grim and ancient Raven wandering from the Nightly shore- \\
    Tell me what thy lordly name is on the Night's Plutonian shore!" \\
    Quoth the Raven, "Nevermore." \\!

    Much I marvelled this ungainly fowl to hear discourse so plainly, \\
    Though its answer little meaning- little relevancy bore; \\
    For we cannot help agreeing that no living human being \\
    Ever yet was blessed with seeing bird above his chamber door- \\
    Bird or beast upon the sculptured bust above his chamber door, \\
    With such name as "Nevermore." \\!

    But the Raven, sitting lonely on the placid bust, spoke only \\
    That one word, as if his soul in that one word he did outpour. \\
    Nothing further then he uttered- not a feather then he fluttered- \\
    Till I scarcely more than muttered, "Other friends have flown before- \\
    On the morrow he will leave me, as my hopes have flown before." \\
    Then the bird said, "Nevermore." \\!

    Startled at the stillness broken by reply so aptly spoken, \\
    "Doubtless," said I, "what it utters is its only stock and store, \\
    Caught from some unhappy master whom unmerciful Disaster \\
    Followed fast and followed faster till his songs one burden bore- \\
    Till the dirges of his Hope that melancholy burden bore \\
    Of 'Never- nevermore'." \\!

    But the Raven still beguiling all my fancy into smiling, \\
    Straight I wheeled a cushioned seat in front of bird, and bust and door; \\
    Then upon the velvet sinking, I betook myself to linking \\
    Fancy unto fancy, thinking what this ominous bird of yore- \\
    What this grim, ungainly, ghastly, gaunt and ominous bird of yore \\
    Meant in croaking "Nevermore." \\!

    This I sat engaged in guessing, but no syllable expressing \\
    To the fowl whose fiery eyes now burned into my bosom's core; \\
    This and more I sat divining, with my head at ease reclining \\
    On the cushion's velvet lining that the lamp-light gloated o'er, \\
    But whose velvet violet lining with the lamp-light gloating o'er, \\
    She shall press, ah, nevermore! \\!

    Then methought the air grew denser, perfumed from an unseen censer \\
    Swung by Seraphim whose footfalls tinkled on the tufted floor. \\
    "Wretch," I cried, "thy God hath lent thee- by these angels he hath sent thee \\
    Respite- respite and nepenthe, from thy memories of Lenore! \\
    Quaff, oh quaff this kind nepenthe and forget this lost Lenore!" \\
    Quoth the Raven, "Nevermore." \\!


enter image description here

  • Thank you, this achieves what I am after. Alternating margins for the line numbers seems to be the standard in the books of epic poetry that I own at least – the line numbers are always on the outside edge. Jul 31 at 11:10
  • If you want to do more complicated stuff, check out ctan.org/pkg/reledmac
    – DG'
    Jul 31 at 11:29

You must log in to answer this question.

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