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>
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:



\RequirePackage{ltxkeys}   %%% Different error if not there


\newenvironment{defini}{\refstepcounter{definitioncount} \begin{mdframed}[style=DefinitionStyle]%
{\bfseries \large\textcolor{white}{$\quad$Definition \thedefinitioncount $\quad$}}}\\}%





  • Your code works OK in my system (TeX Live2012). Are you using an updated system? Aug 28 '12 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é
    Aug 28 '12 at 14:49
  • Heiko has provided an informed answer, so you can acknowledge him ;-) Aug 28 '12 at 16:06

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.