[Tex/LaTex] Help defining a newcommand for short cut to equation

equationsmacros

Is there anyway to define a newcommand for an environment shortcut ? This is what I have so far, but is not working as I would like to.

\newcommand{\beq}{\begin{equation}
    \label{eq:}

and

\newcommand{\eeq}{\end{equation}}

I would like to define a command such that typing

\eq{1} 
x + y = z 
\eeq

is the same as typing something similar to

 \begin{equation} 
\label{eq:1} 
x + y = z
\end{equation}. 

Would this be possible ? I have read the posts in Define a new command with parameters inside newcommand and What exactly do \csname and \endcsname do? but did not fully understand so it would be great if someone could help me out as I am relatively new to latex.
The compiler I am using is texstudios and would greatly appreciate any help.

Thank you

Best Answer

Or even shorter:

\documentclass{article}
\newcommand{\eq}[2]{\begin{equation} \label{eq:#1} #2 \end{equation}}

\begin{document}

    \eq{1}{x + y = z}

    \eq{2}{a + b = c}

\end{document} 

After you type in your doc, you can "translate" back your source tex file to regular environments with sed or alike. I do this very often despite what others have said (which I normally agree - but not when you have 10000 equations nested as heck in all sorts of environments in a book with 3 nested translations in the same file). TeX brags about letting you concentrate on the contents doesn't it?