3

The following MWE produces PDF bookmarks for the each \beginsong when compiled with pdflatex, but not when compiled with lua/xelatex

\documentclass{article}
\usepackage{lipsum}
\usepackage[bookmarks=true]{hyperref}

\usepackage[lyric]{songs}

\begin{document}

\begin{songs}{} 
\beginsong{My Song}
\beginverse
\lipsum[1]
\endverse
\endsong
\end{songs}

\end{document}
2

Section 11.6.3 of the manual "PDF Bookmarks and Links" states

Each \beginsong environment adds a PDF bookmark (if generating a PDF)

...and offers snippets for customizing this behavior. If the equivalent of the default snippet is included in the premable, xelatex does generate the pdf bookmarks. My guess is that the reference above to "if generating a PDF" translates into some check that depends on pdflatex specifically, and fails when using other engines.

Here's the working, modified, MWE:

\documentclass{article}
\usepackage{lipsum}
\usepackage[bookmarks=true]{hyperref}

\usepackage[lyric]{songs}

% Required for pdf bookmarks if using xelatex/lualatex instead of pdflatex
\renewcommand{\songtarget}[2]
{\pdfbookmark[#1]{\thesongnum. \songtitle}{#2}}
\renewcommand{\songlink}[2]{\hyperlink{#1}{#2}}

\begin{document}

\begin{songs}{}

\beginsong{My Song}
\beginverse
 \lipsum[1]
\endverse
\endsong
\end{songs}
\end{document}
  • You are right indeed. The package detects PDF mode checking if \pdfoutput is defined. In LuaTeX \pdfoutput does not exist anymore but has been replaced by \outputmode. In principle it should therefore also work to do \newcount\pdfoutput \pdfoutput=1 before \usepackage{songs}. – Henri Menke Sep 13 '17 at 2:06
  • Ideally the songs package should use ifpdf to check for PDF mode. – Henri Menke Sep 13 '17 at 2:12
  • Thanks for confirming. I see @kevin-hamlen, the author, is registered on the site. I hope he'll take notice and queue a fix for a future version. – Shawn Collins Sep 13 '17 at 2:22
  • Noted. This fix will be included in version 3.1. – Kevin Hamlen Jul 2 '18 at 21:46

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.