Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I'm looking for a two-sided extension to the solution for this question:

Put equation numbers in the sidemargin with Tufte-Latex class

This post seems relevant:

Equation tag in twoside-mode outer

I tried playing around with tagsleft@ without any luck. Here's an example.

\documentclass[openany,twoside]{memoir}
\usepackage{amsmath}
\usepackage[amsmath,standard]{ntheorem}
\usepackage{showframe}

\allowdisplaybreaks

\newcommand{\marginnote}[1]{\marginpar[\raggedleft#1]{\raggedright#1}}

\begin{document}
\chapter{Chapter title}
Integer suscipit massa et nulla accumsan sed lacinia lacus tincidunt. Aenean nisi lacus, iaculis eu consequat in, fermentum eget urna. Proin augue lacus, euismod eu tempor vel, mollis eget quam. Donec vitae consequat nulla. In cursus sagittis diam, at tristique sem interdum pharetra.\marginnote{Margin text.}
\begin{theorem}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
\begin{proof}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
\begin{equation}
  A = \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
\end{equation}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
\end{proof}
\end{theorem}
Morbi gravida dapibus dapibus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Mauris mauris diam, faucibus vitae pretium vitae, volutpat eget velit. Aenean quis vestibulum ante. Duis enim tortor, accumsan eget hendrerit non, pellentesque vel magna. Duis eros turpis, auctor vel aliquam vitae, congue ut dolor.
\begin{equation}
  A = \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
\end{equation}
Sed a libero mi. Donec cursus dignissim quam tincidunt fermentum. Curabitur ac libero leo, non sagittis nisi. Proin sodales tincidunt ante, in aliquam justo cursus in. Nunc tempus feugiat volutpat. Phasellus porttitor dolor elementum quam suscipit tempus. Donec posuere consectetur turpis sed congue. Sed et nunc dui, sit amet viverra erat. Ut malesuada molestie quam, porta fringilla libero consequat quis.
\begin{theorem}
 Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
\begin{proof}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
\begin{equation}
  A = \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
\end{equation}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
\end{proof}
\end{theorem}
Nullam elementum libero ut erat suscipit cursus non eget nibh. In accumsan rhoncus scelerisque. Sed vel eros et lacus tincidunt laoreet. Etiam molestie metus id tortor euismod vitae bibendum nisi rhoncus.

Pellentesque nec gravida ligula. Curabitur nibh sem, porta in suscipit non, porttitor lobortis arcu. Sed imperdiet, nisi sit amet vehicula lobortis, eros urna aliquam magna, sed auctor sem dui nec turpis. Nulla facilisi. Nam a elit lacus. Etiam vel leo ligula. Donec lectus mi, tristique at lobortis id, viverra nec felis.
\begin{equation}
  Ax = b
\end{equation}
Etiam vel felis at enim pulvinar lacinia lacinia quis ipsum. Etiam ac elementum tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque sit amet rhoncus tortor.
\begin{theorem}
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
\begin{proof}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
\begin{equation}
  Ax = b
\end{equation}
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
\end{proof}
\end{theorem}

Nullam sollicitudin nisl ac metus malesuada fermentum. Mauris tellus arcu, porttitor et condimentum ut, commodo pellentesque justo. Nam rutrum, nunc non dictum placerat, dolor metus interdum dui, eu tincidunt libero mauris vel ante.
\begin{align}
  A &= \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\} \\
  A &= \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
\end{align}
Nunc placerat auctor odio, vel ullamcorper massa dapibus eu. Suspendisse luctus, erat at semper pulvinar, velit diam convallis metus, vitae aliquam nibh tortor vitae neque. Morbi venenatis eleifend sapien at pulvinar. Quisque urna leo, molestie ut consequat id, porta vitae neque. Praesent varius convallis justo id tincidunt. Duis nulla elit, euismod sit amet tincidunt ut, sodales eu felis. Phasellus rutrum bibendum urna sit amet iaculis.\marginnote{Margin text.}
\begin{equation}
  Ax = b
\end{equation}
Nullam vel velit quis nibh volutpat ullamcorper. Pellentesque tempor turpis quis massa tincidunt imperdiet. Nam lobortis, justo quis mollis faucibus, erat enim lobortis massa, sagittis egestas lacus odio sed enim. Morbi pulvinar placerat sem, eget pulvinar risus hendrerit sit amet. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed elementum faucibus mi, eget euismod magna convallis vel. Fusce egestas posuere dignissim.
\end{document}
share|improve this question

2 Answers 2

up vote 8 down vote accepted
+500

Updated to cope with \chapter and putting the numbers in the margin

enter image description here

\documentclass[twoside]{memoir}
\usepackage{amsmath}
\usepackage[amsmath,standard]{ntheorem}

\newcommand{\marginnote}[1]{\marginpar[\raggedleft#1]{\raggedright#1}}



\makeatletter

\def\tagform@#1{\maketag@@@{\leavevmode%
%\pdfsavepos
%\edef\tmp{\write\@auxout{\gdef\string\EQ@\romannumeral#1{{\noexpand\the\c@page}{\noexpand\the\pdflastxpos}}}}%
\protected@edef\tmp{\write\@auxout{\string\expandafter\string\gdef\string\csname\space EQ@#1\string\endcsname{{\noexpand\the\c@page}{}}}}%
\tmp
\expandafter\ifx\csname EQ@#1\endcsname\relax
\else
\expandafter\expandafter\expandafter\foo\csname EQ@#1\endcsname{#1}%
\fi
}}

\def\foo#1#2#3{%
\ifodd\numexpr#1\relax
\kern1sp\rlap{\kern\marginparsep(\ignorespaces#3\unskip\@@italiccorr)}%
\else
\kern1sp\llap{(\ignorespaces#3\unskip\@@italiccorr)\kern\dimexpr+\textwidth+\marginparsep\relax}%
\fi
}

\makeatother

\begin{document}
\chapter{Chapter title}

TEST \ref{a} \ref{b}

\clearpage


TEST  \ref{a} \ref{b}


Integer suscipit massa et nulla accumsan sed lacinia lacus tincidunt. Aenean nisi lacus, iaculis eu consequat in, fermentum eget urna. Proin augue lacus, euismod eu tempor vel, mollis eget quam. Donec vitae consequat nulla. In cursus sagittis diam, at tristique sem interdum pharetra.\marginnote{Margin text.}
\begin{theorem}
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \begin{proof}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
    \begin{equation}\label{a}
      A = \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
    \end{equation}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \end{proof}
\end{theorem}
Morbi gravida dapibus dapibus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Mauris mauris diam, faucibus vitae pretium vitae, volutpat eget velit. Aenean quis vestibulum ante. Duis enim tortor, accumsan eget hendrerit non, pellentesque vel magna. Duis eros turpis, auctor vel aliquam vitae, congue ut dolor.
\begin{equation}
  A = \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
\end{equation}
Sed a libero mi. Donec cursus dignissim quam tincidunt fermentum. Curabitur ac libero leo, non sagittis nisi. Proin sodales tincidunt ante, in aliquam justo cursus in. Nunc tempus feugiat volutpat. Phasellus porttitor dolor elementum quam suscipit tempus. Donec posuere consectetur turpis sed congue. Sed et nunc dui, sit amet viverra erat. Ut malesuada molestie quam, porta fringilla libero consequat quis.
\addtocounter{equation}{100}
\begin{theorem}
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \begin{proof}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
    \begin{equation}
      A = \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
    \end{equation}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \end{proof}
\end{theorem}
Nullam elementum libero ut erat suscipit cursus non eget nibh. In accumsan rhoncus scelerisque. Sed vel eros et lacus tincidunt laoreet. Etiam molestie metus id tortor euismod vitae bibendum nisi rhoncus.


Pellentesque nec gravida ligula. Curabitur nibh sem, porta in suscipit non, porttitor lobortis arcu. Sed imperdiet, nisi sit amet vehicula lobortis, eros urna aliquam magna, sed auctor sem dui nec turpis. Nulla facilisi. Nam a elit lacus. Etiam vel leo ligula. Donec lectus mi, tristique at lobortis id, viverra nec felis.
\begin{equation}
  Ax = b
\end{equation}
Etiam vel felis at enim pulvinar lacinia lacinia quis ipsum. Etiam ac elementum tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque sit amet rhoncus tortor.
\begin{theorem}
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \begin{proof}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
    \begin{equation}
      Ax = b
    \end{equation}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \end{proof}
\end{theorem}

Nullam sollicitudin nisl ac metus malesuada fermentum. Mauris tellus arcu, porttitor et condimentum ut, commodo pellentesque justo. Nam rutrum, nunc non dictum placerat, dolor metus interdum dui, eu tincidunt libero mauris vel ante.
\begin{equation}\label{b}
  A = \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
\end{equation}
Nunc placerat auctor odio, vel ullamcorper massa dapibus eu. Suspendisse luctus, erat at semper pulvinar, velit diam convallis metus, vitae aliquam nibh tortor vitae neque. Morbi venenatis eleifend sapien at pulvinar. Quisque urna leo, molestie ut consequat id, porta vitae neque. Praesent varius convallis justo id tincidunt. Duis nulla elit, euismod sit amet tincidunt ut, sodales eu felis. Phasellus rutrum bibendum urna sit amet iaculis.\marginnote{Margin text.}
\begin{equation}
  Ax = b
\end{equation}
Nullam vel velit quis nibh volutpat ullamcorper. Pellentesque tempor turpis quis massa tincidunt imperdiet. Nam lobortis, justo quis mollis faucibus, erat enim lobortis massa, sagittis egestas lacus odio sed enim. Morbi pulvinar placerat sem, eget pulvinar risus hendrerit sit amet. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed elementum faucibus mi, eget euismod magna convallis vel. Fusce egestas posuere dignissim.
\end{document}

ORIGINAL

This uses \pdfsavepos so it takes a couple of latex runs to settle down but it's more accurate than testing the value of the page counter which can be out due to the asynchronous nature of the output routine. This version just moves the number over it doesn't check for clashes, although mostly it won't overprint as amsmath will have moved the equation number down for large equations. (Arguably equation numbers on the left should move up, but this doesn't do that).

enter image description here

\documentclass[twoside]{memoir}
\usepackage{amsmath}
\usepackage[amsmath,standard]{ntheorem}

\newcommand{\marginnote}[1]{\marginpar[\raggedleft#1]{\raggedright#1}}


\makeatletter

\def\tagform@#1{\maketag@@@{\leavevmode%
\pdfsavepos
\edef\tmp{\write\@auxout{\gdef\string\EQ@\romannumeral#1{{\noexpand\the\c@page}{\noexpand\the\pdflastxpos}}}}%
\tmp
\expandafter\ifx\csname EQ@\romannumeral#1\endcsname\relax
\else
\expandafter\expandafter\expandafter\foo\csname EQ@\romannumeral#1\endcsname{#1}%
\fi
}}

\def\foo#1#2#3{%
\ifodd\numexpr#1\relax
(\ignorespaces#3\unskip\@@italiccorr)%
\else
\kern1sp\llap{\rlap{(\ignorespaces#3\unskip\@@italiccorr)}\kern\textwidth}%
\fi
}

\makeatother

\begin{document}

TEST\clearpage


Integer suscipit massa et nulla accumsan sed lacinia lacus tincidunt. Aenean nisi lacus, iaculis eu consequat in, fermentum eget urna. Proin augue lacus, euismod eu tempor vel, mollis eget quam. Donec vitae consequat nulla. In cursus sagittis diam, at tristique sem interdum pharetra.\marginnote{Margin text.}
\begin{theorem}
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \begin{proof}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
    \begin{equation}
      A = \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
    \end{equation}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \end{proof}
\end{theorem}
Morbi gravida dapibus dapibus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Mauris mauris diam, faucibus vitae pretium vitae, volutpat eget velit. Aenean quis vestibulum ante. Duis enim tortor, accumsan eget hendrerit non, pellentesque vel magna. Duis eros turpis, auctor vel aliquam vitae, congue ut dolor.
\begin{equation}
  A = \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
\end{equation}
Sed a libero mi. Donec cursus dignissim quam tincidunt fermentum. Curabitur ac libero leo, non sagittis nisi. Proin sodales tincidunt ante, in aliquam justo cursus in. Nunc tempus feugiat volutpat. Phasellus porttitor dolor elementum quam suscipit tempus. Donec posuere consectetur turpis sed congue. Sed et nunc dui, sit amet viverra erat. Ut malesuada molestie quam, porta fringilla libero consequat quis.
\addtocounter{equation}{100}
\begin{theorem}
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \begin{proof}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
    \begin{equation}
      A = \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
    \end{equation}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \end{proof}
\end{theorem}
Nullam elementum libero ut erat suscipit cursus non eget nibh. In accumsan rhoncus scelerisque. Sed vel eros et lacus tincidunt laoreet. Etiam molestie metus id tortor euismod vitae bibendum nisi rhoncus.


Pellentesque nec gravida ligula. Curabitur nibh sem, porta in suscipit non, porttitor lobortis arcu. Sed imperdiet, nisi sit amet vehicula lobortis, eros urna aliquam magna, sed auctor sem dui nec turpis. Nulla facilisi. Nam a elit lacus. Etiam vel leo ligula. Donec lectus mi, tristique at lobortis id, viverra nec felis.
\begin{equation}
  Ax = b
\end{equation}
Etiam vel felis at enim pulvinar lacinia lacinia quis ipsum. Etiam ac elementum tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque sit amet rhoncus tortor.
\begin{theorem}
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \begin{proof}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
    \begin{equation}
      Ax = b
    \end{equation}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \end{proof}
\end{theorem}

Nullam sollicitudin nisl ac metus malesuada fermentum. Mauris tellus arcu, porttitor et condimentum ut, commodo pellentesque justo. Nam rutrum, nunc non dictum placerat, dolor metus interdum dui, eu tincidunt libero mauris vel ante.
\begin{equation}
  A = \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
\end{equation}
Nunc placerat auctor odio, vel ullamcorper massa dapibus eu. Suspendisse luctus, erat at semper pulvinar, velit diam convallis metus, vitae aliquam nibh tortor vitae neque. Morbi venenatis eleifend sapien at pulvinar. Quisque urna leo, molestie ut consequat id, porta vitae neque. Praesent varius convallis justo id tincidunt. Duis nulla elit, euismod sit amet tincidunt ut, sodales eu felis. Phasellus rutrum bibendum urna sit amet iaculis.\marginnote{Margin text.}
\begin{equation}
  Ax = b
\end{equation}
Nullam vel velit quis nibh volutpat ullamcorper. Pellentesque tempor turpis quis massa tincidunt imperdiet. Nam lobortis, justo quis mollis faucibus, erat enim lobortis massa, sagittis egestas lacus odio sed enim. Morbi pulvinar placerat sem, eget pulvinar risus hendrerit sit amet. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed elementum faucibus mi, eget euismod magna convallis vel. Fusce egestas posuere dignissim.
\end{document}
share|improve this answer
    
Yes you can combine this with the code from the question that is linked in this question, also (as in that answer) probably need to make \ref use the original formatting so in-text references to equation names don't fly off to the left, will look later. –  David Carlisle Jan 30 '13 at 9:35
    
code/image updated –  David Carlisle Feb 3 '13 at 16:26
    
Thanks. Works great. Does it look great? I still haven't decided... –  Audrey Feb 3 '13 at 19:22

In the solution below I've borrowed code from

The part that does what you need is

% customize the tag form of the equations
\makeatletter
\global\tagsleft@true
\let\mytagform@=\tagform@
\def\tagform@#1{%
\ifodd\value{page}
\maketag@@@{\hbox{\rlap{\hspace{.25cm}(\ignorespaces#1\unskip\@@italiccorr)\hspace{1mm}}}}\kern1sp%
\else
    \maketag@@@{\hbox{\llap{(\ignorespaces#1\unskip\@@italiccorr)\hspace{2mm}}}}\kern1sp%
\fi}
\renewcommand{\eqref}[1]{{\mytagform@{\ref{#1}}}}

\EveryShipout{%
  \ifodd\value{page}% Test page number
      \global\@fleqntrue
  \else
      \global\@fleqnfalse
      \fi
}

I loaded the showframe just to check that it was working. I manually tweaked the hspace to get the tag into the margin- no doubt this could be done using a length (wasn't sure what it is called).

The amsmath package offers three choices for its equation alignment:

  • leqno
  • reqno
  • fleqn

I was originally working with toggling tagsleft@ between true and false; I don't know why that didn't work, but toggling \@fleqn to true or false did the job just fine.

\documentclass[twoside]{memoir}
\usepackage{amsmath}
\usepackage[amsmath,standard]{ntheorem}

\newcommand{\marginnote}[1]{\marginpar[\raggedleft#1]{\raggedright#1}}

\usepackage{showframe}
\usepackage{everyshi}
\usepackage{hyperref}

% customize the tag form of the equations
\makeatletter
\global\tagsleft@true
\let\mytagform@=\tagform@
\def\tagform@#1{%
\ifodd\value{page}
\maketag@@@{\hbox{\rlap{\hspace{.25cm}(\ignorespaces#1\unskip\@@italiccorr)\hspace{1mm}}}}\kern1sp%
\else
    \maketag@@@{\hbox{\llap{(\ignorespaces#1\unskip\@@italiccorr)\hspace{2mm}}}}\kern1sp%
\fi}
\renewcommand{\eqref}[1]{{\mytagform@{\ref{#1}}}}

\EveryShipout{%
  \ifodd\value{page}% Test page number
      \global\@fleqntrue
  \else
      \global\@fleqnfalse
      \fi
}

\begin{document}

Integer suscipit massa et nulla accumsan sed lacinia lacus tincidunt. Aenean nisi lacus, iaculis eu consequat in, fermentum eget urna. Proin augue lacus, euismod eu tempor vel, mollis eget quam. Donec vitae consequat nulla. In cursus sagittis diam, at tristique sem interdum pharetra.\marginnote{Margin text.}
\begin{theorem}
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \begin{proof}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
    \begin{equation}
      A = \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
    \end{equation}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \end{proof}
\end{theorem}
Morbi gravida dapibus dapibus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Mauris mauris diam, faucibus vitae pretium vitae, volutpat eget velit. Aenean quis vestibulum ante. Duis enim tortor, accumsan eget hendrerit non, pellentesque vel magna. Duis eros turpis, auctor vel aliquam vitae, congue ut dolor.
\begin{equation}
  A = \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
\end{equation}
Sed a libero mi. Donec cursus dignissim quam tincidunt fermentum. Curabitur ac libero leo, non sagittis nisi. Proin sodales tincidunt ante, in aliquam justo cursus in. Nunc tempus feugiat volutpat. Phasellus porttitor dolor elementum quam suscipit tempus. Donec posuere consectetur turpis sed congue. Sed et nunc dui, sit amet viverra erat. Ut malesuada molestie quam, porta fringilla libero consequat quis.
\begin{theorem}
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \begin{proof}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
    \begin{equation}
      A = \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
    \end{equation}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \end{proof}
\end{theorem}
Nullam elementum libero ut erat suscipit cursus non eget nibh. In accumsan rhoncus scelerisque. Sed vel eros et lacus tincidunt laoreet. Etiam molestie metus id tortor euismod vitae bibendum nisi rhoncus.

Pellentesque nec gravida ligula. Curabitur nibh sem, porta in suscipit non, porttitor lobortis arcu. Sed imperdiet, nisi sit amet vehicula lobortis, eros urna aliquam magna, sed auctor sem dui nec turpis. Nulla facilisi. Nam a elit lacus. Etiam vel leo ligula. Donec lectus mi, tristique at lobortis id, viverra nec felis.
\begin{equation}
  Ax = b
\end{equation}
Etiam vel felis at enim pulvinar lacinia lacinia quis ipsum. Etiam ac elementum tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque sit amet rhoncus tortor.
\begin{theorem}
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \begin{proof}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
    \begin{equation}
      Ax = b
    \end{equation}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \end{proof}
\end{theorem}

Nullam sollicitudin nisl ac metus malesuada fermentum. Mauris tellus arcu, porttitor et condimentum ut, commodo pellentesque justo. Nam rutrum, nunc non dictum placerat, dolor metus interdum dui, eu tincidunt libero mauris vel ante.
\begin{equation}
  A = \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
\end{equation}
Nunc placerat auctor odio, vel ullamcorper massa dapibus eu. Suspendisse luctus, erat at semper pulvinar, velit diam convallis metus, vitae aliquam nibh tortor vitae neque. Morbi venenatis eleifend sapien at pulvinar. Quisque urna leo, molestie ut consequat id, porta vitae neque. Praesent varius convallis justo id tincidunt. Duis nulla elit, euismod sit amet tincidunt ut, sodales eu felis. Phasellus rutrum bibendum urna sit amet iaculis.\marginnote{Margin text.}
\begin{equation}
  Ax = b
\end{equation}
Nullam vel velit quis nibh volutpat ullamcorper. Pellentesque tempor turpis quis massa tincidunt imperdiet. Nam lobortis, justo quis mollis faucibus, erat enim lobortis massa, sagittis egestas lacus odio sed enim. Morbi pulvinar placerat sem, eget pulvinar risus hendrerit sit amet. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed elementum faucibus mi, eget euismod magna convallis vel. Fusce egestas posuere dignissim.

Integer suscipit massa et nulla accumsan sed lacinia lacus tincidunt. Aenean nisi lacus, iaculis eu consequat in, fermentum eget urna. Proin augue lacus, euismod eu tempor vel, mollis eget quam. Donec vitae consequat nulla. In cursus sagittis diam, at tristique sem interdum pharetra.\marginnote{Margin text.}
\begin{theorem}
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \begin{proof}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
    \begin{equation}
      A = \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
    \end{equation}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \end{proof}
\end{theorem}
Morbi gravida dapibus dapibus. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Mauris mauris diam, faucibus vitae pretium vitae, volutpat eget velit. Aenean quis vestibulum ante. Duis enim tortor, accumsan eget hendrerit non, pellentesque vel magna. Duis eros turpis, auctor vel aliquam vitae, congue ut dolor.
\begin{equation}
  A = \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
\end{equation}
Sed a libero mi. Donec cursus dignissim quam tincidunt fermentum. Curabitur ac libero leo, non sagittis nisi. Proin sodales tincidunt ante, in aliquam justo cursus in. Nunc tempus feugiat volutpat. Phasellus porttitor dolor elementum quam suscipit tempus. Donec posuere consectetur turpis sed congue. Sed et nunc dui, sit amet viverra erat. Ut malesuada molestie quam, porta fringilla libero consequat quis.
\begin{theorem}
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \begin{proof}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
    \begin{equation}
      A = \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
    \end{equation}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \end{proof}
\end{theorem}
Nullam elementum libero ut erat suscipit cursus non eget nibh. In accumsan rhoncus scelerisque. Sed vel eros et lacus tincidunt laoreet. Etiam molestie metus id tortor euismod vitae bibendum nisi rhoncus.

Pellentesque nec gravida ligula. Curabitur nibh sem, porta in suscipit non, porttitor lobortis arcu. Sed imperdiet, nisi sit amet vehicula lobortis, eros urna aliquam magna, sed auctor sem dui nec turpis. Nulla facilisi. Nam a elit lacus. Etiam vel leo ligula. Donec lectus mi, tristique at lobortis id, viverra nec felis.
\begin{equation}
  Ax = b
\end{equation}
Etiam vel felis at enim pulvinar lacinia lacinia quis ipsum. Etiam ac elementum tellus. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Pellentesque sit amet rhoncus tortor.
\begin{theorem}
  Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \begin{proof}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
    \begin{equation}
      Ax = b
    \end{equation}
    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec risus mi, pharetra eget sodales volutpat, aliquam eu metus. Aenean ultricies iaculis sapien, pretium lobortis ligula ultrices a.
  \end{proof}
\end{theorem}

Nullam sollicitudin nisl ac metus malesuada fermentum. Mauris tellus arcu, porttitor et condimentum ut, commodo pellentesque justo. Nam rutrum, nunc non dictum placerat, dolor metus interdum dui, eu tincidunt libero mauris vel ante.
\begin{equation}
  A = \{x_{i,j}: i = 1, \ldots, n; j = 1, \ldots, m\}
\end{equation}
Nunc placerat auctor odio, vel ullamcorper massa dapibus eu. Suspendisse luctus, erat at semper pulvinar, velit diam convallis metus, vitae aliquam nibh tortor vitae neque. Morbi venenatis eleifend sapien at pulvinar. Quisque urna leo, molestie ut consequat id, porta vitae neque. Praesent varius convallis justo id tincidunt. Duis nulla elit, euismod sit amet tincidunt ut, sodales eu felis. Phasellus rutrum bibendum urna sit amet iaculis.\marginnote{Margin text.}
\begin{equation}
  Ax = b
\end{equation}
Nullam vel velit quis nibh volutpat ullamcorper. Pellentesque tempor turpis quis massa tincidunt imperdiet. Nam lobortis, justo quis mollis faucibus, erat enim lobortis massa, sagittis egestas lacus odio sed enim. Morbi pulvinar placerat sem, eget pulvinar risus hendrerit sit amet. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Sed elementum faucibus mi, eget euismod magna convallis vel. Fusce egestas posuere dignissim.
\end{document}

Possible reasons to consider not doing this

When we read a document (in a Left-To-Right language) we train our eyes to look for chapter/section numbers, enumerated lists, and theorem-like environments on the left of the page. Imho, one of the reasons that tagging equations on the right of the page is effective is that equations are one of the only objects that do so.

Moving the equation tag to the left of the page may cause confusion to the reader as he/she may not be immediately clear that the equation tag does indeed belong to that equation.

share|improve this answer
    
@Audrey see the update- works fine in your MWE- let me know if you find another one that breaks it :) –  cmhughes Jan 25 '13 at 5:59
    
Dammit! The example was still too minimal. It will likely take some time for me to find a better one. The existing one does point out one issue though - on outer-left pages, the equations are left-aligned, not centred. Remaining problems the example doesn't uncover are related to numbers near page breaks. –  Audrey Jan 25 '13 at 15:17
    
@Audrey ok, let me know when you have another MNWE :) –  cmhughes Jan 25 '13 at 16:20
    
I've updated the example and passed along your bounty. Thanks for your help! –  Audrey Jan 30 '13 at 3:26
    
@Audrey you're very kind, thank you very much :) Does David's solution resolve everything, or should I keep trying with your updated code? –  cmhughes Jan 30 '13 at 16:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.