2

I am creating a custom beamer theme and I have problems inserting graphics in the headline of the slides.

For the graphics I have exported .eps files to TikZ code with Inkscape, which worked fine. For each the header of the titlepage and the header for normal pages i have a separate image. I would like to put them at the top of each slide with no space top, left or right but also no overlap.

Depending on which method I use the resulting images are either too small and not aligned properly or are too big resulting in clipping of the images which I also do not desire.

Can you provide me a solution for my problem?

For a better ilustration I have included a sample code:

\documentclass{beamer}
\usetheme{default}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage[none]{hyphenat}
\usepackage{pgf}
\usepackage{xcolor}
\usepackage{amsmath}

%graphics
\definecolor{c00519d}{RGB}{0,81,157}
\definecolor{cffffff}{RGB}{255,255,255}

\newcommand{\blankframeheader}{
\begin{tikzpicture}[y=0.80pt, x=0.80pt, yscale=-1.000000, xscale=1.000000, inner sep=0pt, outer sep=0pt]
\begin{scope}[shift={(0,-715.74804)}]
  \path[fill=c00519d] (0.0000,741.9754) -- (0.0000,715.7480) --
    (230.3150,715.7480) -- (460.6299,715.7480) -- (460.6299,735.7849) --
    (460.6299,755.8217) -- (291.4636,755.8727) .. controls (130.5669,755.9207) and
    (107.2812,755.9810) .. (103.4114,756.3572) .. controls (102.9047,756.4062) and
    (100.5901,756.5116) .. (98.2677,756.5909) .. controls (95.9454,756.6699) and
    (93.0089,756.8049) .. (91.7421,756.8902) .. controls (89.2381,757.0589) and
    (85.5793,757.2925) .. (81.8386,757.5224) .. controls (71.6262,758.1501) and
    (49.2989,760.4954) .. (36.6201,762.2723) .. controls (34.7622,762.5327) and
    (32.5166,762.8458) .. (31.6299,762.9681) .. controls (29.0767,763.3203) and
    (27.9960,763.4812) .. (26.0256,763.8026) .. controls (25.0122,763.9679) and
    (23.4230,764.2128) .. (22.4941,764.3468) .. controls (20.5806,764.6230) and
    (13.0199,765.9332) .. (7.2933,766.9811) .. controls (5.1821,767.3674) and
    (2.6774,767.8004) .. (1.7274,767.9433) -- (0.0000,768.2030) --
    (0.0000,741.9757) -- cycle;
\end{scope}
\end{tikzpicture}
}


\newcommand{\titlepageheader}{
\begin{tikzpicture}[y=0.80pt, x=0.80pt, yscale=-1.000000, xscale=1.000000,     inner sep=0pt, outer sep=0pt]
\begin{scope}[shift={(0,-715.74804)}]
  \path[fill=c00519d] (0.0000,757.5176) -- (0.0000,715.7480) --
    (230.3150,715.7480) -- (460.6299,715.7480) -- (460.6299,729.2431) .. controls
    (460.6299,741.7994) and (460.5752,742.7374) .. (459.8427,742.7281) .. controls
    (459.4097,742.7231) and (454.1973,742.4228) .. (448.2595,742.0619) .. controls
    (433.1563,741.1439) and (413.7831,740.7138) .. (387.5319,740.7138) .. controls
    (367.4161,740.7138) and (339.3755,741.1990) .. (335.1399,741.6204) .. controls
    (334.2665,741.7073) and (330.4142,741.9011) .. (326.5794,742.0510) .. controls
    (322.7446,742.2008) and (318.0888,742.4159) .. (316.2332,742.5288) .. controls
    (314.3777,742.6417) and (309.3170,742.9446) .. (304.9874,743.2018) .. controls
    (300.6577,743.4591) and (293.1680,743.9681) .. (288.3435,744.3329) .. controls
    (187.7250,751.9426) and (95.0905,769.1877) .. (9.7839,796.1902) --
    (0.0000,799.2871) -- cycle;
\end{scope}
\end{tikzpicture}
}


\setbeamertemplate{headline}{\resizebox{\paperwidth}{!}{\blankframeheader}}

