Tell me more ×
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

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 at 2:19

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.