[Tex/LaTex] Lyx: Quick way to insert Dirac bra-ket

bracketslyx

In LyX, what is a quick way to insert mismatched delimiters in math environment?

I tried typing \left|\right>, but it is not interpreted automatically.

Best Answer

There are at least three different ways one can write such brackets, using ERTs or the LyX GUI.

1. Use \left/\right directly

To be able to write \left|\right\rangle, you have to use ERTs, which you add with Insert --> TeX code or Ctrl + L. Add an ERT for the \left|, exit the ERT, for example by hitting the right arrow key, write the term that should be within the delimiters, then finally add another ERT for \right\rangle.

2. Braket

The braket package mentioned by cgnieder defines eight new commands, \Bra, \Ket, \Braket and \Set which uses \left and \right to stretch the delimiters, and similar commands all lowercase (\bra,\ket,\braket,\set), which doesn't have stretchable delimiters. See below for how it looks in LyX and the corresponding output.

To use this in LyX you can do as follows:

  1. Add the package to the document preamble. Under Document --> Properties --> LaTeX preamble write \usepackage{braket}.

  2. When in mathmode, add an ERT with Ctrl + L. (This isn't actually necessary.)

  3. Write the command you want to use. The second curly brace will be autocompleted when you type the first (at least in my copy of LyX).

LyX View and PDF view of braket-package

3. GUI

The GUI-version is to click the Insert delimiters-button on the math toolbar and uncheck "Keep matched".

insert delimiters button and dialog in LyX

Related Question