summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/ifoddpage
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2022-10-19 03:01:25 +0000
committerNorbert Preining <norbert@preining.info>2022-10-19 03:01:25 +0000
commit7b6cdf4c23e6ed232601dabc70f5553a8dee9c9b (patch)
tree608a2d05e7d0ffa5cde10be67db643ae542dc280 /macros/latex/contrib/ifoddpage
parent0b311348359e1406b173d9c0de4974af3e90f836 (diff)
CTAN sync 202210190301
Diffstat (limited to 'macros/latex/contrib/ifoddpage')
-rw-r--r--macros/latex/contrib/ifoddpage/DEPENDS.txt1
-rw-r--r--macros/latex/contrib/ifoddpage/README.txt (renamed from macros/latex/contrib/ifoddpage/README)10
-rw-r--r--macros/latex/contrib/ifoddpage/ifoddpage.dtx47
-rw-r--r--macros/latex/contrib/ifoddpage/ifoddpage.pdfbin133988 -> 144874 bytes
4 files changed, 46 insertions, 12 deletions
diff --git a/macros/latex/contrib/ifoddpage/DEPENDS.txt b/macros/latex/contrib/ifoddpage/DEPENDS.txt
new file mode 100644
index 0000000000..0fc4d1f756
--- /dev/null
+++ b/macros/latex/contrib/ifoddpage/DEPENDS.txt
@@ -0,0 +1 @@
+soft ydoc # for compiling the package documentation only
diff --git a/macros/latex/contrib/ifoddpage/README b/macros/latex/contrib/ifoddpage/README.txt
index b71473ec4d..d276e3a5c2 100644
--- a/macros/latex/contrib/ifoddpage/README
+++ b/macros/latex/contrib/ifoddpage/README.txt
@@ -1,9 +1,9 @@
LaTeX package 'ifoddpage'
-~~~~~~~~~~~~~~~~~~~~~~~~
-Copyright (c) 2011 by Martin Scharrer <martin@scharrer-online.de>
-WWW: http://latex.scharrer-online.de/
-CTAN: http://www.ctan.org/pkg/ifoddpage
-Code repository: https://bitbucket.org/martin_scharrer/ifoddpage
+~~~~~~~~~~~~~~~~~~~~~~~~~
+Copyright (c) 2011-2022 by Martin Scharrer <martin.scharrer@web.de>
+License: LaTeX Project Public License, v1.3 or later: http://www.latex-project.org/lppl.txt
+Repository: https://github.com/MartinScharrer/ifoddpage
+Issues: https://github.com/MartinScharrer/ifoddpage/issues
This LaTeX package provides a \ifoddpage conditional to determine if the current page is odd or even.
The macro \checkoddpage must be used direct before to check the page number using a label.
diff --git a/macros/latex/contrib/ifoddpage/ifoddpage.dtx b/macros/latex/contrib/ifoddpage/ifoddpage.dtx
index fe0720777a..699bf54d0a 100644
--- a/macros/latex/contrib/ifoddpage/ifoddpage.dtx
+++ b/macros/latex/contrib/ifoddpage/ifoddpage.dtx
@@ -1,7 +1,7 @@
% \iffalse meta-comment
%<=*COPYRIGHT>
-%% Copyright (C) 2011-2012 by Martin Scharrer <martin@scharrer-online.de>
-%% ----------------------------------------------------------------------
+%% Copyright (c) 2011-2022 by Martin Scharrer <martin.scharrer@web.de>
+%% -------------------------------------------------------------------
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
@@ -24,10 +24,10 @@
%<*driver>
\ProvidesFile{ifoddpage.dtx}[%
%<=*DATE>
- 2016/04/23
+ 2022/10/18
%<=/DATE>
%<=*VERSION>
- v1.1
+ v1.2
%<=/VERSION>
DTX file for ifoddpage package]
\documentclass{ydoc}
@@ -65,14 +65,15 @@
%
% \changes{v1.0}{2011/09/13}{First version.}
% \changes{v1.1}{2016/04/23}{Fixed misspelled macro name.}
+% \changes{v1.2}{2022/10/18}{Updated documentation.}
%
%
% \DoNotIndex{\newcommand,\newenvironment}
%
% \GetFileInfo{ifoddpage.dtx}
% \author{Martin Scharrer}
-% \email{martin@scharrer.me}
-% \repository{https://bitbucket.org/martin_scharrer/ifoddpage}
+% \email{martin.scharrer@web.de}
+% \repository{https://github.com/MartinScharrer/ifoddpage}
% \maketitle
%
% \section{Introduction}
@@ -178,20 +179,36 @@
Conditionals for odd/even page detection]
% \end{macrocode}
%
-%
+% \begin{macro}{\c@checkoddpage}
+% Counter |checkoddpage| is needed to give each use of \Macro\checkoddpage an unique ID for
% \begin{macrocode}
\newcount\c@checkoddpage
% \end{macrocode}
+% \end{macro}
%
% \begin{macro}{\thecheckoddpage}
+% Expands to the value of |checkoddpage|, i.e. ID of last used \Macro\checkoddpage.
% \begin{macrocode}
\def\thecheckoddpage{\number\c@checkoddpage}
% \end{macrocode}
% \end{macro}
%
+% \begin{macro}{\ifoddpage}
+% Conditional: true if used on odd page after \Macro\checkoddpage.
% \begin{macrocode}
\newif\ifoddpage
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\ifoddpageoroneside}
+% Conditional: true if used on odd page after \Macro\checkoddpage.
+% Always true if used in a |oneside| document.
+% \begin{macrocode}
\newif\ifoddpageoroneside
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macrocode}
\let\oddpage@checkpage\relax
% \end{macrocode}
%
@@ -203,6 +220,8 @@
%
%
% \begin{macro}{\oddpage@label}
+% Produces a LaTeX label using the |checkoddpage| counter.
+% An internal LaTeX macro is used for this.
% \begin{macrocode}
\def\oddpage@label{%
\@newl@bel{checkoddpage}%
@@ -213,6 +232,8 @@
%
%
% \begin{macro}{\oddpage@checkpage}
+% Writes the oddpage label with the current page number to the AUX file,
+% so it can be read back during the following \LaTeX{} runs.
% \begin{macrocode}
\def\oddpage@checkpage#1{%
\@bsphack
@@ -224,6 +245,9 @@
%
%
% \begin{macro}{\oddpage@page}
+% Returns the page number of the last \Macro\checkoddpage macro.
+% If there is no label for it defined in the AUX file, e.g.\ first compile run,
+% then the current page number is used instead as a fallback.
% \begin{macrocode}
\def\oddpage@page{%
\expandafter\ifx\csname checkoddpage@\thecheckoddpage\endcsname\relax
@@ -237,6 +261,13 @@
%
%
% \begin{macro}{\checkoddpage}
+% User macro to check if the current page has an odd page number.
+% Increases |checkoddpage| counter to produce an unique ID for this macro usage.
+% Calls \Macro\oddpage@checkpage to produce a reference entry in the AUX file.
+% Then checks if the \Macro\oddpage@page is odd and sets
+% \Macro{ifoddpage} and \Macro{ifoddpageoroneside} accordantly.
+% Finally checks if the |twoside| setting is active and set \Macro{ifoddpageoroneside}
+% to |true| if so.
% \begin{macrocode}
\DeclareRobustCommand\checkoddpage{%
\stepcounter{checkoddpage}%
@@ -257,6 +288,7 @@
%
%
% \begin{macro}{\@ifoddpage}
+% Wrapper around \Macro{ifoddpage}. Will expand to the next token if odd, to the second token if not.
% \begin{macrocode}
\def\@ifoddpage{%
\ifoddpage
@@ -270,6 +302,7 @@
%
%
% \begin{macro}{\@ifoddpageoroneside}
+% Wrapper around \Macro{ifoddpageoroneside}. Will expand to the next token if odd, to the second token if not.
% \begin{macrocode}
\def\@ifoddpageoroneside{%
\iftwosideoddside
diff --git a/macros/latex/contrib/ifoddpage/ifoddpage.pdf b/macros/latex/contrib/ifoddpage/ifoddpage.pdf
index 3c487f795e..d5c6c142a3 100644
--- a/macros/latex/contrib/ifoddpage/ifoddpage.pdf
+++ b/macros/latex/contrib/ifoddpage/ifoddpage.pdf
Binary files differ