# Resize vertical bars (absolute-value symbols)

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

\usepackage{mleftright}
\usepackage{amsmath}

\begin{document}

$$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{document}


I believe you want the absolute value:

\documentclass{article}
\usepackage{amsmath}

\begin{document}

$$\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{document}


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.

• 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 at 15:48
• @manooooh I'd use two formulas: The function $f\colon\mathbb{R}\to\mathbb{R}$ defined by $f(x)=x+5$. – egreg Apr 20 at 15:49

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.

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

\begin{document}

$$\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{document}