我正在创建自己的beamer
主题,我构思的标题页的方式需要将标题放在节点内tikzpicture
,形式如下:
\node [anchor=center] (title) at ($(box)+(0,.25)$) {%
\color{white}
{\usebeamerfont{title}\inserttitle}
};
它运行完美,直到我需要插入长标题并且需要换行......
如果我做:
\title[academic background \& research experience]
{Academic background \& \\ Research experience}
我收到错误:
! LaTeX Error: Something's wrong--perhaps a missing \item.
如果我这么做:
\usepackage{pbox}
\title[academic background \& research experience]
{\pbox{20cm}{Academic background \& \\ Research experience}}
我收到警告:
Package hyperref Warning: Token not allowed in a PDF string (PDFDocEncoding):
(hyperref) removing `\pbox '
有人知道这里发生了什么事吗?
编辑:请在下面找到 MWE(我在文件中有相关的行.sty
,但将它们添加到里面\mode<presentation>{}
也可以)
\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
只需将align=<value>
钥匙交给title
节点和/或使用text width=<length>
,这样就可以允许换行。
这是一个将您的代码片段补充为完整示例的小例子:
\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}
Aldo,修改节点内容的字体最好使用font
键来修改节点内容的字体(如我的示例所示),而不是直接在节点内容中进行修改(如您的代码所示)。