# How to get uneven size/space of numerator and denominator in fraction enclosed by \left\{ and \right} brackets

The following code gives a large amount of space under the denominator, enclosed by the left and right brackets, \left{ and \right}:

U_{ij}^{\mathrm{tor}}(\mathbf{\hat{r}}_{ij},\mathbf{\Omega}_i,\mathbf{\Omega}_j) =
\exp \left\{ - \frac {\left[ \underset{\phi^{\mathrm{offset}}_{\alpha\beta}}{\min} \left( \phi_{\alpha\beta}-\phi^{\mathrm{offset}}_{\alpha\beta} \right) \right] ^{2}} {2\sigma_{\mathrm{tor}}^{2}} \right\} I do not want this space. I do not mind if the denominator is smaller than the numerator. How can I achieve this? (It would be nice if the fraction bar was in line with the equals sign, but I do not really mind.)

(I have tried manually sizing the brackets, but can't get any big enough.)

• (1) welcome , (2) Fences are always symmetric around the center math axis (approx the vertical middle of =). Note that since your are using {} as your fences, there is no reason to scale them this big, even in smaller sizes it is clear what the {} fence in. (3) I would how ever rewrite this and pull the fraction out front, then the problem disappears. Jan 30, 2019 at 11:29

Here is a possible way to accomplish what you want. It is a little involved, but it seems to generally work well as long as the wrapped expression has at least a certain height/depth. It may however require some more testing and can probably be made more efficient.

I'm defining \unevenbrace and \unevenbrack below. Both take one argument and wrap it in unbalanced braces or brackets respectively, as requested. Note that everything scales properly when these macros are used in sub-/superscripts.

\documentclass{article}

\usepackage{amsmath}
\usepackage{trimclip} %% <- for \clipbox

\makeatletter %% <- make @ usable in command names
\newcommand*\unevendelim{{\mathpalette\unevendelim@{{#1}{#2}{#3}}}}
\def\unevendelim@#1#2{\unevendelim@@{#1}#2}%
\def\unevendelim@@#1#2#3#4{%
\sbox0{$\m@th#1#4$}%
\sbox6{$\m@th#1\{\}$}%
\unevendelim@@@{#1}{\left#2}{\right.}%
\copy0
\unevendelim@@@{#1}{\left.}{\right#3}%
}
\def\unevendelim@@@#1#2#3{%
\sbox2{$\m@th#1#2\rule{0pt}{\ht0}#3$}%
\sbox4{$\m@th#1#2\rule[-\dp0]{0pt}{\dp0}#3$}%
\ifdim\ht2>\ht4
\ooalign{\clipbox{0pt {\dimexpr\dp2-\dp6\relax} 0pt 0pt}{\copy2}\cr
\raisebox{-\dp6}{\clipbox{0pt 0pt 0pt {\dimexpr2\ht2-\ht4+\dp6}}{\copy2}}\cr}
\else
\ooalign{\raisebox{\ht6}{\clipbox{0pt {\dimexpr2\dp4-\dp2+\ht6} 0pt 0pt}{\copy4}}\cr
\clipbox{0pt 0pt 0pt {\dimexpr\ht4-\ht6}}{\copy4}\cr}
\fi
}
\makeatother  %% <- revert @

% \newcommand*\unevenparen{\unevendelim()}   %% <- looks AWFUL
\newcommand*\unevenbrace{\unevendelim\{\}}
\newcommand*\unevenbrack{\unevendelim[]}

\begin{document}

$U_{ij}^{\mathrm{tor}}(\hat{\mathbf{r}}_{ij},\mathbf{\Omega}_i,\mathbf{\Omega}_j) = \exp\unevenbrace{ - \frac{ \unevenbrack{ \min\limits_{\phi^{\mathrm{offset}}_{\alpha\beta}} (\phi_{\alpha\beta}-\phi^{\mathrm{offset}}_{\alpha\beta} ) }^{2} }{2\sigma_{\mathrm{tor}}^{2}} }$
$U_{ij}^{\mathrm{tor}}(\hat{\mathbf{r}}_{ij},\mathbf{\Omega}_i,\mathbf{\Omega}_j) = \exp\unevenbrace{ - \frac{2\sigma_{\mathrm{tor}}^{2} }{ \unevenbrack{ \min\limits^{\phi^{\mathrm{offset}}_{\alpha\beta}} (\phi_{\alpha\beta}-\phi^{\mathrm{offset}}_{\alpha\beta} ) }^{2} } }$
$e^{e^{\exp\unevenbrace{ - \frac{ \unevenbrack{ \min\limits_{\phi^{\mathrm{offset}}_{\alpha\beta}} (\phi_{\alpha\beta}-\phi^{\mathrm{offset}}_{\alpha\beta} ) }^{2} }{2\sigma_{\mathrm{tor}}^{2}} } }}$

\end{document} These commands work by stitching together different parts of the braces/brackets produced with \left and \right using \clipbox. It doesn't work for parentheses because these don't have a straight part where this suture can be applied unnoticed.

## Really quick explanation

Here's what happens, step by step:

1. \mathpalette is used to get the math style (display/text/script/scriptscript) right.
2. <expr> is typeset in the right style in box register 0;
3. \{\} is similarly typeset in box register 6, just so we can determine its height/depth (which feels a little gratuitous).
4. \left\{<something as tall as <expr>>\right. is typeset in box 2.
5. \left.<something as deep as <expr>>\right\} is typeset in box 4.
6. If box 2 is taller, then its top half should be drawn, along with however much is needed from the bottom to reach the depth of box 4. The "top half" is defined as everything above the depth of box 6.
7. If box 4 is taller, then its bottom half should be drawn, along with however much is needed from the top to reach the height of box 2. The "bottom half" is defined as everything below the height of box 6.
8. \clipbox is used to cut up box 2 and box 4. This command is defined by the trimclip package, which is part of adjustbox.
9. \raisebox is used to get the vertical positioning right.
10. \ooalign is used to splice these cuttings together.
11. The contents of box 0 (which was <expr>) is printed.
12. Steps 4–10 are repeated for the right brace.
• Beware that there are some limitations though: this won't work for a pair of braces that should have the normal size on one end. Feb 3, 2019 at 9:03

A main cause for the growth of the size is the subscript to \min.

I propose two variations and one more proposed by daleif in comments:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

Definitely ugly
$U_{ij}^{\mathrm{tor}}(\hat{\mathbf{r}}_{ij},\mathbf{\Omega}_i,\mathbf{\Omega}_j) = \exp \left\{ - \frac{\left[ \min\limits_{\phi^{\mathrm{offset}}_{\alpha\beta}} \left( \phi_{\alpha\beta}-\phi^{\mathrm{offset}}_{\alpha\beta} \right) \right] ^{2} }{2\sigma_{\mathrm{tor}}^{2}} \right\}$

Possibly better
$U_{ij}^{\mathrm{tor}}(\hat{\mathbf{r}}_{ij},\mathbf{\Omega}_i,\mathbf{\Omega}_j) = \exp \Biggl\{ - \frac{\Bigl[\, \min_{\phi^{\mathrm{offset}}_{\alpha\beta}} (\phi_{\alpha\beta}-\phi^{\mathrm{offset}}_{\alpha\beta}) \Bigr] ^{2} }{2\sigma_{\mathrm{tor}}^{2}} \Biggl\}$

Good?
$U_{ij}^{\mathrm{tor}}(\hat{\mathbf{r}}_{ij},\mathbf{\Omega}_i,\mathbf{\Omega}_j) = \exp \biggl\{ - \biggl[ \min\limits_{\phi^{\mathrm{offset}}_{\alpha\beta}} (\phi_{\alpha\beta}-\phi^{\mathrm{offset}}_{\alpha\beta}) \biggr] ^{2} \bigg/ (2\sigma_{\mathrm{tor}}^{2}) \biggl\}$

Daleif proposal
$U_{ij}^{\mathrm{tor}}(\hat{\mathbf{r}}_{ij},\mathbf{\Omega}_i,\mathbf{\Omega}_j) = \exp \biggl\{ - \frac{1}{2\sigma_{\mathrm{tor}}^{2}} \biggl[ \min\limits_{\phi^{\mathrm{offset}}_{\alpha\beta}} (\phi_{\alpha\beta}-\phi^{\mathrm{offset}}_{\alpha\beta}) \biggr] ^{2} \biggl\}$

\end{document} • why not just -\frac{1}{2\sigma^2_{\mathrm{tor}}}\Bigl[...? Jan 30, 2019 at 12:32
• @daleif Another possibility, right. Jan 30, 2019 at 13:47
• @egreg Thanks, I would have been fine with one of these simpler alternatives Feb 2, 2019 at 16:12
• @CampanIgnis The “possibly better” method allows for the minus sign to be in either part, but it's a bit unnatural. If the minus sign is in front of the fraction brackets are necessary. Apr 22, 2019 at 16:03