Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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$}}}\\}%





share|improve this question
Your code works OK in my system (TeX Live2012). Are you using an updated system? –  Gonzalo Medina 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 ;-) –  Gonzalo Medina Aug 28 '12 at 16:06

1 Answer 1

up vote 2 down vote accepted

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.
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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