I want to number equations in a closed bracket as seen in this figure.
I tried fer things but non of them work.
You can use aligned
to construct the inner equation alignment and numbering, surrounding it with \left\{
...\right\}
for the braces:
\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.
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}
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}
\stepcounter{equation}
before \ignorespacesafterend
, which I forgot to do.