blob: ab2bf74851d75bb0e9db7b8ff154016e8839ee88 (
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
|
% draftfigure --%
% modifying drafted figures
% Copyright (c) 2017 Lukas C. Bossert
%
% 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.
\def\df@date{2017/07/19}
\def\df@version{0.2}
\def\df@styid{\df@date\space v\df@version\space draftfigure (LCB)}
\let\dfdate\df@date
\let\dfversion\df@version
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesPackage{draftfigure}[\df@styid]
\RequirePackage{graphicx}
\RequirePackage{etoolbox}
\RequirePackage{xkeyval}
\RequirePackage{calc}
\newbool{df@filename}
\newbool{df@content}
\newbool{df@noframe}
\newlength\df@height
\newlength\df@length
\providecommand*\df@size{}
\providecommand*\df@style{}
\providecommand*\df@font{}
\providecommand*\df@position{}
\providecommand*\df@content{}
\patchcmd{\Gin@setfile}{\expandafter\strip@prefix\meaning\@tempa}{\@draftfigure}{}{}
\providecommand\df@noframe
%% Declare a package option
\DeclareOptionX{content}{\def\df@content{#1}}
\DeclareOptionX{filename}[true]{\csuse{bool#1}{df@filename}
}
\DeclareOptionX{size}[small]{\def\df@size{\csname df@size@#1\endcsname}}
\DeclareOptionX{style}[sf]{\def\df@style{\csname df@style@#1\endcsname}}
\DeclareOptionX{position}[right]{\def\df@position{\csname df@position@#1\endcsname}}
\DeclareOptionX{allfiguresdraft}[true]{\setkeys{Gin}{draft=#1}}
\DeclareOptionX{noframe}[true]{\csuse{bool#1}{df@noframe}
\ifbool{df@noframe}{%
\patchcmd\Gin@setfile{\vrule\hss}{\vrule\@width\z@\hss}{}{}%left
\patchcmd\Gin@setfile{\hss\vrule}{\hss\vrule\@width\z@}{}{}%right
\patchcmd\Gin@setfile{\hrule\@width}{\hrule\@height\z@\@width}{}{}%top
\patchcmd\Gin@setfile{\vss\hrule}{\vss\hrule\@height\z@}{}{}%bottom
}{}}
%% predefined styles
\providecommand\df@style@normal{\normalfont}
\providecommand\df@style@sf{\sffamily}
\providecommand\df@style@sc{\scshape}
\providecommand\df@style@bf{\bfseries}
\providecommand\df@style@it{\itshape}
\providecommand\df@style@tt{\ttfamily}
\providecommand\df@style@rm{\rmfamily}
\providecommand\df@size@tiny{\tiny}
\providecommand\df@size@scriptsize{\scriptsize}
\providecommand\df@size@small{\small}
\providecommand\df@size@footnotesize{\footnotesize}
\providecommand\df@size@normal{\normalsize}
\providecommand\df@size@large{\large}
\providecommand\df@size@Large{\Large}
\providecommand\df@size@Large{\LARGE}
\providecommand\df@size@huge{\huge}
\providecommand\df@position@top{}%% fix me
\providecommand\df@position@center{\centering}
\providecommand\df@position@bottom{}%% fix me
\providecommand\df@position@right{\raggedleft}
\providecommand\df@position@left{\raggedright}
%% Process the options given to the package
\ProcessOptionsX
\define@key{draftfigure}{code}{%
\def\df@style{#1}}
\define@key{draftfigure}{noframe}[true]{%
\csuse{bool#1}{df@noframe}}
\define@key{draftfigure}{filename}[true]{%
\csuse{bool#1}{df@filename}}
\define@key{draftfigure}{content}[]{%
\def\df@content{#1}}
\define@key{draftfigure}{style}[normal]{%
\def\df@style{\csname df@style@#1\endcsname}}
\define@key{draftfigure}{position}[left]{%
\def\df@position{\csname df@position@#1\endcsname}}
\define@key{draftfigure}{size}[normal]{%
\def\df@size{\csname df@size@#1\endcsname}}
\newcommand\setdf[1]{\setkeys{draftfigure}{#1}}
\def\@draftfigure{%
\setlength\df@height{\Gin@nat@height}%
\setlength\df@length{\Gin@req@width}%
\begin{minipage}[c][\df@height-5pt][c]{\df@length-5pt}%
\sffamily%
\df@position%
\df@size%
\df@style%
\df@content%
\ifbool{df@filename}{%
\ifdef{\df@content}%
{\par}%
{}%
\expandafter\strip@prefix\meaning\@tempa}%
{}%
\end{minipage}}%
\endinput
|