Incompatibilidad de Verse y Tufte-Folleto

Incompatibilidad de Verse y Tufte-Folleto

Estoy intentando utilizar la tufte-handoutclase de documento con el versepaquete. Sin embargo, parece que tufte-handoutse carga hyperrefde forma predeterminada y esto provoca el siguiente error en verse.sty:

! LaTeX Error: Command \theHpoemline already defined.

La investigación de opciones de resolución me llevó a esta respuesta: ¿Cuál es la forma correcta de utilizar las opciones de hiperreferencia con la clase de folleto de Tufte?

Cargar con la nohyperopción en la tufte-handoutclase de documento permite que el versepaquete funcione, pero también necesito el hyperrefpaquete. (La carga hyperrefposterior todavía produce el mismo error).

¿Cómo manejo esta aparente incompatibilidad?

MWE:

\documentclass{tufte-handout}
\usepackage{verse}

\begin{document}
\begin{verse}
    A sprig, with its flower, I break.
\end{verse}
\end{document}

Respuesta1

Esto debería funcionar: deshabilite temporalmente la carga de hyperrefy cárguelo después verse. verse(¿innecesariamente?) define \theHpoemlineel formato del contador, desde mi punto de vista.

\documentclass[nohyper]{tufte-book}
\usepackage{verse}
\usepackage{hyperref}

\begin{document}
\begin{verse}
    A sprig, with its flower, I break.
\end{verse}
\end{document}

Una solución sucia, sin cambios directos enverse.sty

Dado que verse.stydefine un contador poemline, hyperrefautomáticamente hará una \theHpoemlinedefinición. Sin embargo, esto es malo, ya que

\newcommand*{\theHpoemline}{\arabic{verse@envctr}.\arabic{poemline}}

se utiliza en verse.sty.

Una solución alternativa es utilizar \providecommandtemporalmente en lugar de \newcommand, que no se queja de los comandos ya existentes y, una vez versecargado, volver a \newcommand.

\documentclass{tufte-book}
%\hypersetup{colorlinks=true} Not needed, just for debug
\let\orignewcommand\newcommand  % store the original \newcommand
\let\newcommand\providecommand  % make \newcommand behave like \providecommand
\RequirePackage{verse}
\let\newcommand\orignewcommand  % use the original `\newcommand` in future
\makeatletter
% Use the original definition from verse.sty
\renewcommand*{\theHpoemline}{\arabic{verse@envctr}.\arabic{poemline}}
\makeatother

\begin{document}
\tableofcontents
\chapter{first}

\chapter{second}
\begin{verse}
    A sprig, with its flower, I break.
\end{verse}
\end{document}

Respuesta2

Tuve el mismo problema y lo resolví ordenadamente cargando el paquete \hyperrefantes de cargarlo \verse.

información relacionada