I am writing my thesis. To write math formulas I created the command \eq
as follows.
\newcommand{\eq}[1]{
\begin{equation}
\begin{split}
#1
\end{split}
\end{equation}}
However, now I want to use cleveref
together with autonum
.
I think, however, that this is not possible due to the way I defined the command \eq
. Here goes a minimal working example.
\documentclass{minimal}
\usepackage{amsmath}
\usepackage{cleveref}
\usepackage{autonum}
\newcommand{\eq}[1]{
\begin{equation}
\begin{split}
#1
\end{split}
\end{equation}}
\begin{document}
Without my command:\\
This is an equation
\begin{equation}\label{eq_1}
\begin{split}
1+1 &=2,\\
2+2 &=4.
\end{split}
\end{equation}
This is another
\begin{equation}\label{eq_2}
1+1=3.
\end{equation}
Only \cref{eq_1} is correct.\\
\noindent\rule{8cm}{0.4pt}
But with my command:\\
This is an equation
\eq{\label{Eq_1}
1+1 &=2,\\
2+2 &=4.
}
This is another
\eq{\label{Eq_2}
1+1=3.
}
Only \cref{Eq_1} is correct.
\end{document}
The output does not show the number of the equation Eq_1
.
So, I think the mistake is that the label of \eq
is within \split
, and autonum
has problems understanding that. If I comment the package autonum
everything goes fine but of course all eq's get numbered.
I have a lot of equations, so I do not want to change each of them.
Can any body suggest a way to just change the definition of the command \eq
so that autonum
works?
cleveref
is a package that should come most times as the last one in a preamble. In addition, I believe you fell in thesplit
trap ;-)autonum
would be an exception. In this case ifautonum
goes beforeclevref
I get a bunch of errors. So, do you think this trap is "escapable"??split
environment in everyequation
. Shorthands may appear easier to manage, but you're obfuscating your typescript.\eq
. Of course for the 1 line eq's I do not complicate my life.