Using an environment within an environment is sometimes problematic. See the related post Defining environments based on other ones: What's the right way?. In that sense, rather than defining a new environment and using a separate counter, I suggest using the counter provided by the algorithm
environment: algocf
, and modify both the algorithm name (from Algorithm
to ASM Spec.
) and the counter style (if needed). For example,
\renewcommand*{\algorithmcfname}{ASM Spec.}% Algorithm name
\usepackage{dcounter}% http://ctan.org/pkg/dcounter
\countstyle{<section>}%
\DeclareDynamicCounter{algocf}% <- algocf will be 'dynamic' within <section>
will reset the algocf
counter within <section>
(which could be any sectional unit that you specify, for example chapter
, or section
, or subsection
, or subsubsection
). This also redefines the presentation of the counter to be \the<section>.\arabic{algocf}
.
Of course, this will not work if you want two different style algorithms (say named Algorithm
and ASM Spec.
).