# Automatic label formulas with (*) and (**) instead of numbers

As in the title, I would like to label formulas in certain environments (such as proofs) using (*), (**), ... instead of numbering. Is there a way to achieve this?

• \tag{*} should work – user31729 Jun 7 '16 at 17:46
• How about an automated solution? I do not want to keep track of the number of * for the next label. – An Hoa Jun 7 '16 at 17:49
• This could get really long ;-) – user31729 Jun 7 '16 at 17:53
• Are you using hyperref? What about the ambiguity of having two proofs, each with a (*)? – Werner Jun 7 '16 at 18:07
• What package do you use to create your proofs? – Werner Jun 7 '16 at 18:09

Something like this?

This works with hyperref even for multiple occurences of ** (which is unclear,however, then) as long as the dummy proof counter proof isn't reset.

The equation number is expanded first before it's used in \loopstars.

Of course, this will provide trouble if there are more than 10 symbols, i.e. the equation 'number' will get too wide!

\documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{amsthm}

\newcounter{starcnt}
\makeatletter
\newcommand{\loopstars}[1]{%
\c@starcnt\z@%
\loop\unless\ifnum\c@starcnt = #1%
*%
\repeat%
}
\makeatother

\newcounter{proof}
\usepackage{xpatch}

\makeatletter
\AtBeginEnvironment{proof}{%
\refstepcounter{proof}%
\renewcommand{\theHequation}{equation.\arabic{proof}.\arabic{equation}}
\renewcommand{\theequation}{\protect\loopstars{\number\value{equation}}}
}

\makeatother

\usepackage{hyperref}

\begin{document}

In \eqref{foo} we see that and in \eqref{foobar}

\begin{proof}
$$E=mc^2$$
\begin{align}
E=mc^2 \label{foo} \\
E=mc^2
\end{align}
\end{proof}

\clearpage
\setcounter{equation}{0}
\begin{proof}
$$E=mc^2$$
\begin{align}
E=mc^2 \label{foobar} \\
E=mc^2
\end{align}
\end{proof}


  \documentclass[11pt]{article}
\usepackage{amsmath}
\usepackage{amsthm}

\newcounter{starcnt}
\newcounter{proof}
\newcounter{dummycntr}

\newcommand{\mynumberingplaceholder}{$\int\!$}
\makeatletter
\newcommand{\loopsymbols}[1]{%
\raggedleft%
\c@starcnt\z@%
\loop\unless\ifnum\c@starcnt = #1%
\mynumberingplaceholder%
\repeat%
}
\makeatother

\usepackage{xpatch}

\makeatletter
\AtBeginEnvironment{proof}{%
\refstepcounter{proof}%
\renewcommand{\theHequation}{equation.\arabic{proof}.\arabic{equation}}
\renewcommand{\theequation}{\protect\loopsymbols{\number\value{equation}}}
}

\makeatother

\usepackage{hyperref}

\begin{document}

In \eqref{foo} we see that and in \eqref{foobar}

\begin{proof}
$$E=mc^2$$
\begin{align}
E=mc^2 \label{foo} \\
E=mc^2
\end{align}
\loop\unless\ifnum\value{dummycntr} = 10
\stepcounter{dummycntr}
$$c^2 = a^2 +b^2 \\$$
\repeat
\end{proof}

\clearpage
\setcounter{equation}{0}
\begin{proof}
$$E=mc^2$$
\begin{align}
E=mc^2 \label{foobar} \\
E=mc^2
\end{align}
\end{proof}

\end{document}


• This works really well. I adapted it to get different tagging commands; e.g. use (*) for exact sequences, and keep numbering for equations. – An Hoa Jun 7 '16 at 19:44
• @AnHoa: What do you mean by exact sequences? – user31729 Jun 7 '16 at 19:47
• It is in widely used in homological algebra. See en.wikipedia.org/wiki/Exact_sequence – An Hoa Jun 7 '16 at 19:53
• Did you try doing two proof environments? – egreg Jun 7 '16 at 22:38
• @egreg: Yes, in both examples there are two proof environments. I've reset the equation counter (just for demonstration purposes) manually however. Of course, I would not use this 'numbering' style for myself. – user31729 Jun 8 '16 at 3:02

Building on Christian's ideas, here's a version that resets the equation number in the proofs and keeps the outer ones to the standard. It also allows changing (locally) the symbol in a given proof environment (default are asterisks).

\documentclass{article}

\usepackage{amsmath,amsthm,xpatch}
\usepackage{hyperref}

\ExplSyntaxOn
\cs_new:Npn \stars #1
{
\prg_replicate:nn { \use:c { c@#1 } } { \l_anhoa_eqsym_tl }
}
\tl_new:N \l_anhoa_eqsym_tl
\NewDocumentCommand{\seteqsymbol}{m}
{
\tl_set:Nn \l_anhoa_eqsym_tl { #1 }
}
\ExplSyntaxOff
\seteqsymbol{*} % initialize

\newcounter{saveequation}
\newcounter{proof}
\xapptocmd{\proof}
{%
\stepcounter{proof}%
\setcounter{saveequation}{\value{equation}}%
\setcounter{equation}{0}%
\renewcommand{\theequation}{\stars{equation}}%
\renewcommand{\theHequation}{\theproof.\arabic{equation}}%
}{}{}
\xapptocmd{\endproof}
{\setcounter{equation}{\value{saveequation}}}
{}{}

\begin{document}

Here is an equation
$$a=b$$

\begin{proof}
This is an important equation
$$0=0\label{a}$$
Note that \eqref{a} together with
$$0=0$$
ends the proof.
\end{proof}

\begin{proof}\seteqsymbol{\ensuremath{\vee}}
This is an important equation
$$0=0\label{b}$$
Note that \eqref{b} together with
$$0=0$$
ends the proof.
\end{proof}

Here is an equation
$$a=b$$

\end{document}
`