# Curly braces with subscript and superscript

I'm looking for a way to write something like this:

\lbrace A_i\rbrace _{i = 1}^{n}


My goal is to put a subscript and a superscript near the right curly brace. How can I do it? The subscript and the superscript should be below and above the ends of the right curly brace.

• You could use some sort of \strut. \lbrace A_i\rbrace \rule[-1.5ex]{0pt}{4ex}_{i = 1}^{n} Sep 11 '21 at 15:13

The subscript and the superscript should be below and [above] the ends of the right curly brace.

Something like this?

\documentclass{article}
\usepackage{amsmath} % for "\overunderset" macro
\begin{document}
$\overunderset{n}{i=1}{\rbrace} \quad \overunderset{n}{i=1}{\big\rbrace} \quad \overunderset{n}{i=1}{\Big\rbrace} \quad \overunderset{n}{i=1}{\bigg\rbrace}\quad \overunderset{n}{i=1}{\Bigg\rbrace}$
\end{document}

• Hi @Mico thank you very much for your great answer. Sep 11 '21 at 22:35

Using another approach with \mathop,

\documentclass[a4paper,12pt]{article}
\usepackage{amsmath}
\begin{document}
$\mathop{\}}\limits_{i=1}^{n}$,
$\mathop{\bigr\}}\limits_{i=1}^{n}$,
$\mathop{\biggr\}}\limits_{i=1}^{n}$,
$\mathop{\Bigr\}}\limits_{i=1}^{n}$,
$\mathop{\Biggr\}}\limits_{i=1}^{n}$
\end{document}


• Hello @Sebastiano I appreciate your contributiom. Sep 11 '21 at 22:37

One needs to declare the object as a closing delimiter.

\documentclass{article}
\usepackage{amsmath}

\NewDocumentCommand{\rbracex}{O{}e{^_}}{%
\mathclose{%
\IfNoValueTF{#2}{% #2 is the possible superscript
\underset{#2}{#1\rbrace}%
}{%
\IfNoValueTF{#3}{% #3 is the possible subscript
\overset{#2}{#1\rbrace}%
}{%
\overunderset{#2}{#3}{#1\rbrace}%
}%
}%
}% matching \mathclose
}

\begin{document}

$\lbrace A\rbracex_{i=1}^n \quad \big\lbrace A\rbracex[\big]_{i=1}^n \quad \Big\lbrace A\rbracex[\Big]_{i=1}^n$

\end{document}


I'd avoid this notation with great care.

A possible improvement, prompted by comments by barbara beeton:

\documentclass{article}
\usepackage{amsmath}

\NewDocumentCommand{\rbracex}{O{}e{^_}}{%
\mathclose{%
% let's compute the amount of backing up
\sbox0{\mathsurround=0pt$#1\rbrace$}%
\sbox2{\mathsurround=0pt
$\IfNoValueTF{#2}{% #2 is the possible superscript \underset{#2}{#1\rbrace}% }{% \IfNoValueTF{#3}{% #3 is the possible subscript \overset{#2}{#1\rbrace}% }{% \overunderset{#2}{#3}{#1\rbrace}% }% }$%
}% end of \sbox2
\ifdim\wd0>\wd2
% do nothing
\else
\kern\dimexpr(\wd0-\wd2)/2\relax
\fi
\usebox{2}%
}% matching \mathclose
}

\begin{document}

$\lbrace A_i\rbracex_{i=1}^n \quad \big\lbrace A_i\rbracex[\big]_{i=1}^n \quad \Big\lbrace A_i\rbracex[\Big]_{i=1}^n$

\end{document}


Well, not really an improvement, I'm afraid.

• The width of the "lower limit" makes what's inside the braces look off center (which, of course, it is), and the shape of the A makes that look even worse. I'm not qualified to say whether there's a compelling mathematical reason for this, but I can't believe that closing up that space to match the space on the left would change the meaning. (Maybe just ignore the width of the lower limit.) Sep 11 '21 at 21:51
• @barbarabeeton It's maybe possible to measure the objects and back up; but what if the thing inside is A_n? Clash would be unavoidable. Anyway, I can't see any compelling reason and actually see a few reasons for not going along with this. The main reason being that the sub/superscripts don't belong to the brace, but to the whole {...} thing. Perhaps I'm influenced by not being a fan of \{a_n\}_{i=1}^n to begin with. Sep 11 '21 at 21:53
• @barbarabeeton See this picture Sep 11 '21 at 21:59
• With the subscript, that looks much more balanced. But the space on the right looks smaller, and I think it's not entirely the fact that something has been added. If I measured the spaces at the baseline, I think the right-hand space after the subscript is a bit narrower than the space with no subscript. Is it all my imagination, or did you make an adjustment? Sep 12 '21 at 0:43
• @barbarabeeton It was just a cheap experiment, with the backing up measured “by sight”, to show that the output is not really that nice. Sep 12 '21 at 8:40