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 \marginnote
s? 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}