# Right curly brace near the equation number

I can easily put right curly brace after group of (sub)equations:

\documentclass{article}

\usepackage{amsmath}

\begin{document}

\setcounter{equation}{10}

$$\left. \begin{split} &g_{00}(x)=-1,\\ &g_{02}(x)=g_{20}(x)= 1\\ &g_{11}(x)= 2,\\ &g_{22}(x)= 3,\\ &g_{33}(x)= 4, \end{split} \right\}$$

\end{document}


Is there a (standard?) method of putting such brace near the equation number (near (11) in the picture)?

Edit: I have in mind a fixed distance from the equation number.

It isn't standard, but here I introduce \groupequation[<margin-offset>]{<content>}.

\documentclass{article}
\usepackage{amsmath,stackengine}
\newcommand\groupequation[2][17pt]{%
\setbox0=\hbox{$\displaystyle#2$}%
\stackengine{0pt}{\copy0}{%
\makebox[\linewidth]{\hfill$\left.\rule{0pt}{\ht0}\right\}$\kern#1}}
{O}{c}{F}{T}{L}
}
\begin{document}

\setcounter{equation}{10}

$$\groupequation{ \begin{split} &g_{00}(x)=-1,\\ &g_{02}(x)=g_{20}(x)= 1\\ &g_{11}(x)= 2,\\ &g_{22}(x)= 3,\\ &g_{33}(x)= 4, \end{split} }$$
\end{document}


With the above answer, the offset from the margin is a fixed distance, overridden with the optional argument. An alternative is to make it a fixed distance from the label itself:

\documentclass{article}
\usepackage{amsmath,stackengine}
\newcommand\groupequation[1]{%
\setbox0=\hbox{$\displaystyle#1$}%
\setbox2=\hbox{\,(\theequation)}%
\stackengine{0pt}{\copy0}{%
\makebox[\linewidth]{\hfill$\left.\rule{0pt}{\ht0}\right\}$\kern\wd2}}
{O}{c}{F}{T}{L}
}
\begin{document}

$$\groupequation{ \begin{split} &g_{00}(x)=-1,\\ &g_{02}(x)=g_{20}(x)= 1\\ &g_{11}(x)= 2,\\ &g_{22}(x)= 3,\\ &g_{33}(x)= 4, \end{split} }$$

\setcounter{equation}{10}

$$\groupequation{ \begin{split} &g_{00}(x)=-1,\\ &g_{02}(x)=g_{20}(x)= 1\\ &g_{11}(x)= 2,\\ &g_{22}(x)= 3,\\ &g_{33}(x)= 4, \end{split} }$$
\end{document}


• Stackengine to the rescue, once again! ;-) – JPi Sep 2 '16 at 10:18
• @JPi When the only tool in your toolbox is a hammer, every problem starts looking like a nail. – Steven B. Segletes Sep 2 '16 at 10:26
• But a powerful hammer, it is. – JPi Sep 2 '16 at 10:45

Use aligned rather than split, so more groups can be accommodated.

Then absorb the environment's contents and typeset it in a box, which can be done with environ; then use the box for both printing the equations and for measuring the brace, which can be printed using \tag*, by self-assigning a label; another label can be added for references.

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

\newsavebox{\bracedeqsbox}
\NewEnviron{bracedeqs}
{%
\refstepcounter{equation}\label{bracedeqs\theequation}%
\begin{lrbox}{\bracedeqsbox}
\begin{aligned} \BODY \end{aligned}
\end{lrbox}%
$$\usebox{\bracedeqsbox} \tag*{% \kern-\nulldelimiterspace \left.\mbox{\vphantom{\usebox{\bracedeqsbox}}}\right\rbrace (\ref{bracedeqs\theequation})% }%$$
}

\begin{document}

\setcounter{equation}{10}

The following group of equations has number \eqref{foo}:
\begin{bracedeqs}\label{foo}
&g_{00}(x)=-1,\\
&g_{02}(x)=g_{20}(x)=1\\
&g_{11}(x)=2,\\
&g_{22}(x)=3,\\
&g_{33}(x)=4,
\end{bracedeqs}
Here's another numbered equation:
$$a+b=0$$
and another \texttt{bracedeqs} environment, with number \eqref{foo2}:
\begin{bracedeqs}\label{foo2}
&g_{00}(x)=-1, & &g_{02}(x)=1,\\
&g_{20}(x)=1,  & &g_{11}(x)=2,\\
&g_{22}(x)=3,  & &g_{33}(x)=4,
\end{bracedeqs}

\end{document}


Ensuring the equations are not too wide is your responsibility; if they are, the result won't be pretty. ;-)

Having an environment will make it easy to change your mind when you'll realize that it's better if the brace is next to the equations. ;-)

If you want the brace to be a consistent distance from the equation you could use something like \hskip 0.1\textwidth before \right\}. Distance from the equation number will be variable.