# Is there a package to equate particular parts of an equation?

Just wondering if there's a particular way to do the following in LaTeX: where I've equated a particular part of the main equation to a little equation, given by T and U.

• Welcome! amsmath provides \underbrace, with usage \underbrace{a^2+b^2+c^2}_{=T}. May 8, 2015 at 13:03
• Related: vertical equal sign May 8, 2015 at 13:05
• Schrödinger's equation ;-) .. The ^ above the potential operator is out of alignment. It should be over U only
– user31729
May 8, 2015 at 13:06
• @1010011010, thank you, that is exactly what I was looking for! You should post that as an answer. May 8, 2015 at 13:13
• @HarrySmith: For the typesetting of the kets you might have a look on the braket package
– user31729
May 8, 2015 at 13:15

This should get you going. I've introduced a few commands to make it easier to typeset some parts of the equations in a more automated way, or if you wish to change something all over the document at once. *They're not strictly necessary for the obtained result. \documentclass{article}
\usepackage{amsmath,mathtools}
\newcommand\partt[]{%
\ifmmode
\frac{\partial#1\mathstrut}{\partial t}%
\fi
}
\newcommand\ChristianHupfer{%
\ifmmode
\lvert
#1%
\rangle
\fi
}
\newcommand\rotateequal{%
\ifmmode
\underset{#1}{\rotatebox{90}{$=$}}%
\fi
}
\newcommand\myvector{%
\ifmmode
\mathbf#1%
\fi
}
\newcommand\largemathstrut{%
\ifmmode
\frac{\mathstrut}{\mathstrut}
\fi
}
\begin{document}
$i\hbar\partt\ChristianHupfer{\psi(\myvector{r},t)} = \underbrace{\frac{-\hbar^{2}}{2m}\nabla^2\largemathstrut}_{\rotateequal{T}}\ChristianHupfer{\psi(\myvector{r},t)} + \underbrace{\hat{U(\myvector{r})}\largemathstrut}_{\rotateequal{U}}\ChristianHupfer{\psi(\myvector{r},t)}$
\end{document}

• \waveleft? ;-) That's a ket state vector
– user31729
May 8, 2015 at 13:26
• @ChristianHupfer Fixed. :-) May 8, 2015 at 13:31
• This is a very nice solution. It's a shame the standard \underbrace curly brace symbol is so ugly! May 8, 2015 at 13:45
• What's the purpose of \ifmmode in all those definitions? If you use those commands in a wrong place you'll get nothing, instead of a clear error message (Missing $inserted) May 8, 2015 at 15:11 Here, I provide \undereq{} to be used in the \underbrace subscript. \documentclass{article} \usepackage{amsmath,stackengine,graphicx} \stackMath \newcommand\undereq{% \stackunder[2pt]{\mkern1mu\rotatebox{90}% {$\scriptstyle=\mkern-3mu$}}{\mathstrut#1}% } \begin{document} $= \underbrace{\frac{-\hbar^2}{2m}\nabla^2}_{\undereq{T}}\lvert \psi(\mathbf{r},t)...$\end{document} • Although this provides the right formatting for equations, the main body text now overlaps my headers. Is there a way to fix this? May 8, 2015 at 13:29 • @HarrySmith I'm not sure I understand. When you say "headers," do you mean the stuff at the top of the page? If so, I don't see how this particular implementation could produce that effect. May 8, 2015 at 13:30 • I am writing using the book class, with the fancyhdr package. It results in this: 1drv.ms/1GToe1a. May 8, 2015 at 13:34 • @HarrySmith That web site is blocked to me, so I cannot see it. However, using book class, fancyhdr package, with a \pagestyle{fancy} and a \fancyhead{This is a test} does not produce any interference with the header using my MWE. May 8, 2015 at 13:40 • Hosting shared files on OneDrive is less-than-ideal, haha. This one may work: 1drv.ms/1H3EwqP. However, I tried this solution in a regular document and it worked very nicely -- and the curly brace looks nice, too. I may use this in future documents. Thank you! May 8, 2015 at 13:48 A possible better way to set your equation: \documentclass{article} \usepackage{amsmath,mathtools} \usepackage{braket,graphicx} \newcommand\pder[]{% \frac{\partial#1\mathstrut}{\partial #2}% } \newcommand\roteq{\mathpalette\doroteq\relax} \newcommand\doroteq{% \rotatebox[origin=c]{90}{$#1=\$}%
}

\renewcommand\vec{\mathbf{#1}}

\begin{document}

$\newcommand{\BF}{\vphantom{\frac{-\hbar^{2}}{2m}\nabla^2}} % just for this equation i\hbar\pder{t}\ket{\psi(\vec{r},t)} = \underbrace{\frac{-\hbar^{2}}{2m}\nabla^2}_{\substack{\roteq\\T}}\ket{\psi(\vec{r},t)} + \underbrace{\BF\widehat{U(\vec{r})}}_{\substack{\roteq\\U}}\ket{\psi(\vec{r},t)}$

\end{document} 