How can I automatically have equations in a \marginnote aligned flush left or right in a two-sided document?
A previous question suggested to make equations flush left by using flalign* and extra alignment characters. This can also be used to make the equations flush right as demonstrated below. The question: how to do this automatically for equations that appear in \marginnotes? The solution probably will use an if-then-else for even/odd pages, but how to cleanly incorporate this with the (fl)align* environment?
\documentclass[twoside]{scrartcl}
\usepackage{amsmath}
\usepackage{lipsum}
\usepackage{marginnote}
\begin{document}
\lipsum[1]
\marginnote{Is flush left (manually)
\begin{flalign*}
a&=1 &\\
b&=1 &
\end{flalign*}}
\lipsum[2]
\marginnote{How to make flush left automatically?
\begin{align*}
a&=1\\
b&=1
\end{align*}}
\lipsum[3-6]
\marginnote{Is flush right (manually):
\begin{flalign*}
&& a&=1\\
&& b&=1
\end{flalign*}}
\lipsum[7]
\marginnote{How to make flush right automatically?
\begin{align*}
a&=1\\
b&=1
\end{align*}}
\lipsum[8-9]
\end{document}


alignetc. but that will spoil the nice margin alignment anyway, and there is not really space for several aligned columns with most margin notes. I will play with it for a bit and then accept if it works as expected. Thanks! – mforbes Oct 05 '11 at 07:56Alignfor the column specification, then more columns are possible – Oct 05 '11 at 08:42\vspace{-...}, but that's quite a dirty hack. – Ingo Feb 13 '14 at 14:41