summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/flippdf
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2020-10-22 03:01:48 +0000
committerNorbert Preining <norbert@preining.info>2020-10-22 03:01:48 +0000
commit7448609d1256af02966b8f84fe8464234276ce7a (patch)
tree878dfcfc9f2f014d593d1bdb5dee382ee4a9ee3a /macros/latex/contrib/flippdf
parentd800950bfaacab9c6c4bf4d44206d60016b2f04d (diff)
CTAN sync 202010220301
Diffstat (limited to 'macros/latex/contrib/flippdf')
-rw-r--r--macros/latex/contrib/flippdf/flippdf.dtx137
-rw-r--r--macros/latex/contrib/flippdf/flippdf.ins6
-rw-r--r--macros/latex/contrib/flippdf/flippdf.pdfbin135228 -> 148556 bytes
3 files changed, 133 insertions, 10 deletions
diff --git a/macros/latex/contrib/flippdf/flippdf.dtx b/macros/latex/contrib/flippdf/flippdf.dtx
index e329d4f2a2..3f3dde8be4 100644
--- a/macros/latex/contrib/flippdf/flippdf.dtx
+++ b/macros/latex/contrib/flippdf/flippdf.dtx
@@ -23,7 +23,7 @@
%<*driver>
\documentclass{ltxdoc}
\usepackage{mathptmx}
-\usepackage{helvet}
+\usepackage[scaled=0.92]{helvet}
\usepackage{hologo}
\usepackage[T1]{fontenc}
\usepackage{hypdoc}
@@ -46,13 +46,15 @@
% \DoNotIndex{\paperwidth, \space, \strip@pt}
% \DoNotIndex{\maketitle, \title, \lipsum}
% \DoNotIndex{\thispagestyle, \relax, \setcounter, \Large, \clearpage, \bigskip}
-%
-% \CheckSum{40}
+% \DoNotIndex{\@ifundefined, \AtBeginDocument, \endinput, \MessageBreak}
+% \DoNotIndex{\PackageWarningNoLine}
+
+% \CheckSum{86}
%
% \def\filename{flippdf.dtx}
-% \def\fileversion{1.1}
-% \def\filedate{2020/10/17}
-% \def\docdate{2020/10/17}
+% \def\fileversion{2.0}
+% \def\filedate{2020/10/18}
+% \def\docdate{2020/10/18}
%
% \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package
% \newcommand*{\Lopt}[1]{\textsf {#1}} ^^A typeset an option
@@ -182,13 +184,127 @@
%</test-2>
% \fi
%
+% \section{Package redesign}
+%
+% Until Fall 2020, \Lpack{flippdf} relied on package \Lpack{everypage} for
+% its operation. Recently, functionalities similar to those offered by
+% \Lpack{everypage} have been incorporated into \hologo{LaTeX} and
+% \Lpack{everypage} has been deprecated, maintaining support for it just
+% in view of compatibility for legacy packages still relying on it. As a
+% consequence, \Lpack{flippdf} has been redesigned to take advantage of the
+% new \hologo{LaTeX} features and to drop the dependence on
+% \Lpack{everypage}.
+%
+% Version 2.0 of \Lpack{flippdf} is the result of the redesign. Version
+% 1.x remains availabe las \Lpack{flippdf-1x} and modern \Lpack{flippdf}
+% knows how to fallback on it when used on a \hologo{LaTeX} format missing
+% the new features.
+%
% \StopEventually {}
-%
+%
% \section{Implementation}
%
+% \subsection{Implementation of \Lpack{flippdf}}
+%
% \iffalse
%<*flippdf>
% \fi
+% \changes{R2.0}{2020/10/18}{Use modern \hologo{LaTeX} features.}%
+% Announce the name and version of the package, that requires
+% \hologo{LaTeX2e} (actually \hologo{pdfLaTeX} or \hologo{LuaLaTeX}).
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{flippdf}%
+ [2020/10/18 2.0 Horizontal flipping of pages with pdfLaTeX]
+% \end{macrocode}
+% Depending on the actual functionalities provided by \hologo{LaTeX}
+% consider loading \Lpack{flippdf-1x}. If so doing, warn about this,
+% and hand over the operation to that package.
+% \begin{macrocode}
+\@ifundefined{AddToHook}{%
+ \PackageWarningNoLine{flippdf}{%
+ You appear to be running a version of LaTeX\MessageBreak
+ unsupported by current flippdf.\MessageBreak
+ Forcing fallback to `flippdf-1x` that\MessageBreak
+ uses an older code base}
+ \RequirePackage{flippdf-1x}
+ \endinput}{}
+% \end{macrocode}
+% State package requirements, including \Lpack{iftex}
+% \begin{macrocode}
+\RequirePackage{iftex}
+% \end{macrocode}
+% Error out if not working in PDF mode
+% \begin{macrocode}
+\AtBeginDocument{%
+ \ifpdf
+ \relax
+ \else
+ \PackageError{flippdf}{%
+ package only works in pdf output mode.}%
+ \fi}
+% \end{macrocode}
+%
+% \begin{macro}{\if@sc@flippdf}
+% Define a boolean variable to remember if pages are to be flipped or
+% not.
+% \begin{macrocode}
+\newif\if@sc@flippdf
+% \end{macrocode}
+% \end{macro}
+%
+% \begin{macro}{\FlipPDF}\begin{macro}{\UnFlipPDF}
+% Define the commands used to switch on and off the horizontal
+% flipping of the document pages.
+% \begin{macrocode}
+\newcommand\FlipPDF{\@sc@flippdftrue}
+\newcommand\UnFlipPDF{\@sc@flippdffalse}
+% \end{macrocode}
+% \end{macro}\end{macro}
+%
+% By default activate the flipping:
+% \begin{macrocode}
+\FlipPDF
+% \end{macrocode}
+%
+% Set up the processing of options:
+% \begin{macrocode}
+\DeclareOption{off}{\UnFlipPDF}
+\ProcessOptions
+% \end{macrocode}
+%
+% And eventually, tell \hologo{LaTeX} to flip every page, by using the
+% \Lpack{everypage} hook. First consider the case when running in
+% \hologo{pdfLaTeX}
+% \begin{macrocode}
+\ifpdftex
+ \AddToHook{shipout/background}{%
+ \if@sc@flippdf
+ \pdfliteral direct {-1 0 0 1 \strip@pt\paperwidth\space 0 cm}%
+ \fi}%
+\fi
+% \end{macrocode}
+% Then consider the case when running in \hologo{LuaLaTeX}
+% \changes{R1.1}{2020/10/17}{Extend package to work also with
+% \hologo{LuaLaTeX}.}
+% \begin{macrocode}
+\ifluatex
+ \AddToHook{shipout/background}{%
+ \if@sc@flippdf
+ \pdfextension literal direct {%
+ -1 0 0 1 \strip@pt\paperwidth\space 0 cm}%
+ \fi}%
+\fi
+% \end{macrocode}
+% \iffalse
+%</flippdf>
+% \fi
+
+
+% \subsection{Implementation of \Lpack{flippdf-1x}}
+% \iffalse
+%<*flippdf-1x>
+% \fi
% Announce the name and version of the package, that requires
% \hologo{LaTeX2e} (actually \hologo{pdfLaTeX} or \hologo{LuaLaTeX}).
% \changes{R1.0b}{2020/10/11}{%
@@ -196,7 +312,7 @@
% release.}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{flippdf}%
+\ProvidesPackage{flippdf-1x}%
[2020/10/17 1.1 Horizontal flipping of pages with pdfLaTeX]
% \end{macrocode}
%
@@ -264,12 +380,13 @@
\ifluatex
\AddEverypageHook{%
\if@sc@flippdf
- \pdfextension literal direct {-1 0 0 1 \strip@pt\paperwidth\space 0 cm}%
+ \pdfextension literal direct {%
+ -1 0 0 1 \strip@pt\paperwidth\space 0 cm}%
\fi}%
\fi
% \end{macrocode}
% \iffalse
-%</flippdf>
+%</flippdf-1x>
% \fi
%
% \Finale
diff --git a/macros/latex/contrib/flippdf/flippdf.ins b/macros/latex/contrib/flippdf/flippdf.ins
index b8f327f0b5..b48705a2f8 100644
--- a/macros/latex/contrib/flippdf/flippdf.ins
+++ b/macros/latex/contrib/flippdf/flippdf.ins
@@ -58,6 +58,12 @@ necessarily be in the same archive or directory.)
\Msg{*** Generating the LaTeX2e package files ***}
\usedir{tex/latex/flippdf}
\generate{\file{flippdf.sty}{\from{flippdf.dtx}{flippdf}}}
+\generate{\file{flippdf-1x.sty}{\from{flippdf.dtx}{flippdf-1x}}}
+
+\preamble
+\endpreamble
+
+\Msg{*** Generating the LaTeX2e test/example files ***}
\usedir{doc/latex/flippdf/examples}
\generate{\file{test-flippdf-1}{\from{flippdf.dtx}{test-1}}}
\generate{\file{test-flippdf-2}{\from{flippdf.dtx}{test-2}}}
diff --git a/macros/latex/contrib/flippdf/flippdf.pdf b/macros/latex/contrib/flippdf/flippdf.pdf
index bfa6b881fa..b60a4b1414 100644
--- a/macros/latex/contrib/flippdf/flippdf.pdf
+++ b/macros/latex/contrib/flippdf/flippdf.pdf
Binary files differ