4

I am creating my own beamer theme, and the way I have conceived the title page needs the title to be inside a tikzpicture node, in this form:

    \node [anchor=center] (title) at ($(box)+(0,.25)$) {%
    \color{white}
        {\usebeamerfont{title}\inserttitle}
        };

It works perfectly until I need to insert long titles and need to break the lines...

If I do:

\title[academic background \& research experience]
  {Academic background \& \\ Research experience}

I get the error:

 ! LaTeX Error: Something's wrong--perhaps a missing \item.

And if I do:

\usepackage{pbox}
\title[academic background \& research experience]
  {\pbox{20cm}{Academic background \& \\ Research experience}}

I get the warning:

 Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
 (hyperref) removing `\pbox '

Does anybody know what is happening here?

EDIT: Please find a MWE below (I have the relevant lines in a .sty file, but adding them inside \mode<presentation>{} works as well)

\documentclass[ignorenonframetext]{beamer}


\mode<presentation> {
    \usetheme{Berkeley}
    \usecolortheme{albatross}

    %PACKAGES, LIBRARIES AND ENVIRONMENTS HERE 
    \usepackage{tikz}
    \usetikzlibrary{calc} 

    \title[academic background \& research experience]{Academic background \& Research experience}

    \author{Name Surname}
    \date[\today]{\today}

    \setbeamertemplate{title page}{

    \begin{tikzpicture}[remember picture,overlay, every node/.style={inner sep=0,outer sep=0}]
        \node [rectangle, fill=gray, anchor=north east, minimum width=.86\paperwidth, minimum height=3cm] (box) at (current page.north east){};


        \node [anchor=center] (title) at ($(box)+(0,.25)$) {%
        \color{white}
            {\usebeamerfont{title}\inserttitle}
            };

            \ifx\insertauthor\@empty
        \else
        \node [anchor=west] (author) at ($(title.south west)-(0,.5)$) {%
        \color{white}
            {\usebeamerfont{author}\insertauthor}
            };
            \fi

            \ifx\insertdate\@empty
        \else
        \node [anchor=west] (date) at ($(title.south west)-(-.2,2)$) {%
        \color{blue}
            {\usebeamerfont{date}\insertdate}
            };
            \fi
    \end{tikzpicture}
    }
}


\begin{document}


\begin{frame}[plain]
%\frametitle{SCB Departmental WIP - July 2013}
\titlepage % Print the title page as the first slide
\end{frame}


\end{document}
  • 1
    Please give us complete, minimal code allowing us to reproduce the problem and showing the relevant settings. Providing just snippets is almost useless. – Gonzalo Medina Jul 14 '14 at 14:42
  • Edited to add a MWE, sorry I had the relevant lines in an .sty file and didn't know I could include them inside \mode<presentation>{} – DaniCee Jul 14 '14 at 15:07
3

Simply pass the align=<value> key to the title node and/or use text width=<length>, so line breaks are allowed.

Here's a little example completing your snippets to a complete example:

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

\setbeamertemplate{title page}{%
\begin{tikzpicture}
 \node[text width=\textwidth,fill=cyan,minimum height=2cm] at (current page.center) (box) {};
 \node[anchor=center,align=center,text width=\linewidth,font=\color{white}\usebeamerfont{title}] (title) at ($(box)+(0,.25)$) 
   {\inserttitle};
\end{tikzpicture}%
}

\title[academic background \& research experience]{Academic background \& \\ Research experience}

\begin{document}

\begin{frame}
\maketitle
\end{frame}

\end{document}

enter image description here

Aldo, modifications to the font of the contents of a node are better done using the font key (as in my example) instead of doing them directly in the node contents (as in your code).

| improve this answer | |

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.