當我將 hyperref 與 mdframed 和 pdflatex 一起使用時遇到問題。下面是一個 MWE,它給出了以下錯誤:
! Missing \endcsname inserted.
<to be read again>
\bx@A
l.29 \end{defini}
如果我不使用 hyperref,問題就會消失;然而,對於 100 多頁的文檔,基本上需要有一個超連結的目錄。這是 MWE:
\documentclass[11pt]{memoir}
\usepackage{lipsum}
\usepackage{mdframed}
\RequirePackage{ltxkeys} %%% Different error if not there
\usepackage{xcolor}
\mdfdefinestyle{DefinitionStyle}{innertopmargin=5pt,linewidth=4pt,linecolor=red,backgroundcolor=blue!3}
\newcounter{definitioncount}[section]
\newenvironment{defini}{\refstepcounter{definitioncount} \begin{mdframed}[style=DefinitionStyle]%
\raisebox{4pt}[0pt][-5pt]{\hspace{-14pt}\fcolorbox{red}{red}%
{\bfseries \large\textcolor{white}{$\quad$Definition \thedefinitioncount $\quad$}}}\\}%
{\end{mdframed}}
\usepackage{hyperref}
\begin{document}
\chapter{Introduction}
\lipsum[2]
\lipsum[1]
\begin{defini}
\lipsum[1]
\end{defini}
\end{document}
答案1
這很可能是在 2012/08/03 v6.82y 中引入的錯誤:
* 6.82y
* Unique destination names: Lookup for parent counters added
for counters that are defined before hyperref is loaded and
\theH<counter> is not provided.
並在 2012/08/11 v6.82z 中修復:
* 6.82z
* Fix in parent counter lookup, meaning of \@elt is restored after usage.