I'm trying to typeset some large equations generated by Maxima. "align" requires manually managing \right. and \left. around each line break.
I find this time-consuming and error-prone (and I have a lot of these equations to typeset.)
The "breqn" package automates both line breaks and paren matching, but allows the equations to overlap the equation numbers and to extend beyond the right margin. Here's an MWE:
\documentclass{article}
\usepackage{breqn}
\begin{document}
\begin{dgroup}\label{eq:common}
\begin{dmath}
A_{21u} =
\left(\left(-
\sin {\it L_1}\,\sin {\it L_2}-\cos {\it L_1}\,\cos {\it L_2}\right)
\,\sin {\it a_{13}}\,\sin {\it a_{23}}\,\cos {\it l_1}\,\sin
{\it l_2}+\sin {\it a_{13}}\,\sin {\it a_{23}}\,\sin {\it l_1}\,
\cos {\it l_2}+\left(\cos {\it L_1}\,\sin {\it L_2}-\sin {\it L_1}\,
\cos {\it L_2}\right)\,\sin {\it a_{13}}\,\cos {\it a_{23}}\,\cos
{\it l_1}\right)\,\sin {\it r_{13}}+\left(\left(\cos {\it L_1}\,
\sin {\it L_2}-\sin {\it L_1}\,\cos {\it L_2}\right)\,\sin
{\it a_{23}}\,\sin {\it l_2}+\left(\sin {\it L_1}\,\sin {\it L_2}+
\cos {\it L_1}\,\cos {\it L_2}\right)\,\cos {\it a_{23}}\right)\,
\cos {\it r_{13}}
\end{dmath}
\begin{dmath}
A_{32n} =
\left(\left(\left(\left(\sin {\it L_1}\,
\sin {\it L_2}+\cos {\it L_1}\,\cos {\it L_2}\right)\,\cos
{\it a_{13}}\,\sin {\it l_1}+\left(\sin {\it L_1}\,\cos {\it L_2}-
\cos {\it L_1}\,\sin {\it L_2}\right)\,\sin {\it a_{13}}\right)\,
\sin {\it l_2}+\cos {\it a_{13}}\,\cos {\it l_1}\,\cos {\it l_2}
\right)\,\sin {\it r_{13}}+\left(\left(-\sin {\it L_1}\,\sin
{\it L_2}-\cos {\it L_1}\,\cos {\it L_2}\right)\,\cos {\it l_1}\,
\sin {\it l_2}+\sin {\it l_1}\,\cos {\it l_2}\right)\,\cos
{\it r_{13}}\right)\,\sin {\it r_{23}}+\left(\left(\cos {\it a_{13}}
\,\cos {\it a_{23}}\,\cos {\it l_1}\,\sin {\it l_2}+\left(\left(-
\sin {\it L_1}\,\sin {\it L_2}-\cos {\it L_1}\,\cos {\it L_2}\right)
\,\cos {\it a_{13}}\,\cos {\it a_{23}}\,\sin {\it l_1}+\left(\cos
{\it L_1}\,\sin {\it L_2}-\sin {\it L_1}\,\cos {\it L_2}\right)\,
\sin {\it a_{13}}\,\cos {\it a_{23}}\right)\,\cos {\it l_2}\right)\,
\sin {\it r_{13}}+\left(\cos {\it a_{23}}\,\sin {\it l_1}\,\sin
{\it l_2}+\left(\sin {\it L_1}\,\sin {\it L_2}+\cos {\it L_1}\,\cos
{\it L_2}\right)\,\cos {\it a_{23}}\,\cos {\it l_1}\,\cos {\it l_2}
\right)\,\cos {\it r_{13}}\right)\,\cos {\it r_{23}}
\end{dmath}
\end{dgroup}
\end{document}
(Sorry about the size, but handling large equations is kinda the point.)
Are there ways to clean up the breqn layout?
Is there another package that would choose better breakpoints, or at least handle the paren matching automatically while I choose breakpoints manually?
Emacs will jump to a corresponding paren. Is there a way to account for \left. and \right. in its calculations?
I'm using "pdfTeX, Version 3.14159265-2.6-1.40.18 (TeX Live 2017)" and "breqn bundle: 2017/01/27 0.98e" on a Mac.
\it
in a latex document, but why have you got these here, it means you are not using math italic anywhere?\left
and \right` as you don't need vertical stretching and you get better horizontal space if you do not use them. this would also make adding forced breask\\
for amsmath alignments much easier.