3

I am trying to display a function of a fraction where I am using displaystyle in the numerator. Here is the markup:

\[
\text{Var}(\overline{x}) = \text{Var}\left(\frac{\displaystyle \sum_{i=1}^{n} X_{i}}{n}\right)
\]

Which displays like this, with the brackets way lower than the bottom of the fraction:

enter image description here

When I remove \displaystyle it looks fine but I want the limits of the sum to be above and below the sigma.

ajax2112
  • 159
  • fraction bars are on the math axis, and () are always vertically centred on the math axis so what you show is the expected result, you could have smaller raised () or have smaller () around a lowered fraction, which do you want ? (neither looks too good in practice) – David Carlisle Aug 17 '21 at 08:02
  • note you can use \limits to get limits above and below the smaller textstyle sum, you don't need displaystyle – David Carlisle Aug 17 '21 at 08:03
  • @DavidCarlisle I am after smaller brackets and a slightly lowered fraction. Any idea how to achieve this? – ajax2112 Aug 17 '21 at 08:06
  • 2
    Don't use \text for this, this is not what \text is made for. It is not "upright text" it follows the text font and thus you might even end up with an italic Var. BTW why not \left(\frac{1}[n}\sum...\right), this just seems a waste of space. – daleif Aug 17 '21 at 08:14

2 Answers2

7

Four ways. I could not think to a description for the first one.

\documentclass{article}
\usepackage{amsmath}

\DeclareMathOperator{\Var}{Var}

\begin{document}

\begin{align} \Var(\bar{x})&=\Var\left(\begin{matrix}\dfrac{\displaystyle\sum_{i=1}^{n} x_i}{n}\end{matrix}\right) \tag{---} \[2ex] \Var(\bar{x})&=\Var\left(\begin{matrix}\dfrac{\sum\limits_{i=1}^{n} x_i}{n}\end{matrix}\right) \tag{ugly} \[2ex] \Var(\bar{x})&=\Var\left(\frac{\sum_{i=1}^{n} x_i}{n}\right) \tag{bad} \[2ex] \Var(\bar{x})&=\Var\biggl(\frac{1}{n}\sum_{i=1}^{n} x_i\biggr) \tag{good} \end{align}

\end{document}

enter image description here

egreg
  • 1,121,712
  • 3
    +1 for the fourth option. In my opinion (I'm an econometrician...), it's the only good solution. :-) – Mico Aug 17 '21 at 08:28
  • 2
    A couple of suggestions for the first one: horrific, revolting, loathsome, sickening... :-) – campa Aug 17 '21 at 08:32
2

I propose one of these solutions, using pmatrix:

\documentclass{article}
\usepackage{mathtools}
\DeclareMathOperator{\Var}{Var}

\begin{document}

[ \Var(\overline{x}) = \Var\begin{pmatrix}\dfrac{\displaystyle ∑{i=1}ⁿ X{i}}{n}\end{pmatrix} ]

[ \Var(\overline{x}) = \Var\begin{pmatrix}\dfrac{\displaystyle \sum\nolimits_{i=1}ⁿ X_{i}}{n}\end{pmatrix} ]

\end{document}

enter image description here

Bernard
  • 271,350