in this chapter of org-mode manual, there is a tutorial on how to export a latex file with some features of verse package, such as line-counting and centralization. The example given is a poem by Shakespeare:

#+ATTR_LATEX: :center t :latexcode \color{red} :lines 5
#+ATTR_LATEX: :versewidth Feed’st thy light’s flame with self-substantial fuel,
From fairest creatures we desire increase,
That thereby beauty’s rose might never die,
But as the riper should by time decease
His tender heir might bear his memory
But thou, contracted to thine own bright eyes,
Feed’st thy light’s flame with self-substantial fuel,
Making a famine where abundance lies,
Thyself thy foe, to thy sweet self too cruel.
Thou that art now the world’s fresh ornament,
And only herald to the gaudy spring,
Within thine own bud buriest thy content,
And, tender churl, mak’st waste in niggardly.
Pity the world, or else this glutton be,
To eat the world’s due, by the grave and thee.

This, however, doesn't work when I try it. I of course added #+LATEX_HEADER: \usepackage{verse} before it, but still... doesn't work. I also tried #+LATEX_HEADER: \usepackage{verse.sty} instead, but then it displays: file [...] wasn't produced "See "Org PDF LaTEx Output" for details".

  • "doesn't work" means what exactly? It compiles into a pdf but you don't see the line numbers/it is not centered/it is not colored red? Or something else? FWIW, after installing the texlive-verse package and fixing an apparent bug in the verse.sty that was installed, it all works fine for me. Before I fixed the bug, the compilation failed with the error: ! LaTeX Error: Command \theHpoemline already defined. which I fixed by changing the \newcommand on line 34 of verse.sty to a \renewcommand. I have no idea who defined it originally, so this is a workaround, not a fix.
    – NickD
    Feb 14 at 22:14
  • Yes, it compiles without numbers etc. I use Miktex; I checked it and the verse-package is installed. Yet, it compiles as if it weren't installed. Feb 14 at 22:35
  • Check the .tex file and make sure there is a \usepackage{verse} line in the preamble. Check the rest of the file too and see if it makes sense: in particular, does it include \begin{verse}...\end{verse} and the \poemlines{5} \color{red} macro calls?
    – NickD
    Feb 14 at 22:46
  • So, \usepackage{verse} is there, as well as \begin{verse}...\end{verse}. But \poemlines{5} \color{red} is absent. I'm uninstalling MikTex and installing Texlive to see if this is the problem. Feb 14 at 22:58
  • It's Org mode that produces the TeX file, so if something is missing in the TeX file, then Org mode is the culprit. The TeX processor takes the TeX file produces by Org mode as input, so it can not be held responsible.
    – NickD
    Feb 15 at 1:32

1 Answer 1

#+LaTeX_HEADER: \usepackage{verse}
#+LATEX_HEADER: \settowidth{\versewidth}{And the dish ran away with the spoon.}

#+OPTIONS: todo:nil date:nil toc:nil

* A Verse

#+ATTR_LATEX: :center t :latexcode \itshape
Hey Diddle Diddle
The cat and the fiddle,
The cow jumped over the moon.
The little dog laughed,
To see such sport,
And the dish ran away with the spoon.

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.