I am trying to add some shading to a title by modifying code presented in Drop shadow for text in PGF/Beamer
Consider the MWE
\documentclass{article}
\usepackage{tikz}
\usepackage{xcolor}
\newcommand\titleshading[3]{
\newcommand\xoffset{0.3}
\newcommand\yoffset{-0.25}
% Blur
\foreach \x in {-0.1,0.1} {
\foreach \y in {-0.1,0.1} {
\node[blue!65!white] at (#1em+\xoffset em+\x em,#2em+\yoffset em+\y em) {
\scalebox{2}{\Huge\texttt{#3}}
};
}
}
% Main Shadow
\node[blue!40!white] at (#1em+0.3em,#2em-0.2em) {
\scalebox{2}{\Huge\texttt{#3}}
};
\node at (#1em,#2em) {
\scalebox{2}{\Huge\texttt{#3}}
};
}
\begin{document}
\begin{tikzpicture}[remember picture,overlay]
\titleshading{8}{0}{Book Title}
% \titleshading{8}{0}{\textcolor{red}{Book Title}}
\end{tikzpicture}
\end{document}
which produces the output
Furthermore, I would like to change the color of the black text in the title to say, red.
However, when I replace \titleshading{8}{0}{Book Title}
by \titleshading{8}{0}{\textcolor{red}{Book Title}}
, everything becomes red:
QUESTION: How may I specify color of the text in the title to be red, while maintaining the light blue shading? Also, if anyone knows of a simpler way to produce this title, I would appreciate being made aware of it.
Thank you.
Best Answer
The third parameter of the macro
\titleshading
is used for both the main text and the shading; if you color the text there, you'll change it everywhere.Change only the color of the main text in the macro:
A simpler way to do a similar thing may be using the package
shadowtext
, you do not need to load TikZ here: