
Estoy intentando utilizar la tufte-handout
clase de documento con el verse
paquete. Sin embargo, parece que tufte-handout
se carga hyperref
de 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 nohyper
opción en la tufte-handout
clase de documento permite que el verse
paquete funcione, pero también necesito el hyperref
paquete. (La carga hyperref
posterior 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 hyperref
y cárguelo después verse
. verse
(¿innecesariamente?) define \theHpoemline
el 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.sty
define un contador poemline
, hyperref
automáticamente hará una \theHpoemline
definició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 \providecommand
temporalmente en lugar de \newcommand
, que no se queja de los comandos ya existentes y, una vez verse
cargado, 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 \hyperref
antes de cargarlo \verse
.