\setbeamertemplate{title page}{
    \begin{picture}(0,0)
        \put(-32,40){   % This line is fiddeling with coordinates. I would like to define that the
                        % picture is put in the top left corner, the width set to the width of the
                        % slide and y is scaled accordingly.
                        % I want to avoid any white space or oversize of the images.
    \resizebox{\paperwidth}{!}{\titlepageheader}
    }
    \put(0,-50){%
        \begin{minipage}[b][22mm][t]{95mm}
            \begin{flushleft}
                \usebeamerfont{title}\inserttitle\par%
                  \ifx\insertsubtitle\@empty%
                  \else%
                    \vskip0.25em%
                    {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
                  \fi%     
                \vskip1em\par
                  \usebeamerfont{author}\insertauthor\par
                  \usebeamerfont{institute}\insertinstitute\par
                  \usebeamerfont{date}\insertdate
            \end{flushleft}
        \end{minipage}
    }
\end{picture}
}


\title{A beamer Title}
\subtitle{A beamer Subtitle}
\author{Author Name}
\institute{Institution}
\date{date}

\begin{document}

\begin{frame}[plain]    % I have used [plain] to remove the headline from the titlepage
                        % However i would prefer to do this in the \setbeamertemplate definition
                        % rather than manually in the document
    \titlepage
\end{frame}


\begin{frame}
*
\end{frame}


\end{document}
lockstep
  • 250,273
Jan
  • 23

1 Answers1

2

First of all you are missing some % to get your tikz pictures properly scaled to full paper width. Have a look at this SE Question for more information on why this is necessary. This problem solved I propose putting your tikz pictures in the background template. I think this makes it a lot easier. To set the titleframe automatically to plain and change the background I think it makes sense to just redefine the maketitle command.

enter image description here

\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{calc}
\usepackage{pgf}
\usepackage{amsmath}

%graphics \definecolor{c00519d}{RGB}{0,81,157} \definecolor{cffffff}{RGB}{255,255,255}

\newcommand{\blankframeheader}{% <-- This percent sign is important. \begin{tikzpicture}[y=0.80pt, x=0.80pt, yscale=-1.000000, xscale=1.000000, inner sep=0pt, outer sep=0pt] \begin{scope}[shift={(0,-715.74804)}] \path[fill=c00519d] (0.0000,741.9754) -- (0.0000,715.7480) -- (230.3150,715.7480) -- (460.6299,715.7480) -- (460.6299,735.7849) -- (460.6299,755.8217) -- (291.4636,755.8727) .. controls (130.5669,755.9207) and (107.2812,755.9810) .. (103.4114,756.3572) .. controls (102.9047,756.4062) and (100.5901,756.5116) .. (98.2677,756.5909) .. controls (95.9454,756.6699) and (93.0089,756.8049) .. (91.7421,756.8902) .. controls (89.2381,757.0589) and (85.5793,757.2925) .. (81.8386,757.5224) .. controls (71.6262,758.1501) and (49.2989,760.4954) .. (36.6201,762.2723) .. controls (34.7622,762.5327) and (32.5166,762.8458) .. (31.6299,762.9681) .. controls (29.0767,763.3203) and (27.9960,763.4812) .. (26.0256,763.8026) .. controls (25.0122,763.9679) and (23.4230,764.2128) .. (22.4941,764.3468) .. controls (20.5806,764.6230) and (13.0199,765.9332) .. (7.2933,766.9811) .. controls (5.1821,767.3674) and (2.6774,767.8004) .. (1.7274,767.9433) -- (0.0000,768.2030) -- (0.0000,741.9757) -- cycle; \end{scope} \end{tikzpicture}% <-- This percent sign is important. }

\newcommand{\titlepageheader}{% <-- This percent sign is important. \begin{tikzpicture}[y=0.80pt, x=0.80pt, yscale=-1.000000, xscale=1.000000, inner sep=0pt, outer sep=0pt] \begin{scope}[shift={(0,-715.74804)}] \path[fill=c00519d] (0.0000,757.5176) -- (0.0000,715.7480) -- (230.3150,715.7480) -- (460.6299,715.7480) -- (460.6299,729.2431) .. controls (460.6299,741.7994) and (460.5752,742.7374) .. (459.8427,742.7281) .. controls (459.4097,742.7231) and (454.1973,742.4228) .. (448.2595,742.0619) .. controls (433.1563,741.1439) and (413.7831,740.7138) .. (387.5319,740.7138) .. controls (367.4161,740.7138) and (339.3755,741.1990) .. (335.1399,741.6204) .. controls (334.2665,741.7073) and (330.4142,741.9011) .. (326.5794,742.0510) .. controls (322.7446,742.2008) and (318.0888,742.4159) .. (316.2332,742.5288) .. controls (314.3777,742.6417) and (309.3170,742.9446) .. (304.9874,743.2018) .. controls (300.6577,743.4591) and (293.1680,743.9681) .. (288.3435,744.3329) .. controls (187.7250,751.9426) and (95.0905,769.1877) .. (9.7839,796.1902) -- (0.0000,799.2871) -- cycle; \end{scope} \end{tikzpicture}% <-- This percent sign is important. }

\setbeamercolor{frametitle}{fg=white} \setbeamertemplate{background}{\resizebox{\paperwidth}{!}{\blankframeheader}}

\setbeamertemplate{title page}{% \vspace{2em} \usebeamerfont{title}\inserttitle\par% \ifx\insertsubtitle@empty% \else% \vspace{0.25em} {\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}% \fi% \vspace*{1em} \usebeamerfont{author}\insertauthor\par \usebeamerfont{institute}\insertinstitute\par \usebeamerfont{date}\insertdate }

\renewcommand{\maketitle}{% \setbeamertemplate{background}{\resizebox{\paperwidth}{!}{\titlepageheader}} \frame[plain,noframenumbering]{\titlepage} \setbeamertemplate{background}{\resizebox{\paperwidth}{!}{\blankframeheader}} }

\title{A beamer Title} \subtitle{A beamer Subtitle} \author{Author Name} \institute{Institution} \date{date}

\begin{document}

\maketitle

\begin{frame}{Frametitle} Framecontent \end{frame}

\end{document}

JeT
  • 3,020
Benjamin
  • 4,781
  • Thank you! The % sign did a very good job. For positioning of the title page header i found a solution using the eso-pic,picture package. With this packafe the 'renewcomman{\maketitle}' does not work however. – Jan Mar 24 '16 at 13:16