Double vertical bar notation

This double bar should be treated as a binary relation, so it will be distinguishable from other usages, such as a norm.

The simplest way to cope with the problem is to use mathtools facilities:

\documentclass{article}
\usepackage{mathtools}

\DeclarePairedDelimiterX{\infdivx}[2]{(}{)}{%
  #1\;\delimsize\|\;#2%
}
\newcommand{\infdiv}{D\infdivx}
\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}


\begin{document}

\begin{gather}
D\left(P \middle\| Q\right) \rlap{\quad\itshape WRONG!} \\
% normal size
\infdiv{P}{Q} \\
% fixed size delimiters
\infdiv[\bigg]{\frac{\norm{P}}{2}}{Q} \\
% extensible delimiters
\infdiv*{\frac{\norm{P}}{2}}{Q}
\end{gather}

\end{document}

enter image description here

Note that number 1 is wrong in two respects: there is an unwanted space between the "D" and the left parenthesis; the two bars are too near the symbols, making for ambiguity.


In MathJax use $\lVert$ and $\rVert$. The capital v gives you double bars while the lower case v in $\lvert$ gives you single vertical bars. But it's not clear to me what to you is the "right" height.

Also, you have $\vert$ and $\Vert$.

Since you mention using a vertical bar as a binary relation, you may want $\mid$ which is kerned to sit midway between its neighbours. But that has no double-bar version so finally, you have the option of $\mathrel{\Vert}$ which is both double-bar and kerned to the centre.

Tags:

Math Mode