10

I am using stix fonts to type a formula containing bra-ket notations from quantum mechanics. I observe that the size of a vertical bar is either too small:

enter image description here \big\}\lvert\psi\rangle ,

or too large:

enter image description here \big\}\big\lvert\psi\big\rangle .

I would like to make the \lvertand the \rangle symbols be of the same height as \big\}. Is it possible to achieve this somehow? For a reference I posting the full source:

\documentclass[11pt,a4paper,onecolumn,openright,final]{memoir}
  %===============================================
  \settrims{0.cm}{0.cm}
  \setbinding{1cm} % space for binding
  \setlrmarginsandblock{*}{3cm}{1} % spine = edge. Edge=3cm
  \setulmarginsandblock{3cm}{*}{1} % upper=lower. Upper=3cm
  \checkandfixthelayout
  \pagestyle{empty}
  %===============================================
  \usepackage[]{stix,amsmath}
  %===============================================
  \begin{document}
  Compare different height of vertical bars here
  \begin{subequations}
  \begin{eqnarray}
  g(t-t')&=&-i\langle\psi\lvert T \bigl\{\hat c(t)\,\hat c^\dagger(t')\bigr\}\lvert\psi\rangle,\\
  g(t-t')&=&-i\langle\psi| T \bigl\{\hat c(t)\,\hat c^\dagger(t')\bigr\} |\psi\rangle;
  \end{eqnarray}
  \end{subequations}
  and  here
  \begin{subequations}
  \begin{eqnarray}
  g(t-t')&=&-i\bigl\langle\psi\bigr\rvert T \bigl\{\hat c(t)\,\hat c^\dagger(t')\bigr\}\bigl\lvert\psi\bigr\rangle,\\
  g(t-t')&=&-i\bigl\langle\psi\bigr| T \bigl\{\hat c(t)\,\hat c^\dagger(t')\bigr\}\bigl|\psi\bigr\rangle.
  \end{eqnarray}
  \end{subequations}
  and here $\big\}\big|\psi\big\rangle$.
\end{document}

and the full output:

enter image description here

Any help is much appreciated!

  • Please always post complete documents (as in the answers posted so far). Such problems are usually result of clashing package definitions and you have given no indication of which packages you are loading, in which order. – David Carlisle Feb 10 '15 at 15:10
  • @ David Carlisle Thank you for this comment. I uploaded the full source and corresponding output. Interestingly, your solution does not work here (see last line). – yarchik Feb 10 '15 at 15:33
  • 1
    Never ever use eqnarray. – egreg Feb 10 '15 at 15:41
  • 1
    Yes it's a clash with amsmath, you get the correct size with \usepackage[]{stix}\def\lvert{|}\def\rvert{|}\def\subequations{} I see @egreg has just posted with a workaround. – David Carlisle Feb 10 '15 at 15:47
9

It is a bug in the STIX fonts, I'm afraid.

All delimiters I tried scale perfectly with \big, \Big, \bigg, and \Bigg, whereas it doesn't happen with the vertical bar, for which \big| and \Big| produce the same size.

The \delcode of | with the STIX fonts is "3F03F3 and the characters in stix-mathex have metrics

(CHARACTER O 360
   (CHARWD R 0.32)
   (CHARHT R 0.69)
   (CHARDP R 0.189)
   )

(CHARACTER O 363
   (CHARWD R 0.32)
   (CHARHT R 0.55)
   (VARCHAR
      (REP O 363)
      )
   )

to be compared with the metrics in the Computer Modern fonts when the delcode is "26A30C; first the normal variant in cmsy10 that has

(CHARACTER O 152
   (CHARWD R 0.277779)
   (CHARHT R 0.75)
   (CHARDP R 0.25)
   )

and then the larger variant in cmex10

(CHARACTER O 14
   (CHARWD R 0.333334)
   (CHARDP R 0.600006)
   (VARCHAR
      (REP O 14)
      )
   )

As you can see, the depth is set, and not the height.

A workaround is to redefine \big in such a way that it adjusts the choice when | follows.

\documentclass{article}

\usepackage{stix,amsmath}

\makeatletter
\let\amstexbig\big
\def\newbig#1{%
  \ifx#1|%
    \expandafter\@firstoftwo
  \else
    \expandafter\@secondoftwo
  \fi
  {\big@bar}%
  {\amstexbig{#1}}%
}
\AtBeginDocument{\let\big\newbig}
\def\big@bar{\bBigg@{1.1}|}
\makeatother


\begin{document}

$\}|\rangle$

$\big\}\big|\psi\big\rangle$.

$|\big|\Big|\bigg|\Bigg|$

$\{\big\{\Big\{\bigg\{\Bigg\{$

$(\big(\Big(\bigg(\Bigg($

$[\big[\Big[\bigg[\Bigg[$

\end{document}

Making it work with \lvert and \rvert would be possible, but requires pure expansion, so many layers of \expandafter.

enter image description here

  • Thank you for your solution. Looks like a magic. I've read the linked question, but still didn't understand. Could you, please, explain your answer. My concern is what will happen with other parts of my document due to such declaration. – yarchik Feb 10 '15 at 15:47
  • @yarchik No, it doesn't really work; I'm working on it. – egreg Feb 10 '15 at 15:50
  • Thank you for your answer. It works for me, even for \lvert. At the beginning of your answer you showed font matrices. I have to admit I never look there. How common is for people to have this knowledge? I am using latex/xetex almost daily, I pay a lot of attention to typography. However in my evolution I have not reach this point: in particular, low level tex commands I can decipher only slowly. How to get more proficiency in this direction, should one attempt to understand each line in your answer or it is better just to use it as it is? – yarchik Feb 11 '15 at 9:47
  • @yarchik That's knowledge about the font metric files I acquired in several years' experience. Reading the appendices of the Metafontbook is necessary, I'm afraid. – egreg Feb 11 '15 at 10:02
1
\documentclass{article}

\usepackage{stix}
\showoutput
\begin{document}
$\big\}\big|\psi\big\rangle$

\end{document}

I got undefined command with \lvert using | the size seems correct to me:

enter image description here

  • @HarishKumar choice of font designer, but is not 10% too big as shown in question – David Carlisle Feb 10 '15 at 15:06
  • You need amsmath for \lvert. But recall that amsmath redefines \big. – egreg Feb 10 '15 at 16:48
  • @egreg I know, but I wanted the OP to show the order, yes I see from your answer that is the issue, although isn't clear what a general fix should be, the amsmath definition seems over sensitive to font changes. – David Carlisle Feb 10 '15 at 17:22
0

The braket package provides both small and expanding version of \bra{}, \ket{}, \braket{}, and \set{}. These should scale correctly (or at least uniformly).

\documentclass[11pt,a4paper]{memoir}
%===============================================
\usepackage[]{stix,amsmath}
\usepackage{braket}
\pagestyle{empty}
%===============================================
\begin{document}
\begin{align}
g(t-t')&=-i\langle\psi| T \bigl\{\hat c(t)\,\hat c^\dagger(t')\bigr\} |\psi\rangle\\
g(t-t')&=-i\Braket{\psi | T \Set{\hat c(t)\,\hat c^\dagger(t')} | \psi}
\end{align}
\end{document}

enter image description here

  • 1
    Not really better... – yarchik Feb 10 '15 at 16:20

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.