1

Want to add shadows in the frame title, which can be multiline. Tried a few solutions, none of them worked for me. Any help?

Adding codes from here, MWE:

\documentclass{beamer}

\usepackage{pgfplots, pgfplotstable,stackengine}

\newcommand\shadowfy[1]{\expandafter\shadowfypars#1\par\relax\relax}
\long\def\shadowfypars#1\par#2\relax{%
    \ifx#1\relax\else
    \shadowfywords#1 \relax\relax%
    \fi%
    \ifx\relax#2\else\par\shadowfypars#2\relax\fi%
}
\def\shadowfywords#1 #2\relax{%
    \ifx#1\relax\else
    \shadowfyletters#1\relax\relax%
    \fi%
    \ifx\relax#2\else\ \shadowfywords#2\relax\fi%
}
\def\shadowfyletters#1#2\relax{%
    \shadow{#1}%
    \ifx\relax#2\else\shadowfyletters#2\relax\fi}

\newlength\shadowHoffset
\newlength\shadowVoffset

\setlength\shadowHoffset{.3pt}%
\setlength\shadowVoffset{-.3pt}%
\def\primarycolor{black}%
\def\secondarycolor{black!30}%

\def\shadow#1{\kern\shadowHoffset%
    \raisebox{\shadowVoffset}{%
        \stackinset{c}{-\shadowHoffset}{c}{-\shadowVoffset}%
        {\textcolor{\primarycolor}{#1}}{\textcolor{\secondarycolor}{#1}}}%
    \kern-\shadowHoffset}

\setbeamercolor{frametitle}{fg = black}%, bg = black
\setbeamertemplate{frametitle}{%
    \vskip-3pt
    \begin{beamercolorbox}[sep=0.6em,wd=\paperwidth,leftskip=0cm,rightskip=0cm]{frametitle}%
        \vspace{-2pt}\par
        %\hspace{.4cm}\centering{\textbf{\textcolor{frameTitle}{\shadowoffset{0.5pt}\shadowcolor{frameTitleShadow}\shadowtext{\insertframetitle}}}}\strut
        % ^ This does work with shadow, but not for long multiline title
        %\hspace{.4cm}\centering{\textbf{\textcolor{black}{\insertframetitle}}}\strut
        % ^ This does work with multiline long title, but with no shadow
    \hspace{.4cm}\centering{\textbf{\shadowfy{\insertframetitle}}}\strut
    \end{beamercolorbox}%
}

\begin{document}
\begin{frame}{Long long looonnngggg, veryyyieee loooonnnnggggg frame title}
test
\end{frame}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.