[Tex/LaTex] Adding shadow to font in beamer title

beamershadowstikz-pgf

I'm trying to port a Powerpoint template to beamer, and I'm trying to replicate this font style:

Font style

I am using this font in two places:

  • Title page. This text is a paragraph (3 lines) inside a beamercolorbox. I cannot split the paragraph because I'm using \inserttitle. But I could use a TikZ node if necessary.
  • Frame titles. This text is just one line inside a TikZ node.

I tried:

  • Package shadowtext: it converts the paragraph to a line (that overflows)
  • I tried this: it converts the paragraph to a line (that overflows)
  • I tried TikZ drop shadow: it draws a box shadow instead of a text shadow
  • I tried this: it is contour, and doesn't look good.

I am using pdflatex.

Current working example (without any type of shadow):

presentation.tex

\documentclass{beamer}

\usepackage[utf8]{inputenc} % UTF8
\usetheme{ABS}

\title{This is a very long title that spans over several lines. It is very long, isn't it?}
\author{Mr. Me}
\institute{
Faculty of applied Internet\\
University of somewhere
}
\date{28 June 2016}

\begin{document}
\frame{\titlepage}
\begin{frame}
\frametitle{Table of Contents}
\tableofcontents
\end{frame}

\section{Introduction}
\begin{frame}
\frametitle{This is the first slide}
%Content goes here
\end{frame}
\begin{frame}
\frametitle{This is the second slide}
\framesubtitle{A bit more information about this}
%More content goes here
\end{frame}
% etc
\end{document}

beamerthemeABS.sty

\mode<presentation>

% http://www.r-bloggers.com/create-your-own-beamer-template/
% https://tex.stackexchange.com/questions/146529/design-a-custom-beamer-theme-from-scratch

\mode<presentation>
\usepackage{tikz}
\usepackage{color}

\usetikzlibrary{shadows}

% Color definitions
\definecolor{green-abs}{RGB}{45, 137, 115}
\definecolor{light-green-abs}{RGB}{53, 159, 133}
\definecolor{light-blue-abs}{RGB}{208, 240, 245}

\definecolor{titlecolor-abs}{RGB}{255, 255, 255}
\definecolor{textcolor-abs}{RGB}{0, 0, 0}

% Color assignments
\setbeamercolor{frametitle}{fg = titlecolor-abs}
\setbeamercolor{title}{fg = titlecolor-abs}

\setbeamercolor{section in toc}{fg = textcolor-abs}
\setbeamercolor{section in toc shaded}{fg = textcolor-abs}

\setbeamercolor{item}{fg = textcolor-abs}
\setbeamercolor{subitem}{fg = textcolor-abs}
\setbeamercolor{subsubitem}{fg = textcolor-abs}

\setbeamercolor{description item}{fg = textcolor-abs}

\setbeamercolor{caption}{fg = textcolor-abs}
\setbeamercolor{caption name}{fg = textcolor-abs}

\setbeamercolor{normal text}{fg = textcolor-abs}

% Background
\setbeamertemplate{background canvas}{
    \ifnum\c@framenumber=1
        % First slide
        \begin{tikzpicture}[remember picture, overlay]
        \shade[outer color=green-abs, inner color=light-green-abs]
            (current page.north east) rectangle (current page.south west);
        \end{tikzpicture}
    \else
        % Other slides
        \begin{tikzpicture}[remember picture, overlay]
        \shade[top color=light-blue-abs, bottom color=white]
            (current page.north east) rectangle (current page.south west);
        \end{tikzpicture}
    \fi
}

% Inner theme
\useinnertheme{rounded}

% Outer theme
\setbeamerfont{frametitle}{size = \Large}

\setbeamertemplate{frametitle}{
    \begin{beamercolorbox}[wd=\paperwidth, ht=1.5cm]{frametitle}
    \begin{tikzpicture}[remember picture, overlay]
        \shade[outer color=green-abs, inner color=light-green-abs]
            (0, 0) rectangle (\the\paperwidth, 1.55cm);
        %%%%%%
        % I'd like to set the style of frametitles
        %%%%%%
        \node[anchor = west, titlecolor-abs] at (0.5, 0.8)
            {\usebeamerfont{frametitle}\insertframetitle};
    \end{tikzpicture}
    \end{beamercolorbox}
}

% Title
\setbeamerfont{title}{size = \huge}

\setbeamertemplate{title page}{
    \vfill
    \centering
    \begin{beamercolorbox}[sep=8pt, center]{title}
        %%%%%%
        % I'd like to set the style of titles, which may be very long
        %%%%%%
        \usebeamerfont{title}\inserttitle\par
    \end{beamercolorbox}
    \vskip1em\par
    \begin{beamercolorbox}[sep=8pt,center]{author}
    \usebeamerfont{author}\insertauthor
    \end{beamercolorbox}
    \begin{beamercolorbox}[sep=8pt,center]{institute}
    \usebeamerfont{institute}\insertinstitute
    \end{beamercolorbox}
    \begin{beamercolorbox}[sep=8pt,center]{date}
    \usebeamerfont{date}\insertdate
    \end{beamercolorbox}\vskip0.5em
    {\usebeamercolor[fg]{titlegraphic}\inserttitlegraphic\par}
    %\endgroup
    \vfill
}

\mode<all>

Best Answer

A quick hack would be to write the title a second time, a bit offset and in a darker colour. The following example uses a mixture of the background colour and black \color{black!20!green-abs} and is a bit darker than the shadow shown in your example, but this can be adjusted to fir your needs.

\setbeamertemplate{frametitle}{
    \begin{beamercolorbox}[wd=\paperwidth, ht=1.5cm]{frametitle}
        \begin{tikzpicture}[remember picture, overlay]
        \shade[outer color=green-abs, inner color=light-green-abs]
        (0, 0) rectangle (\the\paperwidth, 1.55cm);
        %%%%%%
        % I'd like to set the style of frametitles
        %%%%%%
        \node[anchor = west, titlecolor-abs] at (0.53, 0.77)
        {\usebeamerfont{frametitle}\color{black!20!green-abs}\insertframetitle};
        \node[anchor = west, titlecolor-abs] at (0.5, 0.8)
        {\usebeamerfont{frametitle}\insertframetitle};
        \end{tikzpicture}
    \end{beamercolorbox}
}

enter image description here

Edit:

And for a smoother shadow, one could stack more layers of different shades. In the following example 5 layers are used to create a smoother shadow:

\setbeamertemplate{frametitle}{
    \begin{beamercolorbox}[wd=\paperwidth, ht=1.5cm]{frametitle}
        \begin{tikzpicture}[remember picture, overlay]
        \shade[outer color=green-abs, inner color=light-green-abs]
        (0, 0) rectangle (\the\paperwidth, 1.55cm);
        %%%%%%
        % I'd like to set the style of frametitles
        %%%%%%
        \foreach \x in {0,5,...,20}
            \node[anchor = west, titlecolor-abs, xshift=\x*-0.002cm, yshift=\x*0.002cm] at (0.5, 0.8) {%
                \usebeamerfont{frametitle}%
                \color{black!\x!green-abs}%
                \insertframetitle%
            };
        \node[anchor = west, titlecolor-abs] at (0.5-0.002*20, 0.8+0.002*20)
        {\usebeamerfont{frametitle}\insertframetitle};
        \end{tikzpicture}
    \end{beamercolorbox}
}

enter image description here