I defined a question macro, then made it successively fancier. Right now, three macro should define a short hand for the following:
\section{Questions}
\begin{enumerate}
\item Q1...
\item Q2...
\end{enumerate}
\section{Exercises}
\begin{enumerate}
\item exercise 1
\item exercise 2
\end{enumerate}
\href{my.url.goes/here/specific}{Take the quiz}
The three commands defined to do this are:
\newcommand{\qqq}{\section{Question}\begin{enumerate}}
\newcommand{\exer}{\end{enumerate}\section{Exercises}\begin{enumerate}}
\newcommand{\endexer}[1]{\end{enumerate}\href{my.url.com/path/{#1}}{Take the quiz}}
A sample call to make this happen:
\qqq
\item What is 2+3?
\exer
\item Write a program to compute 2+3
\endexer{123}
should generate the url:
my.url.com/path/123
The error is:
! LaTeX Error: Command \endexer already defined. Or name \end... illegal, see p.192 of the manual.
I am not posting the MWE because I think this is a stupid syntax error based on something I am missing about \newcommand, but if I'm wrong, I will create an MWE and add it here.


\endexergoes in {}. But rather sake of code readability I'd recommend making this as environments instead. It gives the code a better structure – daleif May 24 '15 at 17:41\endusing\newcommandBut it always helps if you provide an example that reproduces the error rather than make people spot errors by eye. – David Carlisle May 24 '15 at 17:55Or name \end... illegalwhich is telling you exactly that, you can not define\endexerthis way. – David Carlisle May 24 '15 at 17:57