# Match Vertical Bar With Height in Set Notation ★

## Background

I reviewed my old post on power means inequalities.

## Problem

At the 71st line of that post, I carelessly put a \| instead of |, causing it to be interpreted as rVert.

As the MathJax tutorial on Math Meta SE pointed out, the correct $\rm \LaTeX$ syntax for | in {} denoting a set should be \mid. However, the | in {} doesn’t match the fraction.

$$\max\left\{\frac{1}{a_i} \mid i = 1,\dots,k \right\}$$


gives

## Goal

I need to change it back to

## Attempt

Following a comment by asmeurer, I tried

$$\max\left\{\frac{1}{a_i} \middle| i = 1,\dots,k \right\}$$


which gives

The horizontal spacing around | isn’t correct.

$\max\left\{ \frac{1}{a_i} \,\middle|\, i = 1,\dots,k \right\} \quad \text{(right)} \\ \max\left\{\frac{1}{a_i} \middle| i = 1,\dots,k \right\} \quad \text{(wrong)}$

## Solution

See the external link of this post by clicking the title of this post.

## Lessons learnt

1. Avoid using \| as \lVert or \rVert.
2. Use \providecommand{\norm}[1]{\lVert#1\rVert} for denoting norms in $\rm \LaTeX$ documents. Similar commands can be used for absolute values and sets.
3. Avoid using fractions in superscripts and subscripts.