# Drop shadow for text in PGF/Beamer

I want to really put an emphasis on some central piece of text I'm using in a Beamer slide. I'm using tikz and overlay to put it, enlarged, on the center of the page, using the following code:

\begin{tikzpicture}[remember picture,overlay]
\node[at=(current page.center)] {
\scalebox{2}{\Huge\texttt{{This is important!}}}
};
\end{tikzpicture}


Can I add a drop shadow to the letter themselves, so they would look even more emphasized? Is there some other decoration that can be added to the text itself, like a glow, etc.? Or does PGF ignores node text altogether? The text should be in typewriter style, so using special fancy fonts is probably not the solution.

-

This is a terrible hack, and doesn't really fit your situation exactly, but I'm new to TeX and TikZ. Just an idea to get the ball rolling.

\documentclass{article}
\usepackage{tikz}

\newcommand\importantstuff[3]{
\node[black!30!white] at (#1+0.1,#2-0.1) {
\scalebox{2}{\Huge\texttt{#3}}
};
\node at (#1,#2) {
\scalebox{2}{\Huge\texttt{#3}}
};
}

\begin{document}
\begin{tikzpicture}[remember picture,overlay]
\importantstuff{4}{0}{This is important!}
\end{tikzpicture}
\end{document}


Edit: Marc van Dongen correctly pointed out I should use font-dependent offsets. And since I was fiddling with the code anyway, I tried blurring the shadow, hillbilly style.

\newcommand\importantstuff[3]{
\newcommand\xoffset{0.3}
\newcommand\yoffset{-0.2}
% Blur
\foreach \x in {-0.1,0.1} {
\foreach \y in {-0.1,0.1} {
\node[black!20!white] at (#1em+\xoffset em+\x em,#2em+\yoffset em+\y em) {
\scalebox{2}{\Huge\texttt{#3}}
};
}
}

\node[black!40!white] at (#1em+0.3em,#2em-0.2em) {
\scalebox{2}{\Huge\texttt{#3}}
};
\node at (#1em,#2em) {
\scalebox{2}{\Huge\texttt{#3}}
};
}


-
Looks pretty good to me. –  Loop Space Jan 12 '12 at 10:22
@Andrew Stacey Thanks, but I thought there may be a possibility to do something like \node[important] {This is important}. Also, I don't really know how to deal with current page.center. –  Psirus Jan 12 '12 at 12:32
It's a hack, but it works. You can deal with current page by using the positioning library instead of at absolute positioning. –  Little Bobby Tables Jan 12 '12 at 12:34
@Psirus Oh, it can always be packaged in a simpler way, (just wait until Ryan Reich turns up - then you'll see some pgfkeys magic), but functionally it would be the same as this. –  Loop Space Jan 12 '12 at 13:00
@Psirus You code the offset in terms of centimetres. It would be nice if you did this in a unit that is defined in terms of the type size, e.g., em or ex. That way the shading will also look good when the type size changes. –  Marc van Dongen Jan 12 '12 at 15:12

@Psirus Your solution isn't what I had in mind. The following automatically picks up the current type size. In your solution the node is always \Huge. It's entirely based on your ideas, but I think it's a bit better to work with if you want different type sizes.

\documentclass{article}

\usepackage{tikz}

\newcommand\importantstuff[3]{
\draw[every node/.style={scale=2}]
(#1,#2)            coordinate (text destination)
% Blur
\foreach \x in {-0.025,0.025} {
\foreach \y in {-0.025,0.025} {
+(\x em,\y em) node[black!20!white] {\texttt{#3}}
}
}
(text destination)   node {\texttt{#3}};
}

\begin{document}
\begin{tikzpicture}
\foreach \offset/\size in {0/Huge,1/small,2/normalsize} {
\begin{\size}
\importantstuff{0}{\offset}{This is important}
\end{\size}}
\end{tikzpicture}
\end{document}

-
Yes, I was half-aware of that :-) But I really didn’t know how to implement it. Thanks for showing it. –  Psirus Jan 12 '12 at 16:57

If you really want to emphasize your letters, you could try to produce paths out of the glyphs in your text. Either by converting the text to a path in a tool like inkscape. Or you ask Andrew Stacey for his TikZ-path version of the STIX fonts.

Then you can use pgf-blur to add a pretty shadow:

But there's no way this will work directly with text typeset by TeX.

-