0

I have a formula that is very long, while at the same time, there is a big parenthesis containing the whole formula, the formula is shown as follows:

\frac{1}{2}\left( \frac{1}{\sqrt{2}}\left( |01\rangle +|10\rangle \right) \frac{1}{\sqrt{2}}\left( |01\rangle +|10\rangle \right) -\frac{1}{\sqrt{2}}\left( |01\rangle -|10\rangle \right) \frac{1}{\sqrt{2}}\left( |01\rangle -|10\rangle \right) -\frac{1}{\sqrt{2}}\left( |00\rangle +|11\rangle \right) \frac{1}{\sqrt{2}}\left( |00\rangle +|11\rangle \right) +\frac{1}{\sqrt{2}}\left( |00\rangle -|11\rangle \right) \frac{1}{\sqrt{2}}\left( |00\rangle -|11\rangle \right) \right) 

I don't know how to split it into multi-lines. The double slash or split method seems useless because every time I tried to use that method, there's an error showing that cannot find \right).

narip
  • 109

1 Answers1

3

The easiest way to do this may be using breqn package. The use of {}s is to override the default behavior of breqn and force line break at some point. Be warned, however, that this package has many incompatibily issues.

\documentclass{article}
\usepackage{breqn}

\begin{document}

\begin{dmath} \frac{1}{2}\left( {\frac{1}{\sqrt{2}}\left( |01\rangle +|10\rangle \right) \frac{1}{\sqrt{2}}\left( |01\rangle +|10\rangle \right) -\frac{1}{\sqrt{2}}\left( |01\rangle -|10\rangle \right) \frac{1}{\sqrt{2}}\left( |01\rangle -|10\rangle \right)} -{\frac{1}{\sqrt{2}}\left( |00\rangle +|11\rangle \right) \frac{1}{\sqrt{2}}\left( |00\rangle +|11\rangle \right) +\frac{1}{\sqrt{2}}\left( |00\rangle -|11\rangle \right) \frac{1}{\sqrt{2}}\left( |00\rangle -|11\rangle \right)} \right) \end{dmath}

\end{document}

enter image description here

This still can be much improved by taking all these 1/sqrt(2) out of the parentheses.

\begin{dmath}
\frac{1}{2\sqrt2}\Bigl[( |01\rangle +|10\rangle) (|01\rangle +|10\rangle) -(|01\rangle -|10\rangle) (|01\rangle -|10\rangle) -(|00\rangle +|11\rangle) (|00\rangle +|11\rangle) +( |00\rangle -|11\rangle) (|00\rangle -|11\rangle) \Bigr] 
\end{dmath}

enter image description here

At this point, you can get rid of breqn and use much better alternatives, like multline, alligned, gathered, etc. Notice also the removal of all unnecessary \left .. \rights and the use of breakable brackets using \Bigl .. \Bigr.

\begin{multline}
\frac{1}{2\sqrt2}\Bigl[(|01\rangle +|10\rangle) ( |01\rangle +|10\rangle ) -( |01\rangle -|10\rangle) (|01\rangle -|10\rangle) \\ -( |00\rangle +|11\rangle) ( |00\rangle +|11\rangle) +( |00\rangle -|11\rangle) (|00\rangle -|11\rangle) \Bigr] 
\end{multline}

enter image description here

AboAmmar
  • 46,352
  • 4
  • 58
  • 127