2

I'm encountering a problem when I use hyperref with mdframed and pdflatex. Below is a MWE which gives the following error:

! Missing \endcsname inserted.
<to be read again>
                   \bx@A
l.29    \end{defini}

If I don't use hyperref, the problem goes away; however, with a 100+ page document, having a hyperlinked table of contents is essentially a requirement. Here's the 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}
3
  • Your code works OK in my system (TeX Live2012). Are you using an updated system? Commented Aug 28, 2012 at 14:18
  • It worked! I had installed TeX on my new computer less than a month ago. I never suspected that I needed to update it, which I did using tlmgr. Could you write your comment as an answer so I can properly acknowledge it.
    – André
    Commented Aug 28, 2012 at 14:49
  • Heiko has provided an informed answer, so you can acknowledge him ;-) Commented Aug 28, 2012 at 16:06

1 Answer 1

2

It's very likely the bug that was introduced in 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.

and was fixed in 2012/08/11 v6.82z:

* 6.82z
* Fix in parent counter lookup, meaning of \@elt is restored after usage.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .