# How does one typeset stacked lines inside Dirac bra-ket: see image

How does one typset this?:

I am trying to use this code:

$\left\langle \begin{array}{ccc} electron \thickspace at \thickspace x \\ photon \thickspace at \thickspace D_1 \end{array} \right\vert$

• You can highlight code in your post using back-ticks. To highlight code-blocks, either indent them by four spaces or use the {} on the gui. – Andrew Nov 4 '16 at 1:35

this approach, while a bit verbose, takes advantage of the fact that the braket package spaces the result nicely.

\documentclass{article}
\usepackage{amsmath}
\usepackage{braket}
\begin{document}
$\Braket{ \begin{array}{r} \text{electron at x}\\ \text{photon at D_1} \end{array} | \begin{array}{l} \text{photon from s}\\ \text{photon from L} \end{array} } % end \Braket$
\end{document}


With minimal changes to your MWE, here is one possibility:

\documentclass{article}
\usepackage{amsmath}
\begin{document}

$\left\langle \begin{array}{@{}r|l@{}} \text{electron at x} & \text{photon from s}\\ \text{photon at D_1} & \text{photom from L} \end{array} \right\rangle$

\end{document}


which produces

I have used the \text{...} command from the amsmath package, which is for typesetting text in math-mode. In the array environment the @{} remove the default spacing before and after the environment because I think this looks better.

However, rather than using an array environment, as you have done, I would use a tabular environment because then you don't need to use \text{...}:

$\left\langle \begin{tabular}{@{}r|l@{}} electron at x & photon from s\\ photon at D_1 & photom from L \end{tabular} \right\rangle$
`