How can I typeset this mathematical expression?
If it's a “one shot”, then
will be sufficient. If you have several inner products to typeset it is surely better to define a personal command for them; there are several possibilities. The simplest one is
to be called as
Defining a command is really recommended. If you change your mind and decide that inner products should be typeset like
you'd have to hunt through your document in order to find out the instances of
Now let's try our hand at a more complicated definition.
Now, suppose you change your mind and want the alternative notation. Here's how you can do it:
Just a modified definition of
Some note on the second version
We want to keep the very convenient input form
but still exploit the features in
we would be forced to change syntax into
we set up the delimiter interface of
To have a correct horizontal spacing and delimiters that adapt to the size of what's inside, you can use the
Then you'll have two versions for inner products:
In your case it should be used as
and simply write
You can try the physics package. It provides quite a lot of macros that are useful. The following code does what you want and in my opinion, it is quite simple :-)
Here \ev stands for expectation value.