blob: 0095e1c53fc9241d6b87ad69c52d7e5442727513 (
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
|
%%
%% This is file `mcaption.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% mcaption.dtx (with options: `package')
%%
%% This is a generated file.
%%
%% Copyright (C) 2005 by Stephan Hennig <stephanhennig@arcor.de>
%%
%% This file may be distributed and/or modified under the conditions of
%% the LaTeX Project Public License, either version 1.2 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.2 or later is part of all distributions of LaTeX version
%% 1999/12/01 or later.
%%
\ProvidesPackage{mcaption}
[2005/09/30 v2.2 Put captions in margin (SH)]
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\RequirePackage{ifthen}
\RequirePackage{chngpage}
\newcommand*{\margincapalign}{}
\DeclareOption{top}{\renewcommand*{\margincapalign}{t}}
\DeclareOption{bottom}{\renewcommand*{\margincapalign}{b}}
\ExecuteOptions{bottom}
\ProcessOptions\relax
\newlength{\margincapsep}
\AtBeginDocument{%
\setlength{\margincapsep}{\marginparsep}%
}
\newsavebox{\mcaption@ObjectBox}
\newsavebox{\mcaption@CaptionBox}
\newlength{\mcaption@ObjectHeight}
\newlength{\mcaption@ObjectRaise}
\newlength{\mcaption@CaptionRaise}
\newlength{\mcaption@tempdima}
\newenvironment{margincap}[2][\mcaption@DefaultOpt]{%
\def\mcaption@DefaultOpt{#2}%
\begin{lrbox}{\mcaption@CaptionBox}%
\setlength{\mcaption@tempdima}{\marginparsep}%
\addtolength{\mcaption@tempdima}{\marginparwidth}%
\addtolength{\mcaption@tempdima}{-\margincapsep}%
\begin{minipage}[\margincapalign]{\mcaption@tempdima}%
\caption[#1]{#2}%
\end{minipage}%
\end{lrbox}%
\begin{lrbox}{\mcaption@ObjectBox}%
\begin{minipage}[\margincapalign]{\linewidth}%
}{%
\end{minipage}%
\end{lrbox}%
\settoheight{\mcaption@ObjectHeight}{\usebox{\mcaption@ObjectBox}}%
\ifthenelse{\equal{\margincapalign}{t}}{%
\setlength{\mcaption@ObjectRaise}{-\mcaption@ObjectHeight}%
\setlength{\mcaption@ObjectHeight}{0pt}%
\settoheight{\mcaption@CaptionRaise}{\strut}%
}{%
\setlength{\mcaption@ObjectRaise}{0pt}%
\setlength{\mcaption@CaptionRaise}{0pt}%
}%
\if@twoside%
\checkoddpage%
\else%
\cpoddpagetrue%
\fi%
\ifcpoddpage%
\makebox[\linewidth][l]{%
\raisebox{\mcaption@ObjectRaise}[\mcaption@ObjectHeight]{%
\usebox{\mcaption@ObjectBox}%
}%
\hspace*{\margincapsep}%
\raisebox{\mcaption@CaptionRaise}[0pt][0pt]{%
\usebox{\mcaption@CaptionBox}%
}%
}%
\else%
\makebox[\linewidth][r]{%
\raisebox{\mcaption@CaptionRaise}[0pt][0pt]{%
\usebox{\mcaption@CaptionBox}%
}%
\hspace*{\margincapsep}%
\raisebox{\mcaption@ObjectRaise}[\mcaption@ObjectHeight]{%
\usebox{\mcaption@ObjectBox}%
}%
}%
\fi%
}%
\endinput
%%
%% End of file `mcaption.sty'.
|