summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/overpic/overpic.sty
blob: 7be39328b51eff747dc6c26edc1815091b235533 (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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
%%
%% This is file `overpic.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% overpic.dtx  (with options: `package')
%% 
%% This is a generated file.
%% 
%% Copyright (C) 1997-2016 by Rolf Niepraschk <Rolf.Niepraschk@gmx.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.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%% 
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesPackage{overpic}[2017/10/06 1.0 picture overlays]
\RequirePackage{graphicx,epic}
\newcommand*\OVP@scale{\z@}
\define@key{Gin}{rel}{%
  \def\OVP@scale{#1}%
  \ifnum\OVP@scale>\z@
    \let\OVP@calc\OVP@calc@rel
  \else
    \PackageError{overpic}{Invalid number for option `rel'}\@ehc
  \fi
}
\define@key{Gin}{percent}[]{%
  \setkeys{Gin}{rel=100}%
}
\define@key{Gin}{permil}[]{%
  \setkeys{Gin}{rel=\@m}%
}
\define@key{Gin}{abs}[]{%
  \let\OVP@calc\OVP@calc@abs
}
\newif\ifGin@grid
\define@key{Gin}{grid}[true]{\lowercase{\Gin@boolkey{#1}}{grid}}
\define@key{Gin}{tics}{\count@=#1}
\define@key{Gin}{unit}{\unitlength=\dimexpr#1\relax}
\newcommand*\OVP@calc@abs{%
  \divide\@tempcnta by \unitlength
  \divide\@tempcntb by \unitlength
  \ifnum\count@=\z@\count@=10\fi
}
\newcommand*\OVP@calc@rel{%
  \ifnum\@tempcnta>\@tempcntb
    \divide\@tempcnta by \OVP@scale
    \unitlength=\@tempcnta sp %
    \@tempcnta=\OVP@scale
    \divide\@tempcntb by \unitlength
  \else
    \divide\@tempcntb by \OVP@scale
    \unitlength=\@tempcntb sp %
    \@tempcntb=\OVP@scale
    \divide\@tempcnta by \unitlength
  \fi
  \ifnum\count@=\z@
    \count@=\OVP@scale
    \divide\count@ by 10 %
  \fi
}
\DeclareOption{percent}{\setkeys{Gin}{rel=100}}
\DeclareOption{permil}{\setkeys{Gin}{rel=\@m}}
\DeclareOption{abs}{\setkeys{Gin}{abs}}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{graphicx}}
\ExecuteOptions{percent}
\ProcessOptions
\newenvironment{overpic}[2][]{%
  \sbox\z@{\includegraphics[#1]{#2}}%
  \let\Gin@outer@scalex\relax
  \let\Gin@outer@scaley\relax
  \let\Gin@angle\relax
  \let\Gin@ewidth\Gin@exclamation
  \let\Gin@eheight\Gin@ewidth
  \def\Gin@scalex{1}%
  \let\Gin@scaley\Gin@exclamation
  \OVP@picture{#1}%
}{\endpicture}
\newenvironment{Overpic}[2][]{%
  \sbox\z@{#2}%
  \OVP@picture{#1}%
}{\endpicture}
\newcommand*\OVP@picture[1]{%
  \settodepth{\@tempcnta}{\usebox\z@}%
  \settoheight{\@tempcntb}{\usebox\z@}%
  \advance\@tempcntb\@tempcnta
  \settowidth{\@tempcnta}{\usebox\z@}%
  \count@=\z@ \Gin@gridfalse
  \setkeys{Gin}{#1}%
  \OVP@calc
  \picture(\@tempcnta,\@tempcntb)%
    \put(0,0){\makebox(0,0)[bl]{\usebox\z@}}%
    \ifGin@grid
      \put(0,0){\normalfont\fontsize\@viipt\@viiipt\selectfont
        \grid(\@tempcnta,\@tempcntb)(\count@,\count@)[0,0]}%
    \fi
}
\newcommand*\setOverpic[1]{%
  \setkeys{Gin}{#1}%
}
\endinput
%%
%% End of file `overpic.sty'.