2

I want to number equations in a closed bracket as seen in this figure.

enter image description here

I tried fer things but non of them work.

2 Answers 2

3

You can use aligned to construct the inner equation alignment and numbering, surrounding it with \left\{...\right\} for the braces:

enter image description here

\documentclass{article}

\usepackage{amsmath}

\makeatletter
% \seteqnum[<optional label>]
\NewDocumentCommand{\seteqnum}{o}{%
  \IfValueTF{#1}
    {\textup{\tagform@{#1}}}% <label> supplied
    {\incr@eqnum \print@eqnum}% <label> not supplied
}
\NewCommandCopy{\ltxlabel}{\ltx@label}
\makeatother

\begin{document}

For example, see~\eqref{eq:last}:
\[
  \left\{
    \begin{aligned}
      a x^2 + b x + c &= d               & \seteqnum \\
              a x + b &= c x^2 + d       & \seteqnum[a] \\
                    a &= b x^2 + c x + d & \seteqnum \ltxlabel{eq:last}
    \end{aligned}
  \right\}
\]

\end{document}

You have to set the equation numbers manually via \seteqnum. The optional argument allows you to insert a numbering of your own. However, such numbering can't be referenced (without more coding). \ltxlabel can be used to label the numbered equations and are then referenceable via \eqref, if needed.

7
  • Thanks, when I try to reference the equations via \eqref it gives me an error in overleaf! Commented Sep 5 at 18:15
  • 1
    @NickCooper: How can I replicate your issue. Can you provide a setup (code) that I can test?
    – Werner
    Commented Sep 5 at 18:24
  • I get the error when I use the packege: \usepackage{hyperref}! Commented Sep 5 at 18:46
  • Without this package it works fine! Commented Sep 5 at 18:46
  • 1
    @NickCooper: When I add hyperref to my example (after amsmath), it compiles fine with a hyperlink. So, it's not possible to replicate your issue with just that information.
    – Werner
    Commented Sep 5 at 19:00
3

I don't think this is a good way to set down equations, but it's your choice.

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

\usepackage{lipsum} % for filler text

\NewDocumentEnvironment{alignednum}{b}{%
  \sbox0{$\begin{aligned}#1\end{aligned}$}%
  \begin{equation}
  \left\{\,
  \begin{minipage}{\dimeval{\wd0+3em}}
  \setlength{\abovedisplayskip}{0pt}%
  \addtocounter{equation}{-1}%
  \begin{fleqn}
  \noindent
  \begin{align}#1\end{align}
  \end{fleqn}
  \end{minipage}
  \,\right\}
  \notag\end{equation}%
}{\stepcounter{equation}\ignorespacesafterend}

\begin{document}

\lipsum[35][1-4]
\begin{alignednum}
a+b&=c \label{a}\\
d+e&=f \label{b}\\
g+h&=i \label{c}
\end{alignednum}
\lipsum[42][1-4]

\eqref{a}, \eqref{b}, \eqref{c}

\end{document}

output

How to do it in a more standard way? Compare the following settings.

\documentclass{article}
\usepackage{amsmath,nccmath}
\usepackage{empheq}

\usepackage{lipsum} % for filler text

\NewDocumentEnvironment{alignednum}{b}{%
  \sbox0{$\begin{aligned}#1\end{aligned}$}%
  \begin{equation}
  \left\{\,
  \begin{minipage}{\dimeval{\wd0+3em}}
  \setlength{\abovedisplayskip}{0pt}%
  \addtocounter{equation}{-1}%
  \begin{fleqn}
  \noindent
  \begin{align}#1\end{align}
  \end{fleqn}
  \end{minipage}
  \,\right\}
  \notag\end{equation}%
}{\stepcounter{equation}\ignorespacesafterend}

\begin{document}

\section{Your proposed way}

\lipsum[35][1-4]
\begin{alignednum}
a+b&=c \label{a}\\
d+e&=f \label{b}\\
g+h&=i \label{c}
\end{alignednum}
\lipsum[42][1-4]

\eqref{a}, \eqref{b}, \eqref{c}

\section{A more standard way}

\begin{subequations}\label{global}
\lipsum[57]{1-4}
\begin{empheq}[left=\empheqlbrace]{align}
a+b&=c \label{local-a}\\
d+e&=f \label{local-b}\\
g+h&=i \label{local-c}
\end{empheq}
\lipsum[58][1-2]
\end{subequations}

The system~\eqref{global} is very important; look, in particular, at equation~\eqref{local-b}.

\end{document}

output-full

5
  • Thanks, what do you mean by this is not a good way to set down equations! Commented Sep 5 at 18:16
  • @Nick Cooper: It's definitely a non-standard way to do this Commented 2 days ago
  • @NickCooper I've never seen it. Please, note that I added \stepcounter{equation} before \ignorespacesafterend, which I forgot to do.
    – egreg
    Commented 2 days ago
  • Thanks, I know that putting equations in closed bracket is not standard, but I need this to label some equations in a set of equations! Commented 2 days ago
  • 1
    @NickCooper I added an alternative form.
    – egreg
    Commented 2 days ago

You must log in to answer this question.

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