# How to split a long equation in Latex?

I have a pretty long equation with me. I want to split the equation when using Texmaker. Can some one find me a proper way to do this? Thanks in advance.

$$\mathcal{H}=\sum_{\vec{k}}\left(\epsilon_{s}C^{\dagger}_{\vec{k}s}C_{\vec{k}s}+\epsilon_{p} C^{\dagger}_{\vec{k}p}C_{\vec{k}p}\right)-\sum_{\vec{k}}\left(\left[2\,t_{ss}\left(\cos k_{x}+\cosk_{y}\right)\right]C^{\dagger}_{\vec{k}s}C_{\vec{k}s}+\left[\sqrt{2}t_{sp}\left(\ sin k_{x}-i\,\sin k_{y}\right)\right]C^{\dagger}_{\vec{k}s}C_{\vec{k}p}+ \left[\sqrt{2}t_{sp}\left(\sin k_{x}+i\,\sin k_{y}\right)\right]C^{\dagger}_{\vec{k}p}C_{\vec{k}s}-\left[2\,t_{pp}\left(\cos k_{x}+\cos k_{y}\right)\right]C^{\dagger}_{\vec{k}p}C_{\vec{k}}\right)$$


## migrated from stackoverflow.comNov 19 '14 at 7:05

This question came from our site for professional and enthusiast programmers.

• Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. – Werner Dec 17 '14 at 19:02

You could use a split environment inside the equation environment. Choose the line breaks at natural-looking points. Vertical alignment points are indicated by the & symbol. The second row is shifted to the right by \quad, and rows 3 through 5 are shifted to the right by \qquad\qquad.
Note that you can't use \left( and \right) across line breaks; use explicit sizing instructions instead. To assure that the four pairs of square brackets have the same size, I would again use explicit sizing instructions.
\documentclass{article}
$$\begin{split} \mathcal{H} &=\phantom{-}\sum_{\vec{k}} \Bigl( \epsilon_{s}C^{\dagger}_{\vec{k}s}C_{\vec{k}s}+\epsilon_{p} C^{\dagger}_{\vec{k}p}C_{\vec{k}p}\Bigr)\\ &\quad-\smash[b]{\sum_{\vec{k}}} \Bigl(\bigl[2\,t_{ss}(\cos k_{x}+\cos k_{y})\bigr]C^{\dagger}_{\vec{k}s}C_{\vec{k}s}\\ &\qquad\qquad+\bigl[\sqrt{2}t_{sp}(\sin k_{x}-i\,\sin k_{y})\bigr]C^{\dagger}_{\vec{k}s}C_{\vec{k}p}\\ &\qquad\qquad+ \bigl[\sqrt{2}t_{sp}(\sin k_{x}+i\,\sin k_{y})\bigr]C^{\dagger}_{\vec{k}p}C_{\vec{k}s}\\ &\qquad\qquad-\bigl[2\,t_{pp}(\cos k_{x}+\cos k_{y})\bigr]C^{\dagger}_{\vec{k}p}C_{\vec{k}}\Bigr) \end{split}$$

• Maybe one could go as far as defining something like \def\C#1{C_{\vec k #1}^{\vphantom\dagger}} to have the subscripts line up. – morbusg Nov 19 '14 at 9:34
• @morbusg - Thanks for this suggestion. I noticed the differences in the subscript positions of the C terms as well. One reason why these differences are so noticeable is that the \dagger symbol is quite tall, forcing TeX to push down the subscript a lot more than if the symbol were a bit smaller. To mitigate this issue, it would be useful if the OP could change notation and use a smaller symbol, say *. Such a change would make the uncorrected differences in the depths of the subscripts less pronounced to begin with. – Mico Nov 19 '14 at 10:39