# Problem numbering equations properly

I'm trying to create some equations with amsmath with captions and references. I'd like to suppress the equation number in the margin. I know this can be done using the equation* environment but this seems to have issues for the reference numbers. When I use equation* the references read "Subsection 1.1" etc. Further, multiple equations in the same subsection have the same reference ("Subsection 1.1")

Using \nonumbering on the line with the margin number also seems not to work. It appears to keep the equation counter from incrementing and all equations are labeled "Equation 1"

I'd prefer to avoid using floats if possible.

\documentclass[11pt]{article}

\usepackage{caption}
\usepackage{lipsum}
\usepackage{amsmath}
\usepackage{hyperref}

\begin{document}

\section{Details}
\lipsum[1]

\subsection{More Details}

\lipsum[1]

% Equation 1
\begin{equation*} \label{eq:myFirstEq}
y = mx + b
\end{equation*}

% I want a caption below the equation
\begin{center}
\textbf{\autoref{eq:myFirstEq} - My Equation}
\end{center}

% Equation 2
\begin{equation*} \label{eq:mySecondEq}
a^2 + b^2 = c^2
\end{equation*}

\begin{center}
\textbf{\autoref{eq:mySecondEq} - Another Equation}
\end{center}

\lipsum[1]

I'm going to reference \autoref{eq:myFirstEq} and \autoref{eq:mySecondEq} here.

\end{document}

• To what are you expecting to refer, if there is no number? – Paul Gessler Mar 20 '15 at 18:29
• I don't understand the logic behind "not numbering an equation" and then using \label to reference it. What should \ref return if there is no number associated with the equation? – Werner Mar 20 '15 at 18:29
• what he want is make equation as figure and table with label below – touhami Mar 20 '15 at 18:44
• I mistakenly thought equation* was suppressing the display of the equation number only. The goal was not to suppress numbering of the equation, but rather to suppress the display of the equation number to the right of the equation. The answer below worked. – agf1997 Mar 20 '15 at 19:00
• It seems you are after a different way of labeling equations (with a number and "caption" below instead of the traditional number to the right). You don't want to suppress the number to the right, but instead relocate it and add some additional info around it. – Paul Gessler Mar 20 '15 at 19:05

It makes no sense for me to refer to unnumbered equations, anyway this can be done by redefining \tagform@ (which is the command that typesets the equation number) to do nothing.

\makeatletter
\renewcommand\tagform@[1]{\relax}
\makeatother


MWE:

\documentclass[11pt]{article}

\usepackage{caption}
\usepackage{lipsum}
\usepackage{amsmath}
\usepackage{hyperref}

\makeatletter
\renewcommand\tagform@[1]{\relax}
\makeatother

\begin{document}

\section{Details}
\lipsum[1]

\subsection{More Details}

\lipsum[1]

% Equation 1
$$\label{eq:myFirstEq} y = mx + b$$

% I want a caption below the equation
\begin{center}
\textbf{\autoref{eq:myFirstEq} - My Equation}
\end{center}

% Equation 2
$$\label{eq:mySecondEq} a^2 + b^2 = c^2$$

\begin{center}
\textbf{\autoref{eq:mySecondEq} - Another Equation}
\end{center}

\lipsum[1]

I'm going to reference \autoref{eq:myFirstEq} and \autoref{eq:mySecondEq} here.

\end{document}


Output:

## EDIT

If you want captions for your equations, you can adopt this way.

Load the float package and define

\newfloat{floatequ}{H}{loe}
\floatname{floatequ}{Equation}


Now encase every equation in the floatequ environment.

About the formatting of the caption, I think you need

\captionsetup[floatequ]{font=bf,labelfont=bf,labelsep=endash}


MWE:

\documentclass[11pt]{article}

\usepackage{caption,float}
\usepackage{lipsum}
\usepackage{amsmath}
\usepackage{hyperref}

\newfloat{floatequ}{H}{loe}
\floatname{floatequ}{Equation}
\captionsetup[floatequ]{font=bf,labelfont=bf,labelsep=endash}

\makeatletter
\renewcommand\tagform@[1]{\relax}
\makeatother

\begin{document}

\section{Details}
\lipsum[1]

\subsection{More Details}

\lipsum[1]

\begin{floatequ}
% Equation 1
$$\label{eq:myFirstEq} y = mx + b$$
\caption{My equation}
\end{floatequ}

\begin{floatequ}
% Equation 2
$$\label{eq:mySecondEq} a^2 + b^2 = c^2$$
\caption{Another equation}
\end{floatequ}

\lipsum[1]

I'm going to reference \autoref{eq:myFirstEq} and \autoref{eq:mySecondEq} here.

\end{document}


Output:

If you want, you can also print the list of equations by adding

\listof{floatequ}{List of Equations}


Note that, since I've defined the floatequ environment to accept only the H floating specifier, it is not allowed to float.

• I think what the OP's ask is what your answer give but without \begin{center} \textbf{\autoref{eq:mySecondEq} - Another Equation} \end{center} that shoud by in the equation definition – touhami Mar 20 '15 at 18:51
• Think about what happens here if a page break falls between the "paragraphs" that shouldn't really be paragraphs. – Paul Gessler Mar 20 '15 at 19:17
• @karlkoeller i post an answer in my sense but just like your's if you edit your answer to do what i propose i'll delete mine – touhami Mar 20 '15 at 19:29
• @karlkoeller try to replace the first \lipsum[1] by \lipsum[1-2] – touhami Mar 20 '15 at 19:35
• @agf If you want equation captions, see the edit – karlkoeller Mar 20 '15 at 19:56