1

I'm reading a textbook containing the following symbol

enter image description here

The \mid is well-lengthened. I tried \,\middle\vert\, but to no avail.

enter image description here

Could you elaborate on how to reproduce it?

\documentclass{article}
\usepackage{amsmath}
\begin{document}

[ \mathbf{E}\left{\left(\frac{\sum_{i=1}^n\left(Y_i-m\left(X_i\right)\right) I_{\left{X_i \in A_n(x)\right}}}{n \mu_n\left(A_n(x)\right)}\right)^2 ,\middle\vert, X_1, \ldots, X_n\right} ]

\end{document}

Analyst
  • 157
  • note that \mid is something completely different. Here the author manually scaled the vertical bar. so something like \Bigm\vert might be what you are after. (remember the are four levels of manual scaling: \big\Big\bigg\Bigg each has -l, -r and -m variants. For example scaling () ought ro be done using the l/r variants \bigl(...\bigr). The -m variant adds a bit of extra spacing. – daleif Dec 12 '22 at 10:31
  • Additionally note that your equation only needs two sets of \left...\right, the rest does not contribute anything other than making your code harder to read. – daleif Dec 12 '22 at 10:32
  • @daleif Ah it's a side effect of using Mathpix... – Analyst Dec 12 '22 at 10:34
  • 1
    These generators often give suboptimal results. – daleif Dec 12 '22 at 10:35
  • 2
    See also the \Set macro example in the mathtools manual. IMO the | in the image is a bit small. I would use a size that match the {}, chances are that the author did not know how to do that. – daleif Dec 12 '22 at 10:36
  • @daleif Thank you so much for your help! The command \Bigm\vert does exactly what I want. – Analyst Dec 12 '22 at 10:44

2 Answers2

1

In this case you can manually scale the | using \vert plus one of \bigm,...,\Biggm.

daleif
  • 54,450
1

I show three versions; one is the textbook's, one is with a similarly reduced height middle bar but with a couple of fixes. The last one is a different possibility (I guess that the textbook's typesetter didn't know about \middle).

In any case, you should avoid too many \left and \right. Compare your version with them and the picture from the textbook.

\documentclass{article}
\usepackage{amsmath}

\DeclareMathOperator{\Ex}{\mathbf{E}}% expectation

\begin{document}

The textbook version [ \Ex\left{ \biggl( \frac{\sum_{i=1}^n(Y_i-m(X_i)) I_{{X_i \in A_n(x)}}} {n \mu_n(A_n(x))} \biggr)^{2} ,\Big|, X_1, \ldots, X_n \right} ]

A better one [ \Ex\biggl{ \biggl( \frac{\sum_{i=1}^n(Y_i-m(X_i)) I_{{X_i \in A_n(x)}}} {n \mu_n(A_n(x))} \biggr)^{!2} \Bigm| X_1, \ldots, X_n \biggr} ]

Another possibility [ \Ex\left{ \biggl( \frac{\sum_{i=1}^n(Y_i-m(X_i)) I_{{X_i \in A_n(x)}}} {n \mu_n(A_n(x))} \biggr)^{!2} ;\middle|; X_1, \ldots, X_n \right} ]

\end{document}

enter image description here

Some points to notice. The exponent in the textbook seems to hang from nowhere; adding \! places it nearer the parenthesis. Also \, space around the bar is too small and \; instead adds the standard spacing around relation symbols.

egreg
  • 1,121,712