3

For creating braket notation within my formulas, I tried using the following two approaches:

Although, when using the math font "Asana Math" and XeTeX, the following happens to larger braket formulas:

enter image description here

As you can see, the vertical lines are abnormally thick. Is there a way to prevent that from happening?

MWE:

\documentclass[a4paper]{scrartcl}
\usepackage[ngerman]{babel}

\usepackage{fontspec} \usepackage{unicode-math} \setmathfont[Style=Alternate]{Asana Math}

\usepackage{mathtools} \DeclarePairedDelimiter\bra{\langle}{\rvert} \DeclarePairedDelimiter\ket{\lvert}{\rangle} \DeclarePairedDelimiterX\braket[2]{\langle}{\rangle}{#1 \delimsize\vert #2} \DeclarePairedDelimiterX\braketdouble[3]{\langle}{\rangle}{#1 \delimsize\lvert #2 \delimsize\rvert #3}

\begin{document} \begin{align} \braketdouble{\psi }{ {\sum_i{\ket{i}\bra{i}}} }{ \psi} \end{align*} \end{document}

TiMauzi
  • 841
  • 1
    Not only are they too thick, they're also too tall. It looks like a smaller vert has been scaled uniformly instead of using a glyph directly from a font or scaling only vertically. I don't know anything about \delimsize, but I'd look at that as the culprit. – barbara beeton May 30 '21 at 19:45
  • 1
    @barbarabeeton actually you get the same with a simple \left| ...\right| the extension pieces for a vertical bar are just a lot wider than the stadard size bar, whether by design or by error I am not sure, – David Carlisle May 30 '21 at 20:14
  • @DavidCarlisle Right, that's why I wrote that I tried it with different approaches (that both seem to have the same effect). – TiMauzi May 30 '21 at 20:34

2 Answers2

5

You can borrow \vert from another font.

\documentclass[a4paper]{scrartcl}
\usepackage[ngerman]{babel}

\usepackage{fontspec} \usepackage{unicode-math} \setmathfont[Style=Alternate]{Asana Math} \setmathfont[range=\vert]{STIX Two Math} \setmathfont[range=]{Asana Math}

\usepackage{mathtools}

\DeclarePairedDelimiter\bra{\langle}{\rvert} \DeclarePairedDelimiter\ket{\lvert}{\rangle} \DeclarePairedDelimiterX\braket[2]{\langle}{\rangle}{#1 ,\delimsize\vert, #2} \DeclarePairedDelimiterX\braketdouble[3]{\langle}{\rangle}{% #1 ,\delimsize\vert, #2 ,\delimsize\vert, #3% }

\begin{document}

\begin{equation} \braketdouble[\bigg]{\psi }{ {\sum_i{\ket{i}\bra{i}}} }{ \psi} \end{equation}

\end{document}

enter image description here

I wouldn't use * in this case, that makes too big fences.

egreg
  • 1,121,712
  • hmm probably better, especially if you need to do the same with any other characters where a rule can't be used as an easy alternative – David Carlisle May 30 '21 at 20:32
  • Why do you have to put \setmathfont[range=]{Asana Math} again? – TiMauzi May 30 '21 at 20:47
  • @TiMauzi it's a "feature" of unicode-math range feature that it's more reliable if you specify the main font in the final range – David Carlisle May 30 '21 at 20:50
  • Okay, this approach worked perfectly! I just added \Vert to the respective range, so the style of both double and single vertical lines are the same: \setmathfont[range={\vert,\Vert}]{STIX Two Math}. – TiMauzi May 30 '21 at 21:13
  • 1
    @TiMauzi It makes sense indeed! – egreg May 30 '21 at 21:33
4

The font just has very wide | extension parts specified, but you could use a rule instead

enter image description here

\documentclass[a4paper]{scrartcl}
\usepackage[ngerman]{babel}

\usepackage{mathtools} \usepackage{fontspec} \usepackage{unicode-math} \setmathfont[Style=Alternate]{Asana Math}

\DeclarePairedDelimiter\bra{\langle}{\rvert} \DeclarePairedDelimiter\ket{\lvert}{\rangle} \DeclarePairedDelimiterX\braket[2]{\langle}{\rangle}{#1 \delimsize\vert #2} \DeclarePairedDelimiterX\braketdouble[3]{\langle}{\rangle}{#1 \delimsize\lvert #2 \delimsize\rvert #3}

\begin{document}

[ \braketdouble*{\psi }{ {\sum_i{\ket{i}\bra{i}}} }{ \psi} ] [ \Uleft<\psi\vline width .9pt \sum_i \lvert i\rangle\langle i\rvert \vline width .9pt \psi\Uright> ] \end{document}

David Carlisle
  • 757,742