I have given a selfdefined command like
\newcommand{\AND}[2]{\left(#1 \vee #2 \right)}
which makes sure that I always give the correct number of parameters to my formula and which handles the parentheses as well. Now, when I use this command in a align
environment and the arguments become very long, then a linebreak becomes nessecary.
Here's the problem: In the align
environment I have to set linebreaks myself, however between \left
and \right
linebreaks aren't allowed.
So, is there any way to have a automatic linebreak here, which also keeps the correct size of the parentheses?
My only workaround so far is not to use the macro in these situations, which results in unclean code.
The breqn
package doesn't seem to fix this problem.
\documentclass[11pt, draft]{scrbook}
\usepackage{amsmath}
\usepackage{breqn}
\newcommand{\AND}[2]{\ensuremath{\left(#1\vee#2\right)}}
\begin{document}
\begin{align*}
aaa&= \AND{\sum^a_b \AND{\AND{\AND{\AND{\AND{\AND{\AND{\AND{\AND{\AND{a}{b}}{b}}{b}}{b}}{\AND{\AND{a}{\AND{a}{b}}}{\AND{a}{\AND{a}{b}}}}}{b}}{b}}{a}}{\AND{a}{\AND{\AND{a}{b}}{b}}}}{\frac{a}{\frac{a}{b}}}}{\sum^a_b \AND{c}{\frac{a}{\frac{a}{b}}}}\\
&= b
\end{align*}
\end{document}
EDIT: After fiddling around for a while, I came up with a small workaround that solves a part of the problem, but not all. I defined a new command which inserts a linebreak and handles the parenthesis for this linebreak:
\documentclass[11pt, draft]{scrbook}
\usepackage{amsmath}
\usepackage{mathtools}
\newcommand{\AND}[2]{\ensuremath{\left(#1\vee#2\right)}}
\newcommand{\ANDbr}[2]{\ensuremath{%
\begin{lgathered}[t]%
\left(#1 \vee \vphantom{#2} \right. \\
\left.\vphantom{#1\vee}#2\right)
\end{lgathered}%
}}
\begin{document}
\begin{align*}
aaa&= \ANDbr{\AND{\AND{\AND{a}{b}}{\AND{\frac{a}{b}}{c}}}{\AND{\AND{\sum_a^b a}{p}}{\AND{a}{b}}}}{\AND{\AND{\AND{a}{b}}{\AND{a}{b}}}{\AND{\AND{a}{b}}{\AND{a}{b}}}}\\
&= b
\end{align*}
\end{document}
This seems to work as long as I need only one linebreak. Inserting \ANDbr
for a second time messes things up however.
EDIT2:
I tried to add \allowbreak
into the definition of \AND
, but it didn't change anything.
align*
never breaks lines of its own initiative. Would you please make a more "real life" example?