summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/shadowtext/shadowtext.sty
blob: a6be4932350353009b87273d1c21185070aca34e (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
%% This is file `shadowtext.sty',
%% Copyright 2012 Yori Zwols
%
% 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.
%
% This work has the LPPL maintenance status `maintained'.
% 
% The Current Maintainer of this work is Y. Zwols.
%
%
% Version history
%  v0.3: - Fixed some errors in the documentation
%        - Colors specified in \shadowcolor should now be specified using 
%          color names, not RGB values. The command for specifying colors 
%          using RGB values has been renamed to \shadowrgb. 
%          (I apologize for the backwards incompatibility).
%        - The base line of the text is now correct.
% 

\NeedsTeXFormat{LaTeX2e}[1996/12/01]
\ProvidesPackage{shadowtext}
  [2012/05/07 v0.3 Shadow Text]
  
\RequirePackage{color}

\makeatletter



\newlength\st@shadowoffsetx
\newlength\st@shadowoffsety

\st@shadowoffsetx=1pt
\st@shadowoffsety=1pt

\newcommand\shadowoffset[1]{\setlength\st@shadowoffsetx{#1}\setlength\st@shadowoffsety{#1}}
\newcommand\shadowoffsetx[1]{\setlength\st@shadowoffsetx{#1}}
\newcommand\shadowoffsety[1]{\setlength\st@shadowoffsety{#1}}
\newcommand\shadowcolor[1]{\def\st@shadowcolor{#1}}
\newcommand\shadowrgb[1]{\definecolor{st@shadowcolorrgb}{rgb}{#1}\shadowcolor{st@shadowcolorrgb}}

\shadowrgb{0.66,0.66,0.66}

\newlength\st@temp@width
\newlength\st@temp@height 
\newlength\st@pic@width
\newlength\st@pic@height

\newcommand\shadowtext[1]%
{%
   \begingroup%
   \settowidth{\st@temp@width}{#1}%
   \settoheight{\st@temp@height}{#1}%
   \setlength{\st@pic@width}{\st@temp@width}%
   \setlength{\st@pic@height}{\st@temp@height}%
   \addtolength{\st@pic@width}{\st@shadowoffsetx}%
   \addtolength{\st@pic@height}{\st@shadowoffsety}%
   %
   \edef\num@tw{\strip@pt\st@temp@width}%
   \edef\num@th{\strip@pt\st@temp@height}%
   \edef\num@pw{\strip@pt\st@pic@width}%
   \edef\num@ph{\strip@pt\st@pic@height}%
   \edef\num@offsetx{\strip@pt\st@shadowoffsetx}%
   \edef\num@offsety{\strip@pt\st@shadowoffsety}%
   \raisebox{-\st@shadowoffsety}{
   \begin{picture}(\num@pw,\num@ph)(0,0)
	    \put(\num@offsetx,0){\makebox(\num@tw,\num@th)[tl]{\color{\st@shadowcolor}\def\color##1{}\ignorespaces #1}}
		\put(0,\num@offsety){\makebox(\num@tw,\num@th)[tl]{\ignorespaces #1}}
	\end{picture}}%
	\endgroup%
	\ignorespaces%
}

\makeatother