I created a new counter and new commands to label and refer to this counter (the latter looks redundant here because I stripped away some formatting I have in it) according to this answer.
As the title says, when I'm trying to use my new counter inside an amsmath's align environment - it doesn't work. When \nonumber is added at the end of the relevant line - no label is created whatsoever (I checked the .aux file). When this is not added (as in the code below) the labeled counter is align's one rather than my custom counter, although mine was the last counter that was incremented (as it is \refstepcounter-ed right before the \label inside the new command).
How can I label my counter as opposed to align's one while inside this environment?
\documentclass{article}
\usepackage{amsmath}
%equations' placeholders to allow breaking them in the middle and picking up from the same spot https://tex.stackexchange.com/a/21305/160156
\newcounter{eqplaceholdercounter}
\newcommand{\eqplaceholder}{\stepcounter{eqplaceholdercounter}\theeqplaceholdercounter}
\newcommand{\eqplaceholderlbl}[1]{{\refstepcounter{eqplaceholdercounter}\label{#1}\theeqplaceholdercounter}}
\newcommand{\eqplaceholderref}[1]{\ref{#1}}
\begin{document}
\begin{align}
eq1 \\
eq2 \\
eq3\quad \eqplaceholderlbl{plc:label} %\nonumber
\end{align}
But the ref is \eqplaceholderref{plc:label} instead of \theeqplaceholdercounter.
While if I label outside of the align environment, like here:
\eqplaceholderlbl{plc:label2}, all is well and I can reference it and get the correct number - \eqplaceholderref{plc:label2}.
\end{document}
The above code's output, as it is:
The above code's output, after uncommenting the \nonumber:



\makeatletterbefore the\newcommand(that uses @ as a letter) and its opposite\makeatotherafter it, just in case. – et_l Aug 14 '18 at 17:00\makeatletterand\makeatotherdo? You can also make things a bit cleaner and define\makeatletter \newcommand{\ltxlabel}{\ltx@label} \makeatother, allowing you to use\ltxlabelwithin your main document. – Werner Aug 14 '18 at 17:11