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>
                   \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}
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
add comment

1 Answer

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
add comment

Your Answer

 
discard

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.