-
Notifications
You must be signed in to change notification settings - Fork 167
/
Copy pathmyfullwidth.def
53 lines (38 loc) · 1.75 KB
/
myfullwidth.def
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
%%
% Compute lengths used for full-width displays
\newlength{\overhang}% used by the fullwidth environment and the running heads
\newlength{\fullwidth}
\newlength{\caption@fill}
\newcommand{\TufteRecalculate}{%
\setlength{\overhang}{\marginparwidth}
\addtolength{\overhang}{\marginparsep}
\setlength{\fullwidth}{\textwidth}
\addtolength{\fullwidth}{\marginparsep}
\addtolength{\fullwidth}{\marginparwidth}
\setlength{\caption@fill}{\textwidth}
\addtolength{\caption@fill}{\marginparsep}
}
\AtBeginDocument{\TufteRecalculate}
\newcommand{\@float@fullwidth}[3][0pt]{%
\ifthenelse{\equal{\floatalignment}{b}}%
{% place caption above figure
\ifthenelse{\NOT\boolean{@symmetric}\OR\boolean{@float@recto}}%
{\hfill\smash{\raisebox{#1}{\usebox{#3}}}\par\usebox{#2}\@float@debug{Caption position: [above right]}}% caption on the right
{\smash{\raisebox{#1}{\usebox{#3}}}\hfill\par\usebox{#2}\@float@debug{Caption position: [above left]}}% caption on the left
}{% place caption below figure
\ifthenelse{\NOT\boolean{@symmetric}\OR\boolean{@float@recto}}%
{\usebox{#2}\par\hfill\smash{\raisebox{#1}{\usebox{#3}}}\@float@debug{Caption position: [below right]}}% caption on the right
{\usebox{#2}\par\smash{\raisebox{#1}{\usebox{#3}}}\hfill\@float@debug{Caption position: [below left]}}% caption on the left
}%
}
%%
% Full-page-width area
\newenvironment{fullwidth}
{\ifthenelse{\boolean{@symmetric}}%
{\ifthenelse{\boolean{@changepage}}{\begin{adjustwidth*}{}{-\@overhang}}{\begin{adjustwidth}[]{}{-\@overhang}}}%
{\begin{adjustwidth}{}{-\@overhang}}%
}%
{\ifthenelse{\boolean{@symmetric}}%
{\ifthenelse{\boolean{@changepage}}{\end{adjustwidth*}}{\end{adjustwidth}}}%
{\end{adjustwidth}}%
}