If you want to get \middle| to behave exactly as \mid on all accounts (spacing, stacking in the form \mid\mid, etc.), you need to use \mathrel{} on both sides of \middle| (manual spaces like \; won't do the job correctly in all situations):
Here's a code that compares \mid and the new command \relmiddle on two different formulas and shows that the spacing is identical:
\documentclass{article}
\newcommand{\relmiddle}[1]{\mathrel{}\middle#1\mathrel{}}
\begin{document}
\nulldelimiterspace=0pt% to kill the little space before \left and after \right (not a good idea in a real document)
$a \mid -b$\par
$\left. a \relmiddle| -b \right.$
$a \mid\mid -b$\par
$\left. a \relmiddle|\relmiddle| -b \right.$
\end{document}
Best Answer
You can change the width and height of the rule as you wish.