summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/turnthepage/turnpagewoetex.sty
blob: 779f6c0139a3e62dbe667014c2c64349d353b4d5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
% This is file `turnpagewoetex.sty' v1.3a by Merciadri Luca.
% Thanks to Marc van Dongen and Martin Muench for their help.

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{turnpagewoetex}[2011/03/24 1.3a
            Indicating to turn the page (LM)]

\PackageInfo{turnpagewoetex}{This is turnthepage without using e-TeX.}

\RequirePackage{atbegshi}
\RequirePackage{picture}
\RequirePackage{alphalph}
\RequirePackage{pageslts}

\ifx\turnthepage\undefined
 \DeclareOption{short}{\providecommand{\turnthepage}{/\ldots}}
 \DeclareOption{english}{\providecommand{\turnthepage}{\textit{Turn the page.}}}
 \DeclareOption{francais}{\providecommand{\turnthepage}{\textit{Tournez la page.}}}
 \DeclareOption{nederlands}{\providecommand{\turnthepage}{\textit{Sla de pagina om.}}}
 \DeclareOption{deutsch}{\providecommand{\turnthepage}{\textit{Bitte wenden.}}}
\else
 \newcommand{\turnp@agewarn}{%
   \PackageWarning{turnpageetex}{Command turnthepage was already defined.\MessageBreak%
     Now redefining it.}}
 \DeclareOption{short}{\turnp@agewarn \renewcommand{\turnthepage}{/\ldots}}
 \DeclareOption{english}{\turnp@agewarn \renewcommand{\turnthepage}{\textit{Turn the page.}}}
 \DeclareOption{francais}{\turnp@agewarn \renewcommand{\turnthepage}{\textit{Tournez la page.}}}
 \DeclareOption{nederlands}{\turnp@agewarn \renewcommand{\turnthepage}{\textit{Sla de pagina om.}}}
 \DeclareOption{deutsch}{\turnp@agewarn \renewcommand{\turnthepage}{\textit{Bitte wenden.}}}
\fi

\ProcessOptions

\ifx\turnthepage\undefined
 \providecommand{\turnthepage}{ }
 \PackageWarning{turnpagewoetex}{No option for package turnthepage\MessageBreak%
   (or turnpagewoetex) choosen!\MessageBreak%
   There will be no information regarding\MessageBreak%
   the need to turn the page!\MessageBreak%
   }
\fi

\AtBeginShipout{%
\AtBeginShipoutUpperLeft{%
     \ifodd\value{CurrentPage}
       % The \value{CurrentPage} is already 1 higher than the current page number here.
     \else
      \ifnum\value{pagesLTS.pagenr}>\value{CurrentPage}
        \dimen1=1in
        \advance\dimen1 by \textwidth
        \advance\dimen1 by \oddsidemargin
        \dimen3=1in
        \advance\dimen3 by \topmargin
        \advance\dimen3 by \headheight
        \advance\dimen3 by \headsep
        \advance\dimen3 by \textheight
        \advance\dimen3 by \footskip
        \put(\dimen1,-\dimen3){\llap{\turnthepage}}%
      \fi%
     \fi%
}}