2

When I do

\documentclass[12pt]{article}
\usepackage{amsmath}
\begin{document}\setcounter{equation}{10}
\begin{subequations}
\begin{align}
a = b,\\
a = c,\\
a = d,\\
a = e.
\end{align}
\end{subequations}
\end{document} 

I obtain

enter image description here

This was expected.

In my taste, I find the repetition of the number a bit distracting: too much information is redundant (why repeat the equation number since it is obviously the same as above?).

I am wondering if anyone can suggest a nice way to reduce the volume of the redundant information and how to obtain the effect. To be precise, I would be 100% satisfied with a solution that would work only for unique environment, as in the example above and not for several environments.

Denis
  • 5,267
  • 1
    Just for being clear: you'd like the first to be (11a) and then (b), (c) and (d)? To be honest, I'd find this distracting. – egreg Jun 07 '19 at 10:44
  • @egreg You read my mind. Also, I would like the \label and \ref to work as usual. I agree that this is unusual. Maybe it will be less so if used a lot. But your point is well taken. – Denis Jun 07 '19 at 10:57

2 Answers2

3

You can change the appearance of the equation numbers by modifying the way the equation counter is displayed as defined in \theequation.

The normal definition of this macro within the subequations environment is \theparentequation \alph{equation}. You can add a conditional to only add the parent equation number if the subequation number is 1.

Note that the equation number is also used for the number displayed in references, therefore this solution requires to manually add a reference to the main equation.

MWE:

\documentclass[12pt]{article}
\usepackage{amsmath}

\begin{document}\setcounter{equation}{10}
\begin{subequations}
\def\theequation{%
\ifnum\value{equation}=1 \theparentequation\fi%
\alph{equation}}%
\label{aismain}
\begin{align}
a = b,\\
a = c,\label{aisc}\\
a = d,\\
a = e.
\end{align}
\end{subequations}
See subequation \ref{aisc} which is actually \ref{aismain}\ref{aisc}.
\end{document}

Result:

enter image description here

This solution is only for a single subequations environment. Using the etoolbox package you can try to hook the redefinition of \theequation to the definition of the subequations environment itself with the \AtBeginEnvironment hook. However, in this case it appears that the hook is a bit too early (i.e., it does not work properly). It does work when you hook to align, however this can lead to issues when you use align outside of a subequations environment.

Code:

\documentclass[12pt]{article}
\usepackage{amsmath}
\usepackage{etoolbox}
\AtBeginEnvironment{align}{%
\def\theequation{%
\ifnum\value{equation}=1 \theparentequation\fi%
\alph{equation}}%
}
Marijn
  • 37,699
  • Nicely done. I'll wait a bit for other possible solutions (imho, the manual tweeking of \ref is not so nice).. – Denis Jun 07 '19 at 11:10
  • 1
    It might be possible to modify setting the label target text, which is usually done by defining \@currentlabel. However, amsmath does all kinds of complicated processing there (see https://tex.stackexchange.com/questions/319158/what-does-amsmath-do-to-currentlabel) which makes it difficult to do that. – Marijn Jun 07 '19 at 11:16
  • Thanks for the addition with etoolbox. Nice trick. – Denis Jun 07 '19 at 11:18
3

You can do as follows, but I'd find this distracting.

\documentclass{article}
\usepackage{amsmath,xpatch}

\makeatletter
% detach \eqref and \tag making
\let\tagform@@\tagform@ % keep a copy
\renewcommand{\eqref}[1]{\textup{\eqreftagform@{\ref{#1}}}}
\let\eqreftagform@\tagform@@

\xpatchcmd{\subequations}
  {\ignorespaces}
  {\let\tagform@\subequationstagform@\ignorespaces}
  {}{}

\def\subequationstagform@#1{%
  \check@parentequation{#1}{%
    \ifnum\value{equation}=\@ne
      \tagform@@{#1}%
    \else
      \tagform@@{\alph{equation}}%
    \fi
  }{%
    \tagform@@{#1}%
  }%
}
\def\check@parentequation#1{%
  \expandafter\check@@parentequation#1\@nil
}
\def\check@@parentequation#1#2\@nil{%
  \ifx#1\theparentequation
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
}
\makeatother

\begin{document}

\setcounter{equation}{10}

\begin{subequations}
\begin{align}
a = b, \label{b} \\
a = c, \label{c} \\
a = d, \label{d} \\
a = e. \label{e} \\
a = f\tag{*} \label{f}
\end{align}
\end{subequations}

\eqref{b}, \eqref{c}, \eqref{d}, \eqref{e}, \eqref{f}

\end{document} 

enter image description here

egreg
  • 1,121,712