我在将 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.