Dafür gibt es ein Paket `mleftright`. Aus der Dokumentation
> The package is a result of a thread in the newsgroup `comp.text.tex` with the subject
*spacing after `\right)` and before `\left(`* [[1](http://groups.google.com/group/comp.text.tex/msg/e5b6833da7dc29bf)]. The problem: `\left` and `\right` adjust the size of the delimiters automatically. However, TeX treats the whole expression
as inner formula. In some circumstances TeX adds extra space before or after an inner formula.
\documentclass{article}
\usepackage{mleftright}
\mleftright
\newcommand*{\PunktA}[3][]{\ensuremath{#1({#2}\,|\,{#3})}}
\newcommand*{\PunktB}[3][]{\ensuremath{#1\left({#2}\,\middle|\,{#3}\right)}}
\begin{document}
\PunktA[W]{3}{5}
\PunktA[W]{3}{\frac{1}{2}}
\PunktB[W]{3}{5}
\PunktB[W]{3}{\frac{1}{2}}
\end{document}\end{document}
[![alt text][1]][1]
[1]: https://texwelt.de/wissen/upfiles/test_451.png