diff options
author | Karl Berry <karl@freefriends.org> | 2022-10-18 20:54:09 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2022-10-18 20:54:09 +0000 |
commit | bfcea5464a52a2ec66df98da0a380869ffbe6e79 (patch) | |
tree | 14199d514858b87d609191073e7475a220ef97ce /Master/texmf-dist/source | |
parent | 251c314a008fabe6d09e9e781039a9ed86444204 (diff) |
ifoddpage (17oct22)
git-svn-id: svn://tug.org/texlive/trunk@64742 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source')
-rw-r--r-- | Master/texmf-dist/source/latex/ifoddpage/ifoddpage.dtx | 47 |
1 files changed, 40 insertions, 7 deletions
diff --git a/Master/texmf-dist/source/latex/ifoddpage/ifoddpage.dtx b/Master/texmf-dist/source/latex/ifoddpage/ifoddpage.dtx index fe0720777a2..699bf54d0a1 100644 --- a/Master/texmf-dist/source/latex/ifoddpage/ifoddpage.dtx +++ b/Master/texmf-dist/source/latex/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 |