# Change enumerate option within newenvironment

I've been trying to create a new environment to have a sort of recipe or list of steps, like

Process 1

Step 1 - Do this;

Setp 2 - Do that;

I'd like it to accept \label command since I'll have to reference it.

Based on wikibooks: LATEX/macros and shared latex, I've been able to produce the following:

\documentclass[12pt, a4paper]{report}
\newcounter{process}[section]
\newenvironment{process}[1][]
{
\refstepcounter{process}\par\medskip \noindent
\textbf{Process~\theprocess #1} \rmfamily
}
{
\medskip
}

\begin{document}

\noindent
This will be my beautiful new environment!
\begin{process}
\begin{enumerate}[label = \textit{Step \arabic* -}, leftmargin=+.7in]
\item this is the first step
\item this is the second step
\end{enumerate}
\label{pr:test}
\end{process}
I'm able to reference Process \ref{pr:test}

\end{document}

which is quite acceptable. I was wondering if there is better way to do this in which LATEX sets enumerate option in that environment automatically and get rid of

[label = \textit{Step \arabic* -}, leftmargin=+.7in]

I've been trying to have something like

\newenvironment{process}[1][]
{
\refstepcounter{process}\par\medskip \noindent
\textbf{Process~\theprocess #1} \rmfamily
\begin{enumerate}[label = \textit{Step \arabic* -}, leftmargin=+.7in]
}
{
\end{enumerate}
\medskip
}

which doesn't give the desired results. Any idea?

If you define your process environment to include the enumerate setup, you'll lose the capability to properly \label-and-\ref it, since you'll technically only be able to \label-and-\ref the \items within your process (not the process itself).

Below I define your process environment to take an optional argument using a key-value approach. You can specify a title and/or a label, which is then inserted at the correct location to properly reference the process.

\documentclass{article}

\usepackage{enumitem,xkeyval}

\newcounter{process}[section]

\makeatletter
\define@cmdkey{process}[proc@]{label}[\relax]{}
\define@cmdkey{process}[proc@]{title}[\relax]{}

\newenvironment{process}[1][]
{%
\setkeys{process}{label,title,#1}%
\par\medskip\noindent
\refstepcounter{process}%
{\bfseries Process~\theprocess{} \proc@title}%
\ifx\proc@label\relax\else\label{\proc@label}\fi
\rmfamily
\begin{enumerate}[label = \textit{Step \arabic* -}, leftmargin=+.7in]
}
{%
\end{enumerate}
}
\makeatother

\begin{document}

\noindent
This is a process:
\begin{process}[title=Test1,label=pr:test1]
\item this is the first step
\item this is the second step
\end{process}
I'm able to reference Process~\ref{pr:test1}. Also see Process~\ref{pr:test2}:
\begin{process}[label=pr:test2]
\item this is the first step
\item this is the second step
\end{process}

\end{document}

Note that there may occur a page break between your process title and the steps. One could get around this using needspace.