# Mathtools' showonlyrefs fails with subequations

For the code

\begin{subequations}\label{eq:sub}
\begin{gather}
\frac{\text{d}b_1}{\text{d}z} - \im\beta_1b_1 = C_{12}b_2,\\
\frac{\text{d}b_2}{\text{d}z} - \im\beta_2b_2 = C_{21}b_1.
\end{gather}
\end{subequations}


with \mathtoolsset{showonlyrefs=true,showmanualtags=true}, the \eqref correctly references the equation group number, however the equations themselves appear in the document without numbers (so the previous equation is, say (2.7), the following one is (2.9) and no numbers 2.8a and 2.8b). Is it to be expected? Is there a work-around?

-

A workaround might be to label the two inner equations and use \noeqref to silently reference them. At the moment showonlytags does not take subequations into account, and might be difficult to implement.

Here is how showonlyrefs works. \eqref sets a special marker label to mark a given label referred to. mathtools changes the manner in which the equation numbers are typeset to see if the local label has been marked. If not it is not typeset.

The problem here is that the outer label will never be seen by the eq number typesetter within the gather.

EDIT: this works. BTW: next time please post a minimal example not a sniplet, I have no idea what \im is.

\documentclass[a4paper]{article}
\usepackage{mathtools}
\mathtoolsset{showonlyrefs=true,showmanualtags=true}
\begin{document}
\begin{subequations}\label{eq:sub}
\noeqref{eq:1,eq:2}
\begin{gather}
\frac{\text{d}b_1}{\text{d}z} - \beta_1b_1 = C_{12}b_2,\label{eq:1}\\
\frac{\text{d}b_2}{\text{d}z} - \beta_2b_2 = C_{21}b_1.\label{eq:2}
\end{gather}
\end{subequations}
\eqref{eq:sub}
\end{document}

-
Could you please give a good example? I do not understand how to use the \noeqref. Probably I put it in the wrong place. The documentation refers to \nocite, but a similar use doesn't help here. – texnic Jul 3 '12 at 13:53
\noeqref{labelname} just place it somewhere in your document, e.g. within the subequations before the gather, this will mark them as have been refered to. And you of course have to label each equation – daleif Jul 3 '12 at 15:41
OK, I was trying \noeqref{eq:sub}. Thanks for the example and sorry about \im. – texnic Jul 3 '12 at 16:33