Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
add comment

1 Answer

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}
share|improve this answer
    
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
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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