summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/turnthepage/turnthepage.forlisting
blob: 244828145a5d41e0de72ba22ad3927199454a3f5 (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
%% This is file `turnthepage.sty' v1.0 by Merciadri Luca.
% Thanks to Marc van Dongen for his help.

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{turnthepage}[2011/01/01 Indicating to turn the page]
\PackageInfo{turnthepage}{This is turnthepage.}
\RequirePackage{atbegshi}
\RequirePackage{refcount}
\RequirePackage{picture}
\RequirePackage{lastpage}

\DeclareOption{short}{%
\providecommand{\turnthepage}{/\ldots}
}

\DeclareOption{long}{%
\providecommand{\turnthepage}{\textit{Turn the page.}}
}

\AtBeginShipout{%
\AtBeginShipoutUpperLeft{%
    \ifodd\thepage%
    \ifnum\getpagerefnumber{LastPage}>\thepage%
        \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%
}}

\ProcessOptions
\relax