这是一个 ECM:
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\title{TWO PROBLEMS
{\begin{tikzpicture}
\path [decorate,decoration={text along path, text={around the}}]
(0,0) sin (1,1) cos (2,0);
\end{tikzpicture}}}
\begin{document}
\begin{frame} \titlepage \end{frame}
\end{document}
这段代码给了我想要的东西,但编译器却对我大喊:
Use of \begin doesn't match its definition.
\inserttitle ->TWO PROBLEMS {\begin {
tikzpicture}
有人能告诉我如何修复这个故障吗?提前谢谢!O。
答案1
标题不仅用于标题页,还用于其他地方,例如 pdf 元数据。您tikzpicture
在标题页中添加的 hack 与此用法相冲突。
我建议通过宏插入图像\titlegraphic{}
,这通常打印在标题页的底部,但如果您希望它位于标题下方,您可以重新定义标题页,如下所示:
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\title{TWO PROBLEMS}
\titlegraphic{ \begin{tikzpicture}
\path [decorate,decoration={text along path, text={around the}}]
(0,0) sin (1,1) cos (2,0);
\end{tikzpicture}}
\makeatletter
\setbeamertemplate{title page}{
\vbox{}
\vfill
\begingroup
\centering
\begin{beamercolorbox}[sep=8pt,center]{title}
\usebeamerfont{title}\inserttitle\par%
\ifx\insertsubtitle\@empty%
\else%
\vskip0.25em%
{\usebeamerfont{subtitle}\usebeamercolor[fg]{subtitle}\insertsubtitle\par}%
\fi%
\end{beamercolorbox}%
{\usebeamercolor[fg]{titlegraphic}\inserttitlegraphic\par}
\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
\endgroup
\vfill
}
\makeatother
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\end{document}
幸亏 @marmot 指出了一种更简单的方法,即\titlegraphic{}
在页面上结合使用绝对定位。这样可以免去重新定义标题页的麻烦(如果有足够的空间放置图像)。
\documentclass{beamer}
\usepackage{tikz}
\usetikzlibrary{decorations.text}
\title{TWO PROBLEMS}
\titlegraphic{%
\begin{tikzpicture}[overlay,remember picture]
\path [decorate,decoration={text along path, text={around the}}, shift={(current page.center)}] (0,0) sin (1,1) cos (2,0);
\end{tikzpicture}
}
\begin{document}
\begin{frame}
\titlepage
\end{frame}
\end{document}