6

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.

5

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}

enter image description here

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}
1
  • @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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.