4

I tried that \middle, \,\middle|\, and \mathrel{\Big|}. I read How to automatically scale `\mid` within delimiters and

\usepackage{mleftright}
\usepackage{amsmath}

\begin{document}

\begin{equation}
MASE = \frac{1}{n} \mathrel{\Big|} \sum_{i = 1}^{n} \hat{\Sigma}^{-1/2}\begin{pmatrix}
y_{ci} - \hat{y}_{ci}\\
y_{ri} - \hat{y}_{ri}
\end{pmatrix} \mathrel{\Big|},
\label{eq:mase}
\end{equation}

\end{document}
Mico
  • 506,678
Wagner Jorge
  • 646
  • 1
  • 6
  • 22

2 Answers2

8

I believe you want the absolute value:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

\begin{equation}
\mathit{MASE} = \frac{1}{n}
\left|
  \sum_{i = 1}^{n} \hat{\Sigma}^{-1/2}
  \begin{pmatrix}
    y_{ci} - \hat{y}_{ci}\\
    y_{ri} - \hat{y}_{ri}
  \end{pmatrix}
\right|,
\label{eq:mase}
\end{equation}

\end{document}

enter image description here

I've often seen \mid misused as vertical bar; it indeed typesets a vertical bar, but considered as a binary relation.

For the absolute value you should use \lvert and \rvert, which can be abbreviated as \left| and \right| when automatic sizing is desired.

egreg
  • 1,121,712
  • Great answer!! "\mid is considered as a binary relation" ok, for example $2\mid 5$, but would you include it on for example $f\colon \mathbb{R}\to\mathbb{R}\mid f(x)=x+5$? Or would you go for "such that" (text)? – manooooh Apr 20 '19 at 15:48
  • 3
    @manooooh I'd use two formulas: The function $f\colon\mathbb{R}\to\mathbb{R}$ defined by $f(x)=x+5$. – egreg Apr 20 '19 at 15:49
7

Here's a solution that employs the macro \DeclarePairedDelimiter (provided by the mathtools package) to generate absolute-value "fences" around the summation. I would use \abs[bigg] rather than \abs*, to keep the vertical bars from becoming needlessly large. I would also write \widehat{\Sigma} rather than \hat{\Sigma}, to make the "hat" symbol a bit easier to spot. And, do write either \mathrm{MASE} or \mathit{MASE}, to inform TeX that it's dealing with an entire word rather than a product of the variables named M, A, S, and E.

enter image description here

\documentclass{article}
\usepackage{mathtools}
\DeclarePairedDelimiter{\abs}{\lvert}{\rvert}

\begin{document}

\begin{equation}\label{eq:mase}
\mathrm{MASE} = \frac{1}{n} 
\abs[\bigg]{ \sum_{i = 1}^{n} \widehat{\Sigma}^{-1/2}
\begin{pmatrix}
  y_{ci} - \hat{y}_{ci}\\
  y_{ri} - \hat{y}_{ri}
\end{pmatrix} }
\end{equation}

\end{document}
Mico
  • 506,678