I would like to have the equation number on odd pages to the right and on even pages to the left. I found this How to put equation numbers on the left or the right, depending on whether the page is odd or even but it does not seem to work with the scrbook class. Any ideas on how to modify this?
Here is a MWE:
\documentclass[12pt,a4paper]{scrbook}
\usepackage{amsmath}
\linespread{1.5}
\makeatletter
\def\mathlabel#1{\@bsphack
\protected@write\@auxout{}%
{\string\newlabel{#1}{{\@currentlabel}{\thepage}}}%
\@esphack}
\def\eqnWrite{\@bsphack
\protected@write\@auxout{}%
{\string\EqnStat{\theequation}{\thepage}}%
\@esphack}%
\def\EqnStat#1#2{%
\expandafter\gdef\csname eqn@#1\endcsname{#2}%
}
\newcommand\@reqnnum{\hb@[email protected]\p@{}%
\rlap{\normalfont\normalcolor%
\hskip -\displaywidth(\theequation)}}
\def\equation{\let\mathlabel\label$$\refstepcounter{equation}}
\def\endequation{\eqno\eqnWrite\@ifundefined{eqn@\theequation}{\hbox{\@eqnnum}}%%
{\expandafter\ifodd\csname eqn@\theequation\endcsname\hbox{\@reqnnum}%
\else\hbox{\@eqnnum}\fi}$$\@ignoretrue}
\def\@@eqncr{\let\reserved@a\relax%
\ifcase\@eqcnt \def\reserved@a{& & &}\or \def\reserved@a{& &}%
\or \def\reserved@a{&}\else%
\let\reserved@a\@empty%
\@latex@error{Too many columns in eqnarray environment}\@ehc\fi%
\reserved@a \if@eqnsw\eqnWrite%
\@ifundefined{eqn@\theequation}{\@eqnnum}%
{\expandafter\ifodd\csname eqn@\theequation\endcsname\@reqnnum%
\else\@eqnnum\fi}\stepcounter{equation}\fi%
\global\@eqnswtrue\global\@eqcnt\z@\cr}
\makeatother
\begin{document}
\begin{equation}
y = ax + b
\end{equation}
\begin{equation}
a^n + b^n = c^n
\end{equation}
\end{document}
Replacing scrbook with report works fine.
\documentclass
and ends with\end{document}
so we don't have do build everything from scratch? Can you do that? Using a package likeblindtext
orlipsum
to build text around some equations. Also whether one should consider multi-linealign
s that may span the page boundary.