Consider the following MWE:
\documentclass{article}
\usepackage{mathtools}
\usepackage{amsmath}
\newtagform{brackets}{[}{]}
\usetagform{brackets}
\AtBeginDocument{\let\latexlabel\label}
\usepackage{hyperref}
\hypersetup{
colorlinks=true,
linkcolor=black,
filecolor=black,
urlcolor=black,
}
\urlstyle{same}
\begin{document}
\begin{equation*}
\refstepcounter{equation}\latexlabel{a}
\refstepcounter{equation}\latexlabel{c}
\refstepcounter{equation}\latexlabel{e}
a=b\quad c=d\quad e=f
\tag{\ref*{a},$,$ \ref*{c},$,$ \ref*{e}}
\end{equation*}
\end{document}
When I compile it, it doesn't show the third tag and gives me two errors:
paragraph ended before @firstoffive was completeargument of @firstoffive has an extra }
I think the problems are due to the hyperref package because by removing it and substituting \tag* with \tag it doesn't give me any error whatsoever. In addition, when using hyperref I've to manually insert the commas in a math environment in order for them to be shown.
What are those errors? How can I get rid of them and have the file to compile correctly?
Thank you for your time, it is very appreciated.
Edit:
For more clarity, this is what the code erringly compiles to:
This is how I want it to compile, and how correctly compiles without using the hyperref package:


$,$items in the argument of\tag? And what are you trying to achieve by using\latexlabelrather than\labeldirectly? – Mico Nov 18 '18 at 20:15I've not written the code myself, I took it from https://tex.stackexchange.com/questions/120670/equations-side-by-side-both-numbers-on-the-right
– Edoardo Serra Nov 18 '18 at 20:53