如何根据奇数页还是偶数页将公式编号放在左侧或右侧

如何根据奇数页还是偶数页将公式编号放在左侧或右侧

我正在尝试创建一个文档,在偶数页和奇数页的不同侧面上都有标签。我希望标签位于偶数页的右侧,奇数页的左侧。

\documentclass[12pt,a4paper]{report}


\usepackage[cp1250]{inputenc}   
\usepackage[T1,plmath]{polski}        

\usepackage{indentfirst}        
\usepackage{amsfonts} 
\usepackage{amssymb}  
\usepackage{amsmath}  
\usepackage{mathrsfs} 
\usepackage{graphicx}
\linespread{1.5} 
%%%%%%%%%%%%%%%%%%%%%%%%%%

%stare wartości: \textheight 26cm \textwidth 17cm \topmargin -2cm \oddsidemargin -0.5cm

\textwidth 15.5cm 
\textheight 23.5cm 
\topmargin -1cm 
\oddsidemargin 0cm 
\evensidemargin 0cm 


\def\dowod{D\,o\,w\,ó\,d.\,}
\newtheorem{twi}{Twierdzenie}[chapter]
\newtheorem{tw}{Twierdzenie}
\newtheorem{lem}{Lemat}
\newtheorem{dfn}{Definicja}
\newtheorem{wn}{Wniosek}
\newenvironment{dow}{\par\dowod}{}
\renewcommand{\thetw}{\Alph{tw}}



\begin{document}

\begin{equation}\label{lp2} 
H(0,t)=ue^{-t} \sum_{i=0}^{\infty} \frac{(tu)^i}{i!} = ue^{-t(1-u)}
\end{equation}

\begin{equation}\label{lp3}
  a(j)=1-(1-u)q^j
\end{equation}

\end{document}

是否有可能做到这一点?

答案1

一个简单的实现方法如下:

\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}

相关内容