summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/ifoddpage/ifoddpage.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/ifoddpage/ifoddpage.sty')
-rw-r--r--Master/texmf-dist/tex/latex/ifoddpage/ifoddpage.sty55
1 files changed, 55 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/ifoddpage/ifoddpage.sty b/Master/texmf-dist/tex/latex/ifoddpage/ifoddpage.sty
new file mode 100644
index 00000000000..eeea03bb12e
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/ifoddpage/ifoddpage.sty
@@ -0,0 +1,55 @@
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{ifoddpage}[2011/09/13 v1.0 Conditionals for odd/even page detection]
+\newcount\c@checkoddpage
+\def\thecheckoddpage{\number\c@checkoddpage}
+\newif\ifoddpage
+\newif\ifoddpageoroneside
+\let\oddpage@checkpage\relax
+\def\oddpage@page{1}
+\def\oddpage@label{%
+ \@newl@bel{checkoddpage}%
+}%
+\write\@auxout{\noexpand\providecommand\noexpand\oddpage@label[2]{}}%
+\def\oddpage@checkpage#1{%
+ \@bsphack
+ \write\@auxout{\string\oddpage@label{#1}{\the\c@page}}%
+ \@esphack
+}%
+\def\oddpage@page{%
+ \expandafter\ifx\csname checkoddpage@\thecheckoddpage\endcsname\relax
+ \the\c@page
+ \else
+ \csname checkoddpage@\thecheckoddpage\endcsname
+ \fi
+}%
+\DeclareRobustCommand\checkoddpage{%
+ \stepcounter{checkoddpage}%
+ \expandafter\oddpage@checkpage\expandafter{\number\c@checkoddpage}%
+ \ifodd\oddpage@page\relax
+ \oddpagetrue
+ \oddpageoronesidetrue
+ \else
+ \oddpagefalse
+ \oddpageoronesidefalse
+ \fi
+ \if@twoside\else
+ \oddpageoronesidetrue
+ \fi
+}%
+\def\@ifoddpage{%
+ \ifoddside
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi
+}
+\def\@ifoddpageoroneside{%
+ \iftwosideoddside
+ \expandafter\@firstoftwo
+ \else
+ \expandafter\@secondoftwo
+ \fi
+}
+\endinput
+%%
+%% End of file `ifoddpage.sty'.