Sign up ×
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.

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.

share|improve this question
Better to use $|\psi\rangle$ for inlines and \left|\psi\right\rangle for stretchy kets. Avoid using >. – qubyte Mar 14 '12 at 16:32
I don't know about Lyx, but there's the braket package. – clemens Mar 14 '12 at 16:36

3 Answers 3

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

share|improve this answer

Here is a quicker way: Predefined vectors are offered by the LaTeX-package braket that is loaded with the LaTeX-preamble line:

When you open a new document, go to Documents > Settings > LaTeX-preamble. Then type into the field:


Now, go back to your new document and type:

\Bra{\psi}  <---a bra will show
\Ket {\psi}  <----a ket will show
\Braket{\psi|\psi}  <--- the inner product: <x|x>

Hope this helps.

share|improve this answer
Hello, welcome to! I mentioned the braket package in my answer as well (the last part). – Torbjørn T. Jan 8 '13 at 20:46

My personal preference is to define keyboard shortcuts for the three items.

  1. Go to Tools->Preferences->Editing->Shortcuts.
  2. For <|>, click "new", and add math-insert \left\langle | \right\rangle, with the key Alt+Q Shift+|.
  3. For |> click "new", and add math-insert \left| \right\rangle, with the key Alt+Q Shift+>.
  4. For <|, click "new", and add math-insert \left\langle \right|, with the key Alt+Q Shift+<.
  5. For <||> click "new", and add math-insert \left\langle \left| \right| \right\rangle, with the key Alt+Q =.

This way you don't need to use the GUI each time, not the braket package, and avoid having non-WYSIWYG items in your document.

share|improve this answer

Your Answer


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.