2

I recently discovered the autonum package that allow to number only the referenced equations. It's great, but I often write optimization problems on multiple lines and would like an "all or nothing" approach: either one line is cited and the whole problem is numbered or nothing is and it is not numbered at all. Is it possible ?

As a second choice I would like to force manually the whole problem to be numbered, is there any way to do that?

Here is a minimal working example, where I would like to have both lines numbered.

\documentclass{article}
\usepackage{amsmath,cleveref,autonum}
\begin{document}
\begin{subequations}
\begin{align}
    \min_x \quad & f(x) \\
    s.t. \quad & g(x) \leq 0 \label{cst}
\end{align}
\end{subequations}

Constraint is \ref{cst}

\end{document}

1 Answer 1

1

The documentation from the package autonum suggests:

In the rare case, that an equation is very important and not references within the text, but some other person wants to reference to that equation, you can use \begin{equation+} and \end{equation+}. The equation is then numbered in all cases (having a label or not, being referenced or not).

Another possibility: Within align you can tell which line should not be numbered with \nonumber. If you want all equations to not be numbered just use align*, so instead of autonum you could use it like this:

\documentclass{article}
\usepackage{amsmath}%,cleveref,autonum}
\begin{document}

Both equations numbered:
\begin{subequations}
    \begin{align}
        \min_x \quad & f(x) \\
        s.t. \quad & g(x) \leq 0 \label{cst}
    \end{align}
\end{subequations}

Only last equation numbered:
\begin{subequations}
    \begin{align}
        \min_x \quad & f(x) \nonumber\\
        s.t. \quad & g(x) \leq 0 \label{cst}
    \end{align}
\end{subequations}
No numbering at all:
\begin{subequations}
    \begin{align*}
        \min_x \quad & f(x) \\
        s.t. \quad & g(x) \leq 0
    \end{align*}
\end{subequations}

\end{document}

enter image description here

1
  • Thanks for your answer. The {equation+} is indeed a solution for the degraded version, but require to adapt this by hand once I know which problem is cited. Hence I'm still looking for an automatic "all-or-nothing" approach. Commented Jul 13, 2018 at 10:28

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .