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
|
\documentclass{article}
\usepackage{keyreader}
\usepackage{xcolor}
\usepackage{graphicx}
\makeatletter
\newdimen\shadowsize
\krddefinekeys*[KV]{ebox}[mp@]{%
bool/frame/true;
bool/shadow/true;
cmd/framecolor/black;
cmd/shadecolor/white;
cmd/shadowcolor/gray;
cmd/framesize/.4pt;
cmd/boxsize/.1\columnwidth;
cmd/shadowsize/1pt;
choice/align/center/
center.do=\let\mp@alignright\hfil\let\mp@alignleft\hfil,
right.do=\let\mp@alignright\hfill\let\mp@alignleft\relax,
left.do=\let\mp@alignright\relax\let\mp@alignleft\hfill,
justified.do=\let\mp@alignright\relax\let\mp@alignleft\relax
//\@@warning{Invalid value for 'align'};
}
\savevaluekeys[KV]{ebox}{frame,framecolor,framesize}
\krdpresetkeys[KV]{ebox}{%
frame,framecolor=black,shadecolor=white,framesize=0.5pt,boxsize,align
}
\krdpostsetkeys[KV]{ebox}{%
shadow=\usevalue{frame},shadowcolor=\usevalue{framecolor}!40,
shadowsize=\usevalue{framesize}*4
}
\newcommand*\ebox[2][]{%
\krdsetkeys[KV]{ebox}{#1}%
\begingroup
\ifmp@frame
\fboxrule=\dimexpr\mp@framesize\relax
\else
\fboxrule=0pt
\fi
\ifmp@shadow
\shadowsize=\dimexpr\mp@shadowsize\relax
\else
\shadowsize=0pt
\fi
\setbox0=\hbox{%
\fcolorbox{\mp@framecolor}{\mp@shadecolor}{%
\hbox to\mp@boxsize{%
\mp@alignright #2\mp@alignleft
}%
}%
}%
\hskip\shadowsize
\color{\mp@shadowcolor}%
\rule[-\dp0]{\wd0}{\the\dimexpr\ht0+\dp0\relax}%
\llap{\raisebox{\shadowsize}{\box0\hskip\shadowsize}}%
\endgroup
}
\makeatother
\begin{document}
\parindent-60pt
\scalebox{2}{%
\ebox[shadecolor=brown!70]{ebox1}%
\ebox[framecolor=magenta,boxsize=2cm,align=right]{ebox2}%
\ebox[shadow=false,framesize=1pt,framecolor=red,boxsize=1.5cm,align=left]{ebox3}%
\ebox[framesize=1pt,framecolor=green,shadowcolor=blue]{ebox4}%
\ebox[frame=false,shadow,shadowcolor=yellow,framesize=.5pt]{ebox5}%
}
\end{document}
|