5

I want to set bra-ket equations in my document, which uses Asana Math (with lualatex, fontspec and unicode-math). commath is also a requirement for certain stuff. However, in this specific combination, angle brackets are not properly scaled with some modifiers like \big etc.

Consider this MWE

%!TEX program = lualatex

\documentclass{article}

\usepackage{amsmath}
% math typesetting (differentials etc.)
\usepackage{commath}

\usepackage{fontspec}
\usepackage[bold-style=ISO]{unicode-math}
\setmathfont{Asana Math}

\begin{document}
  \begin{equation}
    \bigl\langle x \big\vert H \big\vert y \bigr\rangle
  \end{equation}
\end{document}

which produces this result

Too large angle brackets

The angle brackets are much too large compared to the equally set \vert. Furthermore, going through all sizes from \big to \Bigg produces some matching and some non-matching variants.

What works to avoid the problem:

  • using other brackets
  • deactivating commath
  • switching from Asana Math to default math font

Unfortunately, neither is an option for me. \big is the smallest modifier and already too large. Skipping it produces too small angle brackets.

Is there any (decent) way, to get angle brackets between normal size and \big size with my package requirements?

6
  • Avoid using commath; it is very buggy. See tex.stackexchange.com/questions/135944/commath-and-ifinner
    – egreg
    Aug 13 '15 at 16:04
  • 1
    You didn't like \left\langle x \big\vert H \big\vert y \right\rangle?
    – 1010011010
    Aug 13 '15 at 16:04
  • 1
    Using \left and \right produces the identical (wrong) result for me. The detection obviously wants to use \big brackets there. Aug 13 '15 at 16:21
  • @egreg: Okay, from what you write there it sounds as if I should rather consider dropping commath, right? I originally wanted it for the \dif macro (need to check if I use anything else). Is there a good alternative package for that? Aug 13 '15 at 16:23
  • 1
    The \dif command is wrongly defined. You're better served by \newcommand{\dif}{\mathop{}\!d} (the package has \! on the wrong side).
    – egreg
    Aug 13 '15 at 16:24
2

When commath.sty is loaded \bigl produces a much bigger size than when it's not loaded. Doing \tracingall and comparing differences essentially just shows

< \hbox(8.35597+2.93596)x4.22 []}
---
> \hbox(12.92+7.5)x4.55 []}

which accounts for the different heights, but not for the cause.

Since commath is very buggy, I suggest you not to load it; see commath and \ifinner

If you just need its \dif command, define it in the right way and forget about the package, which defines it in a very wrong way, that can be seen by trying \dif(x+y):

\newcommand{\dif}{\mathop{}\!\mathrm{d}}

(I'd prefer an italic ‘d’, but it's an opinion).

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.