\hyperlink
을 에 넣으려고 하는데 \makenote
다음 오류가 발생합니다.
! 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.
소스 코드는 다음과 같습니다.
% 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}
컴파일에 사용 lualatex
하지만 사용하면 pdflatex
(미리 주석 처리 fontspec
) 동일한 오류가 발생합니다.
이 \hyperlink
명령은 텍스트에서는 훌륭하게 작동하지만 \makenote
.
이 \hyperref
명령은 에서 작동 \makenote
하지만 불행하게도 s의 앵커는 s가 일반적으로 정의된 \label
위치와 정확히 일치하지 않습니다 . \label
따라서 이것이 해결책입니다.
답변1
KOMA-Script 3.23부터패키지에는 명령을 보호할 필요가 없고 중단될 수 있으며 확장해서는 안 되는 scrlayer-notecolumn
스타 변형이 있습니다 .\makenote
\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}
결과
오류 없이.
다음을 사용하여 동일한 결과를 얻을 수 있습니다(3.23 이전의 KOMA-Script에서도).
\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}
또는
\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}
또는
\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}