summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/flippdf/flippdf.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'macros/latex/contrib/flippdf/flippdf.dtx')
-rw-r--r--macros/latex/contrib/flippdf/flippdf.dtx92
1 files changed, 62 insertions, 30 deletions
diff --git a/macros/latex/contrib/flippdf/flippdf.dtx b/macros/latex/contrib/flippdf/flippdf.dtx
index cc775ee113..e329d4f2a2 100644
--- a/macros/latex/contrib/flippdf/flippdf.dtx
+++ b/macros/latex/contrib/flippdf/flippdf.dtx
@@ -8,14 +8,16 @@
% a contribution to the LaTeX2e system.
% ---------------------------------------------
%
-% It may be distributed and/or modified under the conditions of the
-% LaTeX Project Public License, version 1.3c of this licence.
-% This license is at http://www.latex-project.org/lppl.txt and is part
-% of all distributions of LaTeX version 2003/06/01 or later.
-%
-% This work has the LPPL maintenance status "author-maintained".
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, version 1.3c.
+% This license is in
+% https://www.latex-project.org/lppl/lppl-1-3c/
+% and is part of all distributions of LaTeX later than
+% 2008-05-04.
+%
+% This work has the LPPL maintenance status "maintained".
%
-% This program consists of the files listed in the README file
+% This program consists of the files listed in the README.md file
% included in the package.
%
%<*driver>
@@ -38,18 +40,19 @@
% \DoNotIndex{\NeedsTeXFormat, \documentclass}
% \DoNotIndex{\begin, \end}
% \DoNotIndex{\def, \gdef, \let, \newcommand}
-% \DoNotIndex{\ProvidesPackage, \RequirePackage, \usepackage}
+% \DoNotIndex{\ProvidesPackage, \RequirePackage, \usepackage, \PackageError}
% \DoNotIndex{\DeclareOption, \ProcessOptions}
-% \DoNotIndex{\ifx, \fi, \newif}
+% \DoNotIndex{\ifx, \fi, \newif, \else}
% \DoNotIndex{\paperwidth, \space, \strip@pt}
% \DoNotIndex{\maketitle, \title, \lipsum}
+% \DoNotIndex{\thispagestyle, \relax, \setcounter, \Large, \clearpage, \bigskip}
%
-% \CheckSum{22}
+% \CheckSum{40}
%
% \def\filename{flippdf.dtx}
-% \def\fileversion{1.0b}
-% \def\filedate{2020/10/11}
-% \def\docdate{2020/10/11}
+% \def\fileversion{1.1}
+% \def\filedate{2020/10/17}
+% \def\docdate{2020/10/17}
%
% \newcommand*{\Lpack}[1]{\textsf {#1}} ^^A typeset a package
% \newcommand*{\Lopt}[1]{\textsf {#1}} ^^A typeset an option
@@ -71,14 +74,15 @@
% \maketitle
%
% \begin{abstract}
-% The \Lpack{pdfflip} package extends \hologo{pdfLaTeX} making it
-% possible to typeset a ``mirrored'' version of the document. This is
-% sometimes required by publishers who use photographic printing
-% processes that need ``camera-ready'' documents to be printable on
-% transparent films, so that one reads the pages correctly by looking
-% \emph{through} the film with the \emph{unprinted} side of the film
-% towards his eyes. This package requires \Lpack{everypage} by the same
-% author and works with \hologo{pdfLaTeX} only.
+% The \Lpack{pdfflip} package extends \hologo{pdfLaTeX} and
+% \hologo{LuaLaTeX} making it possible to typeset a ``mirrored'' version
+% of the document. This is sometimes required by publishers who use
+% photographic printing processes that need ``camera-ready'' documents
+% to be printable on transparent films, so that one reads the pages
+% correctly by looking \emph{through} the film with the \emph{unprinted}
+% side of the film towards his eyes. This package requires
+% \Lpack{everypage} by the same author and works exclusively with
+% \hologo{pdfLaTeX} and \hologo{LuaLaTeX} in PDF output mode.
% \end{abstract}
%
% \section{Introduction}
@@ -94,7 +98,8 @@
% by page basis.
%
% This package requires \Lpack{everypage} by the same author and works
-% with \hologo{pdfLaTeX} only.
+% exclusively with \hologo{pdfLaTeX} and \hologo{LuaLaTeX} in PDF output
+% mode.
%
% \section{User interface}
% By default, once loaded as:
@@ -185,22 +190,35 @@
%<*flippdf>
% \fi
% Announce the name and version of the package, that requires
-% \hologo{LaTeX2e} (actually \hologo{pdfLaTeX}).
+% \hologo{LaTeX2e} (actually \hologo{pdfLaTeX} or \hologo{LuaLaTeX}).
% \changes{R1.0b}{2020/10/11}{%
% Require \Lpack{everypage} package to be at least at its 2007/06/20 (R1.1)
% release.}
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{flippdf}%
- [2020/10/11 1.0b Horizontal flipping of pages with pdfLaTeX]
+ [2020/10/17 1.1 Horizontal flipping of pages with pdfLaTeX]
% \end{macrocode}
%
% Assure that the dependence on \Lpack{everypage} is satisfied.
% \begin{macrocode}
\RequirePackage{everypage}[2007/06/20]
% \end{macrocode}
-% \begin{macro}{\if@sc@flippdf}
%
+% Depend on \Lpack{iftex} and error out if not working in PDF mode
+% \changes{R1.1}{2020/10/17}{Error out if output mode is not PDF.}%
+% \begin{macrocode}
+\RequirePackage{iftex}
+\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}
@@ -229,12 +247,26 @@
% \end{macrocode}
%
% And eventually, tell \LaTeX\ to flip every page, by using the
-% \Lpack{everypage} hook:
+% \Lpack{everypage} hook. First consider the case when running in
+% \hologo{pdfLaTeX}
% \begin{macrocode}
-\AddEverypageHook{%
- \if@sc@flippdf
- \pdfliteral direct {-1 0 0 1 \strip@pt\paperwidth\space 0 cm}
- \fi}
+\ifpdftex
+ \AddEverypageHook{%
+ \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
+ \AddEverypageHook{%
+ \if@sc@flippdf
+ \pdfextension literal direct {-1 0 0 1 \strip@pt\paperwidth\space 0 cm}%
+ \fi}%
+\fi
% \end{macrocode}
% \iffalse
%</flippdf>