2

I'm writing on a .sty - file for a theme, which others will use too.

My aim is to have as less as possible additional (visible) code in the document environment of a corresponding .tex-file using the particular theme.

I run across a obstacle concerning the frametitle - titlepage interaction. I want to avoid that people give the titlepage an additional frame title.

MWE

\documentclass{beamer}

\pgfdeclareimage[width=.5\paperwidth]{mybackground}{beamericononline}

\defbeamertemplate*{title page}{mytitlepage}
{
    \begin{picture}(0,0)
    \put(-20,-60){%
        \pgfuseimage{mybackground}
    }
    \put(165,0){%
        %\colorbox{teal}{
        \begin{minipage}[b][10mm][t]{0.5\textwidth}
        \usebeamerfont{title}{\inserttitle\par}
        \end{minipage}%
        %}
    }
    \end{picture}
}

\title{A proper test title for a test presentation?}

\begin{document}
%%----------------------------------------------------------------------
%% This is how it should look like, even if you uncomment the frametitle
%%----------------------------------------------------------------------

\begin{frame}%{An extra frame title\\[2ex] is not allowed}
\titlepage
\end{frame}

%%----------------------------------------------------------------------
%% This should not be allowed, an error shall stop the compiling    
%%----------------------------------------------------------------------

\begin{frame}{An extra frame title\\[2ex] is not allowed}
    \titlepage
\end{frame}

%%----------------------------------------------------------------------
%% Frametitle suppressed, but I prefer to handle the added code in the 
%% .sty file, i.e. before the document environment
%%----------------------------------------------------------------------

{
\setbeamertemplate{frametitle}{}
\begin{frame}{An extra frame title\\[2ex] is not allowed}
    \titlepage
\end{frame}
}

I already tried several stuff shifting the

{
\setbeamertemplate{frametitle}{}
...
}

before the document, e.g. inside the title page template. Other ideas using additional \newif,\if,\ifxor defining a key reacting to the input \titlepage (as part of the frame body), similar to tex.stackexchange.com/questions/173201 did not work.

Is there a way (next to the given one) to suppress the output of the frame title using (only) a style file?

enter image description here enter image description here

2
  • 1
    I don't think that there is a good possibility. The frametitle box is set rather early, and you would have to patch a number of internal commands to avoid this. Why don't you tell the users to use \maketitle instead of \begin{frame}\titlepage\end{frame}? Commented Apr 1, 2019 at 14:40
  • Actually I think that's a good and simple idea! It matchs my situation quite good. The only problem arises, if one needs additional commands like [plain,noframenumbering], then according to link we have the original \begin{frame} ... \end{frame} situation. I know that these additional commands are not really a part of the original question.
    – Markus_B
    Commented Apr 2, 2019 at 9:35

1 Answer 1

3

If there is always a title page, you could test for the page number within the definition of the frametitle and only show it starting from the second page:

\documentclass{beamer}

\pgfdeclareimage[width=.5\paperwidth]{mybackground}{beamericononline}

\defbeamertemplate*{title page}{mytitlepage}
{
    \begin{picture}(0,0)
    \put(-20,-60){%
        \pgfuseimage{mybackground}
    }
    \put(165,0){%
        %\colorbox{teal}{
        \begin{minipage}[b][10mm][t]{0.5\textwidth}
        \usebeamerfont{title}{\inserttitle\par}
        \end{minipage}%
        %}
    }
    \end{picture}
}

\title{A proper test title for a test presentation?}


\setbeamertemplate{frametitle}{%
    \ifnum\thepage>1
        \insertframetitle
    \fi
}

\begin{document}

\begin{frame}{An extra frame title\\[2ex] is not allowed}
    \titlepage
\end{frame}

\begin{frame}
\frametitle{title}
normal frame
\end{frame}

\end{document}
2
  • Thank for the creative answer. You are right, that's a solution for the situation where one has a title page as first frame. Maybe I should create two sty-files: one for presentation with titlepage and one without it.
    – Markus_B
    Commented Apr 2, 2019 at 6:56
  • Still I am wondering if it's possible to add an \iftype conditional or to define a key that reacts to a certain command within a frame (similar to your question in link ). Do you or anyone else know some examples?
    – Markus_B
    Commented Apr 2, 2019 at 7:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .