summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/overpic/overpic.sty
blob: f3622fd67d8916169115ea73a16155cc6fb0d743 (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

% overpic.sty 

% Copyright  1999 Rolf Niepraschk, niepraschk@ptb.de
% This program can be redistributed and/or modified under the terms
% of the LaTeX Project Public License Distributed from CTAN
% archives in directory macros/latex/base/lppl.txt; either
% version 1 of the License, or any later version. 

%  \changes{v0.51}{1999/03/02}{New (LPPL) license}
%  \changes{v0.52}{1999/07/04}{Correction of wrong height calculation 
%                              (if depth != 0)}


\def\fileversion{v0.52}
\def\filedate{1999/07/04}% 

\ProvidesPackage{overpic}
    [\filedate\space\fileversion\space\space Overwriting eps pictures]  
                  
\NeedsTeXFormat{LaTeX2e}

\typeout{Package: overpic \fileversion\space <\filedate> (RN)}

\newcommand\OVP@scale{}

\DeclareOption{percent}{\renewcommand\OVP@scale{100}}
\DeclareOption{permil}{\renewcommand\OVP@scale{\@m}}
\DeclareOption{abs}{\renewcommand\OVP@scale{\z@}}

\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{graphicx}}

\ExecuteOptions{percent}

\ProcessOptions

\RequirePackage{graphicx,epic}

\newif\ifGin@grid 

\define@key{Gin}{grid}[true]{\lowercase{\Gin@boolkey{#1}}{grid}}
\define@key{Gin}{tics}{\count@=#1}
\define@key{Gin}{unit}{\setlength{\@tempdima}{#1}}

\ifnum\OVP@scale>\z@%
  \ifnum\OVP@scale=\@m%
    \typeout{overpic: relative positioning in permil}% 
  \else%
    \typeout{overpic: relative positioning in percent}% 
  \fi%  
  \newcommand\OVP@calc{%  
    \ifnum\@tempcnta>\@tempcntb%
      \divide\@tempcnta by \OVP@scale%
      \setlength\unitlength{\@tempcnta sp}% 
      \@tempcnta=\OVP@scale%
      \divide\@tempcntb by \unitlength%
    \else%
      \divide\@tempcntb by \OVP@scale%
      \setlength\unitlength{\@tempcntb sp}%  
      \@tempcntb=\OVP@scale%
      \divide\@tempcnta by \unitlength%
    \fi%
    \ifnum\count@=\z@% 
      \count@=\OVP@scale\divide\count@ by 10%
    \fi%
  }%  
\else%           
  \typeout{overpic: absolute positioning in \unitlength}%
  \newcommand\OVP@calc{%
    \setlength{\unitlength}{\@tempdima}%
    \divide\@tempcnta by \unitlength%
    \divide\@tempcntb by \unitlength% 
    \ifnum\count@=\z@\count@=10\fi%  
  }%  
\fi%  
 
\newenvironment{overpic}[2][]{%
  \sbox{\z@}{\includegraphics[#1]{#2}}%
  \settodepth{\@tempcnta}{\usebox{\z@}}%
  \settoheight{\@tempcntb}{\usebox{\z@}}%
  \advance\@tempcntb\@tempcnta%
  \settowidth{\@tempcnta}{\usebox{\z@}}%
  \setlength{\@tempdima}{\unitlength}%
  \count@=\z@\Gin@gridfalse\setkeys{Gin}{#1}% 
%
  \OVP@calc%
%  
  \begin{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%  
}{% 
  \end{picture}%
}% 

\endinput