TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to redefine the command PrintDescribeMacroof doc.sty in order to create a label that I can link to using hyperref.

However whenever I add a label to the command I get an error

   \strut \MacroFont %
   \color{doctools@ColorCodeNames} \string #1\ }}{}

because the label is created with a different content than what I expect

\newlabel{doc:desc:\unhbox \voidb@x \relax \begingroup \catcode `\spacefactor 
\@m 11\relax \par }{{1}{3}{Commands provided by doc.sty and ltxdoc}{MacroName.1}{}}

Any better idea how to modify the commands of doc.sty?

share|improve this question
I know this is an old question; did you make any progress? If so, please add your solution. Or make a minimal example of what you're trying to do. – egreg Jul 6 '13 at 21:08
I have created a sty file called doctools (see code.google.com/p/latexthesistemplate/source/browse/trunk/…) which defines this command without the label. So no, there was no progress. – Matthias Pospiech Jul 8 '13 at 16:41

You need to allow for the fact that #1 here is a command, and so when it gets written to the .aux file it may expand. You could use \string, but you'd still have an issue when reading back the command. A simplistic approach is to turn into a string and then gobble the \

 \string #1\ %

Note that this may go wrong if you pass something other than a command name here (say a single active char): I guess a fuller fix would include a test for this.

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.