[Tex/LaTex] Alternative subequations numbering and references

math-modesubequations

I know how to have a set of equations numbered as subequations:

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\begin{document}

Some text here 
\begin{subequations}\label{eq:full}
    \begin{align}
        y_1 &= f_1(x) \label{eq:first} \\
        y_2 &= f_2(x) \label{eq:second} \\
        y_3 &= f_3(x) \label{eq:third}
    \end{align}
\end{subequations}
\dots and now I can reference the full set as equations~(\ref{eq:full})
and for example the first as equation~(\ref{eq:first}). 

\end{document}

which gives:

Subequations as output

Is it possible to have the equations labeled as in the following make-up:

fake make up

…and make the references to the single equations stay the same? (Or maybe change the "global" one to 1a--c, not sure).

Best Answer

It's possible to do it, but the name I gave to the environment should clear up my opinion about it. ;-)

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{amsmath}
\usepackage{environ}

\makeatletter
\newsavebox{\horriblesubequationsbox}
\NewEnviron{horriblesubequations}[1]{%
  \setbox\horriblesubequationsbox=\vbox{
    \hsize=\dimexpr\linewidth-8em\relax
    \begin{subequations}
    \renewcommand{\theequation}{\alph{equation}}
  \vspace*{-\baselineskip}\vspace*{-\abovedisplayskip}
    \noindent\strut
    \begin{align}
    \BODY
    \end{align}
    \end{subequations}
    \addtocounter{equation}{-1}%
  }%
  \begin{equation}\label{#1}
  \hspace*{4em}\left.\vcenter{\unvbox\horriblesubequationsbox\unskip}\right\rbrace
  \end{equation}
}
\makeatother

\begin{document}

Some text here 
\begin{horriblesubequations}{eq:full}
  y_1 &= f_1(x) \label{eq:first} \\
  y_2 &= f_2(x) \label{eq:second} \\
  y_3 &= f_3(x) \label{eq:third}
\end{horriblesubequations}
\dots and now I can reference the full set as equations~(\ref{eq:full})
and for example the first as equation~(\ref{eq:first}). 

Some text here 
\begin{horriblesubequations}{eq:full+}
  y_1 &= f_1(x) \label{eq:first+} \\
  y_2 &= f_2(x) \label{eq:second+} \\
  y_3 &= f_3(x) \label{eq:third+} \\
  y_4 &= f_4(x) \label{eq:fourth+}
\end{horriblesubequations}
\dots and now I can reference the full set as equations~(\ref{eq:full+})
and for example the first as equation~(\ref{eq:first+}). 

\end{document}

Beware that, as the code stands, the global label is mandatory.

enter image description here