Sign up ×
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 have defined a custom environment (using the tocloft package, thanx to Juan) that looks like:

\newcommand{\listscriptname}{List of Scripts}
  { \vspace{3mm}\hspace{3mm}
    \textbf{Script~\thescript #1:code/#2.groovy}}

which I use like:


And refer to it with:


But instead of the script environment number, I get the number of the section.

What am I doing wrong (I did try several variations...)?

share|improve this question

1 Answer 1

up vote 7 down vote accepted

Move \refstepcounter out of the \colorbox:

    \textbf{Script~\thescript foo#1bar:code/#2.groovy}}
share|improve this answer
Of course... yes, makes sense... in retrospect at least... :) Thanx! – Egon Willighagen Oct 9 '10 at 15:37

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.