# Self adjusting vertical line in scalar product

I'm trying to define a new command for scalar product. So far, it looks like this:

\newcommand{\ilskal}[2]{\left(#1\left|#2\right)}


However, when I was trying to put something riddiculously high in one of the fields, the separator (|) remained the same height. I tried modifying the command:

\newcommand{\ilskal}[2]{\left(#1\left|\phantom{\right}#2\right)}


However, that doesn't work; by putting a matrix in one of the fields I get an error. Putting anything else produces an error as well. Why? I tried substituting | for other vertical lines, but it didn't help.

-

You can use \middle:

\documentclass[a4paper]{article}
\usepackage{amsmath}

\newcommand{\ilskal}[2]{\left(#1\,\middle\vert\,#2\right)}

\begin{document}

$\ilskal{\frac{2}{3}}{\frac{5}{7}}$

\end{document}


Here's the definition using the mathtools package:

\documentclass[a4paper]{article}
\usepackage{mathtools}

\DeclarePairedDelimiterX{\ilskal}[2]{(}{)}{#1\,\delimsize\vert\,#2}

\begin{document}

$\ilskal*{\frac{2}{3}}{\frac{5}{7}}$

\end{document}

-
Thanks! It worked perfectly! –  user19502 Jan 13 '13 at 2:19
@user19502: Please then accept this answer by clicking the tick mark just below the voting arrows. This will show others the answer which helped you the most (if there are multiple answers), give the answerer additional reputation and marks the question concluded. –  Martin Scharrer Jul 1 '13 at 20:47