# [Tex/LaTex] Using more \newcommand’s into a single \newenvironment and \newenvironment instances counting

environments


There are also some other problems that I think I will incur into later on. For instance, every time I instantiate such a new environment, I wish a counter that increases with the instances(perhaps I can do it easily with a \newcounter, but now I get stuck in the aforementioned point). Finally, it would be great if I can pass a color as an argument to the \newenvironment that I can use in a \colorbox{} command to display nice colors for each team. But those are problem that I may solve later on. Now, to be more clear, here is an attempt code that I wrote and that I cannot make it work:

% Copied from internet
\let\@CUP\relax
\def\CUP#1{\def\@CUP{Tournament #1}}
%

\newenvironment{team}[3]{
\@CUP
\newcommand{\playerone}[1]{This is the first player: #1}
\newcommand{\playertwo}[1]{This is the second player: #1}
\newcommand{\playerthree}[1]{This is the third player: #1}
}{}

% Main document

…
\begin{document}

CUP{Champions}

\begin{team}
\playerone{John} \\
\playertwo{Carl} \\
\playerthree{Smith}
\end{team}

\begin{team}
\playerone{Scott} \\
\playertwo{Luke} \\
\playerthree{Danny}
\end{team}

% Some counter goes somewhere.

\end{document}

