Estoy intentando poner a \hyperlink
en a \makenote
, pero aparece el siguiente error:
! Use of \\makenote doesn't match its definition.
\@ifnextchar #1#2#3->\let \reserved@d =#1\def \reserved@a {
#2}\def \reserved@b {#3}\futurelet \@let@token \@ifnch
l.20 Testing hyperlink \makenote{a \hyperlink{anchorname}{hyperlink}.}
in makenote.
Este es el código fuente:
% lualatex
\documentclass{scrbook}
\usepackage{luatex85}
\usepackage{fontspec}
\usepackage{scrlayer-scrpage}
\usepackage{scrlayer-notecolumn}
\usepackage{hyperref}
\begin{document}
Testing makenote \makenote{makenote}.
Testing \hyperlink{anchorname}{hyperlink}.
Testing hyperlink \makenote{a \hyperlink{anchorname}{hyperlink}.} in makenote.
Testing \hypertarget{anchorname}{hypertarget}.
Testing hyperref in makenote \makenote{a \hyperref[labelname]{hyperref}.}.
Testing \label{labelname}label.
\end{document}
Lo uso lualatex
para la compilación, pero obtengo el mismo error si lo uso pdflatex
(comentando fontspec
de antemano).
El \hyperlink
comando funciona muy bien en texto, solo falla en \makenote
.
El \hyperref
comando funciona en \makenote
, pero desafortunadamente los anclajes de los \label
s no están exactamente donde \label
se definen los s en general. Por lo tanto esta es una solución.
Respuesta1
Desde KOMA-Script 3.23El paquete scrlayer-notecolumn
tiene una variante en estrella de \makenote
, que no necesita proteger comandos, que puede romperse y no debe expandirse:
\documentclass{scrbook}
\usepackage{fontspec}
\usepackage{scrlayer-scrpage}
\usepackage{scrlayer-notecolumn}[2017/02/08]
\usepackage{hyperref}
\begin{document}
Testing makenote \makenote{makenote}.
Testing \hyperlink{anchorname}{hyperlink}.
Testing hyperlink \makenote*{a \hyperlink{anchorname}{hyperlink}.} in makenote.
Testing \hypertarget{anchorname}{hypertarget}.
Testing hyperref in makenote \makenote{a \hyperref[labelname]{hyperref}.}.
Testing \label{labelname}label.
\end{document}
resultados en
sin error.
Puedes obtener el mismo resultado (incluso con KOMA-Script anterior a 3.23) usando:
\documentclass{scrbook}
\usepackage{fontspec}
\usepackage{scrlayer-scrpage}
\usepackage{scrlayer-notecolumn}
\usepackage{hyperref}
\begin{document}
Testing makenote \makenote{makenote}.
Testing \hyperlink{anchorname}{hyperlink}.
Testing hyperlink \makenote{a \protect\hyperlink{anchorname}{hyperlink}.} in makenote.
Testing \hypertarget{anchorname}{hypertarget}.
Testing hyperref in makenote \makenote{a \hyperref[labelname]{hyperref}.}.
Testing \label{labelname}label.
\end{document}
o
\documentclass{scrbook}
\usepackage{fontspec}
\usepackage{scrlayer-scrpage}
\usepackage{scrlayer-notecolumn}
\DeclareRobustCommand*{\rhyperlink}{\hyperlink}
\usepackage{hyperref}
\begin{document}
Testing makenote \makenote{makenote}.
Testing \hyperlink{anchorname}{hyperlink}.
Testing hyperlink \makenote{a \rhyperlink{anchorname}{hyperlink}.} in makenote.
Testing \hypertarget{anchorname}{hypertarget}.
Testing hyperref in makenote \makenote{a \hyperref[labelname]{hyperref}.}.
Testing \label{labelname}label.
\end{document}
o
\documentclass{scrbook}
\usepackage{fontspec}
\usepackage{scrlayer-scrpage}
\usepackage{scrlayer-notecolumn}
\DeclareRobustCommand*{\rmakenote}[1]{%
\makenote{\detokenize{#1}}%
}
\usepackage{hyperref}
\begin{document}
Testing makenote \makenote{makenote}.
Testing \hyperlink{anchorname}{hyperlink}.
Testing hyperlink \rmakenote{a \hyperlink{anchorname}{hyperlink}.} in makenote.
Testing \hypertarget{anchorname}{hypertarget}.
Testing hyperref in makenote \makenote{a \hyperref[labelname]{hyperref}.}.
Testing \label{labelname}label.
\end{document}