summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/photo/photo.sty
blob: 0a3b28fc43635cf318a147fad58e2d1113a1742d (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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
%%
%% This is file `photo.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% photo.dtx  (with options: `package')
%% 
%% File: photo.dtx Copyright 1994 1998 1999 Volker Kuhlmann
%% All rights are reserved.
%%
\NeedsTeXFormat{LaTeX2e}[1998/06/01]
\ProvidesPackage{photo}
       [2004/07/15 v2.1f Placing photos in documents (VK)]
%%
%% \CharacterTable
%%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%%   Digits        \0\1\2\3\4\5\6\7\8\9
%%   Exclamation   \!     Double quote  \"     Hash (number) \#
%%   Dollar        \$     Percent       \%     Ampersand     \&
%%   Acute accent  \'     Left paren    \(     Right paren   \)
%%   Asterisk      \*     Plus          \+     Comma         \,
%%   Minus         \-     Point         \.     Solidus       \/
%%   Colon         \:     Semicolon     \;     Less than     \<
%%   Equals        \=     Greater than  \>     Question mark \?
%%   Commercial at \@     Left bracket  \[     Backslash     \\
%%   Right bracket \]     Circumflex    \^     Underscore    \_
%%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%%   Right brace   \}     Tilde         \~}
%%
\DeclareOption{shortlop}{\newcommand\lop@parskip{\parskip 0ex plus0.03ex}}
\DeclareOption{left}{\def\@OEPOSdflt{l}}
\DeclareOption{right}{\def\@OEPOSdflt{r}}
\DeclareOption{in}{\def\@OEPOSdflt{i}}
\DeclareOption{out}{\def\@OEPOSdflt{o}}
\DeclareOption{top}{\def\@CPOSdflt{t}}
\DeclareOption{center}{\def\@CPOSdflt{c}}
\DeclareOption{bottom}{\def\@CPOSdflt{b}}
\DeclareOption{under}{\def\@PPOSdflt{u}}
\DeclareOption{side}{\def\@PPOSdflt{s}}
\ExecuteOptions{out,center,under}
\ProcessOptions
\newcount\oe@labcnt
\newcommand\ifoddpage[3][]{%
\edef\ifoddpagelabel{#1}%
\ifx\ifoddpagelabel\empty
\global\advance\oe@labcnt 1%
\edef\ifoddpagelabel{oelbl@\romannumeral\oe@labcnt}%
\label\ifoddpagelabel
\fi
\ifodd0\page@ref@@\def\oe@temp{#2}\else\def\oe@temp{#3}\fi
\oe@temp
}
\newcommand\page@ref@@{\expandafter\expandafter\expandafter
\@secondoftwo\csname r@\ifoddpagelabel\endcsname}
\newcommand\boxbaset{\raisebox{-\height}}
\newcommand\boxbaseb{\raisebox{\depth}}
\newcommand\boxbasec[1]{\raisebox{-0.5\totalheight}{\boxbaseb{#1}}}
\newcounter{photo}
\renewcommand\thephoto{\@arabic\c@photo}
\newcommand\photoname{Photo}
\newcommand\listphotoname{List of Photos}
\def\fps@photo{tbp}
\def\ftype@photo{4}
\def\ext@photo{lop}
\def\fnum@photo{\photoname~\thephoto}
\newcommand\defaultphotoplacement[1]{\def\fps@photo{#1}}
\newenvironment{photo}%
               {\@float{photo}}%
               {\end@float}
\newenvironment{photo*}%
               {\@dblfloat{photo}}%
               {\end@dblfloat}
\newcommand\listofphotos{%
\begingroup
\csname lop@parskip\endcsname
\@ifundefined{chapter}{\section}{\chapter}*{\listphotoname
      \@mkboth{\MakeUppercase\listphotoname}%
              {\MakeUppercase\listphotoname}}%
    \@starttoc{\ext@photo}%
\endgroup
    }
\newcommand*\l@photo{\@dottedtocline{1}{1.5em}{2.3em}}
\newdimen\oecaptionsep
\newdimen\minoecaptionwidth
\newbox\oe@box
\oecaptionsep 10mm
\minoecaptionwidth 35mm
\newcommand\photographerfont{\tiny\sffamily}
\newcommand\putphoto[4][\@OEPOSdflt\@CPOSdflt\@PPOSdflt]{%
\par
\begingroup
\edef\@OEPOS{#1}\edef\@LAB{#2}\def\@PGR{#3}%
\setbox\oe@box\hbox{#4}%
\putphoto@ii
}
\newcommand*\putphoto@ii[2][]{%
\def\@TCAP{#1}\def\@CAP{#2}%
\def\@captype{photo}% make (photo-)\caption available outside float
\def\cap@width{\dimen0}% shortcut - w/o introducing a new variable
\def\@CPOS{\@CPOSdflt}\def\@PPOS{\@PPOSdflt}%
\def\@tempb{\@tfor\@tempa:=}%
\expandafter\@tempb\@OEPOS\do{%
  %\typeout{loop: \@tempa}
  \if l\@tempa \def\@OEPOS{l}\else
  \if r\@tempa \def\@OEPOS{r}\else
  \if i\@tempa \ifx\@PGR\empty\else
\ifoddpage[\@LAB]{\def\@OEPOS{l}}{\def\@OEPOS{r}}\fi\else
  \if o\@tempa \ifx\@PGR\empty\else
\ifoddpage[\@LAB]{\def\@OEPOS{r}}{\def\@OEPOS{l}}\fi\else
  \if u\@tempa \def\@PPOS{u}\else
  \if s\@tempa \def\@PPOS{s}\else
  \if t\@tempa \def\@CPOS{t}\else
  \if c\@tempa \def\@CPOS{c}\else
  \if b\@tempa \def\@CPOS{b}\else
  \PackageError{photo}{illegal pos: \@tempa}{}%
  \fi\fi\fi\fi\fi\fi\fi\fi\fi}%
\cap@width\columnwidth
\advance\cap@width-\wd\oe@box \advance\cap@width-\oecaptionsep
\ifdim\minoecaptionwidth>\cap@width\photo@ucap\else\photo@scap\fi
\endgroup
}
\newcommand\photo@ucap{%
\begingroup
\centering\parbox{\wd\oe@box}{%
\leavevmode\box\oe@box
\ifx\@PGR\empty\else
  \newline\photographerfont
  \if r\@OEPOS \raggedleft \fi
  \@PGR
\fi
}\par
\endgroup
\photo@caption
}
\newcommand\photo@scap{%
\abovecaptionskip\z@
\belowcaptionskip\z@
\leavevmode
\ifx\@PGR\empty\else\if s\@PPOS \if r\@OEPOS
  \rlap{\boxbaseb{\parbox{\cap@width}{%
    \photographerfont\raggedleft\@PGR}}}\fi\fi\fi
\boxbaseb{%
  \if l\@OEPOS
    \photo@lift{\wd\oe@box}{\box\oe@box}\hskip\oecaptionsep
      \photo@lift\cap@width\photo@caption
  \else
    \photo@lift\cap@width\photo@caption\hskip\oecaptionsep
      \photo@lift{\wd\oe@box}{\box\oe@box}%
  \fi
}%
\ifx\@PGR\empty\else
  \if u\@PPOS
    \newline\photographerfont\if r\@OEPOS \raggedleft \fi\@PGR
  \else\if l\@OEPOS
      \llap{\boxbaseb{\parbox{\cap@width}{\photographerfont\@PGR}}}\fi
  \fi
\fi
\par
}
\newcommand\photo@lift[2]{%
\csname boxbase\@CPOS\endcsname{\parbox{#1}{#2}}%
}
\newcommand\photo@caption{%
\ifx\@CAP\empty\else
\ifx\@TCAP\empty
\caption{\@CAP}\else
\caption[\@TCAP]{\@CAP}\fi
\ifx\@LAB\empty\else\label\@LAB\fi
\fi
}
\newenvironment{Photo}[3][\@OEPOSdflt\@CPOSdflt\@PPOSdflt]{%
\par
\begingroup
\edef\@OEPOS{#1}\edef\@LAB{#2}\def\@PGR{#3}%
\@dblarg\Photo@ii
}{%
\end{lrbox}%
\def\@@t{photo}%
\if@twocolumn\ifdim\wd\oe@box>\columnwidth
\def\@@t{photo*}\columnwidth\textwidth
\fi\fi
\expandafter\begin\expandafter{\@@t}%
\begingroup
\putphoto@ii[\@TCAPf]\@CAPf
\expandafter\end\expandafter{\@@t}%
\endgroup
}
\newcommand\Photo@ii[2][]{%
\def\@TCAPf{#1}\def\@CAPf{#2}%
\begin{lrbox}\oe@box
}
\newcommand\phref[1]{photo~\ref{#1}}
\newcommand\Phref[1]{\photoname~\ref{#1}}
\endinput
%%
%% End of file `photo.sty'.