5

I have a similar subequations environment as in the mwe

\documentclass{article}
\usepackage{amsmath}
\begin{document}
  \begin{subequations}\label{eq:w} %\tag{myEQ}
  \begin{align}
    a &= b \label{eq:s1} \tag{myEQ.1}\\ %\tag{\ref{eq:w} 1}
    c &= d \label{eq:s2} \tag{myEQ.2}   %\tag{\ref{eq:w} 2}
  \end{align}
  \end{subequations}
   I need to reference \eqref{eq:w} and \eqref{eq:s1} and 
   would like the tags to be coherent 

\end{document}

I found this related question where the numbering within the subequation is automated. However, that is not my concern, rather then the fact that \eqref{eq:w} should show (myEQ) rather than (1).

Davide
  • 608
  • 1
    Will all subequations in your document have the prefix "myEQ"? – LaRiFaRi Dec 22 '15 at 15:58
  • Since LaTeX is linear and subequations just change the counter, how should eq:q know that you are using \tag, you'd probably need to make your own version of subequations that allows the user to add a prefix to the autogenerated equation numbers, and then not use \tag – daleif Dec 22 '15 at 15:58
  • @daleif , the \tag in subequations was meant to suggest the functionality i needed, rather than syntax. \def\@currentlabel{myEQ} in the accepted answer is the way to achieve the functionality... – Davide Dec 22 '15 at 18:20
  • @LaRiFaRi , the setting is a long document in which a model is presented at the beginning and then may be referred to (partially or as a whole) much later on. naming the model is intended to avoid scrolling/turning back to the first pages each time. thus, it will be this particular system of equation to need the personalised tag. – Davide Dec 22 '15 at 18:24

2 Answers2

5

If only once, please do

% arara: pdflatex
% arara: pdflatex

\documentclass{article}
\usepackage{mathtools}

\begin{document}
    \begin{subequations}
        \makeatletter
        \def\@currentlabel{myEQ}
        \makeatother
        \label{eq:w}
        \renewcommand{\theequation}{myEQ.\arabic{equation}}
        \begin{align}
            a &= b \label{eq:s1}\\
            c &= d \label{eq:s2}
        \end{align}
    \end{subequations}
    I need to reference \eqref{eq:w} and \eqref{eq:s1} and 
    would like the tags to be coherent. 
\end{document}

enter image description here

If you need it more often, you should take a look on numbering parentequation of subequations

I do not get your last point. The equations are aligned. In your MWE already.

LaRiFaRi
  • 43,807
  • Sorry for not being clear. my last point was meant to clarify that using separate equations was not an option. I thought it would be possible to tinker with eqaution/split/something of the like to achieve the same result. – Davide Dec 22 '15 at 18:08
  • on a side note,I had already read numbering parentequation of subequations and favorited it, but was not able to find it out earlier today – Davide Dec 22 '15 at 18:10
5

You can define a different environment based on subequations:

\documentclass{article}
\usepackage{mathtools}

\makeatletter
\newenvironment{taggedsubequations}[1]
 {%
  % \end{subequations} will advance `equation`
  \addtocounter{equation}{-1}%
  \begin{subequations}%
  % set the current label
  \def\@currentlabel{#1}%
  % redefine \theequation
  \renewcommand{\theequation}{#1.\arabic{equation}}%
 }
 {\end{subequations}}
\makeatother %not \makeatletter

\begin{document}

\begin{equation}
1=1
\end{equation}

\begin{taggedsubequations}{myEQ}\label{eq:w}
\begin{align}
a &= b \label{eq:s1}\\
c &= d \label{eq:s2}
\end{align}
\end{taggedsubequations}

I need to reference \eqref{eq:w} and \eqref{eq:s1} and
would like the tags to be coherent.

\begin{equation}
1=1
\end{equation}

\end{document}

enter image description here

Davide
  • 608
egreg
  • 1,121,712