例如,以下链接https://tex.stackexchange.com/a/58377/114622我在其他演讲中发现了这一点并进行了测试\title[what comes on subsequent slides]{what is the title on the title slide}
然而,在模板中这种情况不会发生。它将始终在后续页面上显示 {} 中的标题。
我怎样才能将此 []-title 功能添加回模板?
有问题的模板:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% unix Beamer Style
% 2018-09-06
%
\RequirePackage{calc}
\RequirePackage{etoolbox}
\mode<presentation>
\newdimen\beamer@uxBorderHeight
\newdimen\beamer@uxTitleHeight
\newdimen\beamer@uxFooterHeight
\newdimen\beamer@uxOverlap
\beamer@uxOverlap=0.2pt
\beamer@uxBorderHeight=0.015\paperheight
\beamer@uxTitleHeight=0.185\paperheight
%DEFAULT:
%\beamer@uxTitleHeight=0.125\paperheight
\beamer@uxFooterHeight=0.032\paperheight
\definecolor{uxRed}{HTML}{E6002E}
\definecolor{uxGrey}{RGB}{217,217,217}
\ProcessOptionsBeamer
\setbeamercolor{normal text}{fg=black}
\setbeamercolor{alerted text}{fg=uxRed}
\setbeamercolor{itemize item}{fg=uxRed}
\setbeamercolor{itemize subitem}{fg=uxRed}
\setbeamercolor{example text}{fg=black}
\setbeamercolor{structure}{fg=black}
\setbeamercolor{date in title page}{fg=black}
% set fonts
\RequirePackage[scaled]{helvet}
\renewcommand*\familydefault{\sfdefault}
\usefonttheme[onlymath]{serif}
\RequirePackage{iftex}
\ifPDFTeX
\RequirePackage[T1]{fontenc}
\RequirePackage[utf8]{inputenc}
\fi
\setbeamerfont*{structure}{series=\bfseries}
\setbeamerfont*{title}{size*={18}{22}}
\setbeamercolor*{title}{bg=uxRed}
\setbeamerfont*{subtitle}{size*={18}{22}}
\setbeamerfont*{author}{size*={10}{12},series=\bfseries}
\setbeamerfont*{institute}{size*={10}{12}}
\setbeamerfont*{frametitle}{size*={18}{22}}
\setbeamercolor*{frametitle}{fg=uxRed}
\setbeamerfont*{framesubtitle}{size*={18}{22}}
\setbeamercolor*{framesubtitle}{fg=black}
\setbeamerfont*{date}{size*={8}{10}}
\setbeamerfont*{headline}{size*={8}{10}}
\beamertemplatenavigationsymbolsempty
\defbeamertemplate*{title page}{unix}{%
% list trick from https://texfaq.org/FAQ-chngmargonfly
\begin{list}{}{
\setlength{\listparindent}{\parindent}%
\setlength{\itemindent}{\parindent}%
\setlength{\parsep}{\parskip}%
\setlength{\leftmargin}{0pt}%
\setlength{\rightmargin}{0pt}}
\item[]
\vspace*{\stretch{2}}
{\usebeamerfont*{title}\color{uxRed}\inserttitle\par} % no idea why usebeamercolor{title} does not work here
{\usebeamerfont*{subtitle}\insertsubtitle\par}
\vspace{\stretch{1}}
{\usebeamerfont{author}\insertauthor\par}
{\usebeamerfont{date}\insertdate\par}
\vspace*{\stretch{2}}
\end{list}
% \end{minipage}
}
\defbeamertemplate*{background canvas}{unix}{%
\begin{minipage}[t]{\paperwidth+10pt}
\setlength{\baselineskip}{0pt}
\setlength{\lineskip}{-\beamer@uxOverlap}
\setlength{\parskip}{0pt}
\ifnumgreater{\c@framenumber}{1}{
\raisebox{-\height-2\beamer@uxBorderHeight}[0pt][0pt]{\hspace*{0.86\paperwidth}\includegraphics[width=0.125\paperwidth]{uxlogo.pdf}}
}{}
\ifnumgreater{\c@framenumber}{2}{
\ifdefempty{\insertframesubtitle}{
\rule{0pt}{6ex+\beamer@uxTitleHeight}\\
\color{white}\rule{\paperwidth}{\paperheight-\beamer@uxTitleHeight-\beamer@uxFooterHeight-6ex}
}{
\rule{0pt}{6ex+2\beamer@uxTitleHeight}\\
\color{white}\rule{\paperwidth}{\paperheight-2\beamer@uxTitleHeight-\beamer@uxFooterHeight-6ex}
}
}{}
\end{minipage}
}
\defbeamertemplate*{headline}{unix}{%
\ifnumgreater{\c@framenumber}{2}{
\vspace{3.5ex}
\hspace{4.5ex}\inserttitle
}{}
}
\defbeamertemplate*{frametitle}{unix}{
\begin{minipage}[b]{\textwidth}
\vspace{0.5ex}
\raggedright
\vspace{3.5ex}
{\insertframetitle\par}
{\usebeamerfont{framesubtitle}\usebeamercolor*{framesubtitle}\insertframesubtitle}
\end{minipage}
}
% set bullets
\defbeamertemplate*{itemize item}{unix}{$\bullet$}
\defbeamertemplate*{itemize subitem}{unix}{$\bullet$}
\setbeamersize{text margin left=4ex}
\setbeamersize{text margin right=4ex}
\AtBeginDocument{
\begin{frame}
\vspace*{\stretch{1}}
\begin{center}
\end{center}
\vspace*{\stretch{1}}
\end{frame}
}
\mode<all>
答案1
您的模板\inserttitle
在标题中使用。如果您希望它插入短标题,则可以使用\insertshorttitle
(如果没有提供短标题,则会自动恢复为完整标题)。
请注意,使用条件设置标题\ifnumgreater{\c@framenumber}{2}{}{}
是一个非常糟糕的主意,因为 beamer 会在文档开始时计算框架几何形状,从而假设标题的高度是错误的。稍微不那么糟糕的是测试 framenumber 是否为 1,但理想情况下,你会完全删除这个测试,而是使用plain
第一帧的 frame 选项或使用特殊标题(例如,标题页),使用与 中相同的技巧https://topanswers.xyz/tex?q=1004#a1198。
\documentclass{beamer}
\makeatletter
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% unix Beamer Style
% 2018-09-06
%
\RequirePackage{calc}
\RequirePackage{etoolbox}
\mode<presentation>
\newdimen\beamer@uxBorderHeight
\newdimen\beamer@uxTitleHeight
\newdimen\beamer@uxFooterHeight
\newdimen\beamer@uxOverlap
\beamer@uxOverlap=0.2pt
\beamer@uxBorderHeight=0.015\paperheight
\beamer@uxTitleHeight=0.185\paperheight
%DEFAULT:
%\beamer@uxTitleHeight=0.125\paperheight
\beamer@uxFooterHeight=0.032\paperheight
\definecolor{uxRed}{HTML}{E6002E}
\definecolor{uxGrey}{RGB}{217,217,217}
\ProcessOptionsBeamer
\setbeamercolor{normal text}{fg=black}
\setbeamercolor{alerted text}{fg=uxRed}
\setbeamercolor{itemize item}{fg=uxRed}
\setbeamercolor{itemize subitem}{fg=uxRed}
\setbeamercolor{example text}{fg=black}
\setbeamercolor{structure}{fg=black}
\setbeamercolor{date in title page}{fg=black}
% set fonts
\RequirePackage[scaled]{helvet}
\renewcommand*\familydefault{\sfdefault}
\usefonttheme[onlymath]{serif}
\RequirePackage{iftex}
\ifPDFTeX
\RequirePackage[T1]{fontenc}
\RequirePackage[utf8]{inputenc}
\fi
\setbeamerfont*{structure}{series=\bfseries}
\setbeamerfont*{title}{size*={18}{22}}
\setbeamercolor*{title}{bg=uxRed}
\setbeamerfont*{subtitle}{size*={18}{22}}
\setbeamerfont*{author}{size*={10}{12},series=\bfseries}
\setbeamerfont*{institute}{size*={10}{12}}
\setbeamerfont*{frametitle}{size*={18}{22}}
\setbeamercolor*{frametitle}{fg=uxRed}
\setbeamerfont*{framesubtitle}{size*={18}{22}}
\setbeamercolor*{framesubtitle}{fg=black}
\setbeamerfont*{date}{size*={8}{10}}
\setbeamerfont*{headline}{size*={8}{10}}
\beamertemplatenavigationsymbolsempty
\defbeamertemplate*{title page}{unix}{%
% list trick from https://texfaq.org/FAQ-chngmargonfly
\begin{list}{}{
\setlength{\listparindent}{\parindent}%
\setlength{\itemindent}{\parindent}%
\setlength{\parsep}{\parskip}%
\setlength{\leftmargin}{0pt}%
\setlength{\rightmargin}{0pt}}
\item[]
\vspace*{\stretch{2}}
{\usebeamerfont*{title}\color{uxRed}\inserttitle\par} % no idea why usebeamercolor{title} does not work here
{\usebeamerfont*{subtitle}\insertsubtitle\par}
\vspace{\stretch{1}}
{\usebeamerfont{author}\insertauthor\par}
{\usebeamerfont{date}\insertdate\par}
\vspace*{\stretch{2}}
\end{list}
% \end{minipage}
}
\defbeamertemplate*{background canvas}{unix}{%
\begin{minipage}[t]{\paperwidth+10pt}
\setlength{\baselineskip}{0pt}
\setlength{\lineskip}{-\beamer@uxOverlap}
\setlength{\parskip}{0pt}
\ifnumgreater{\c@framenumber}{1}{
\raisebox{-\height-2\beamer@uxBorderHeight}[0pt][0pt]{\hspace*{0.86\paperwidth}\includegraphics[width=0.125\paperwidth]{example-image-duck}}
}{}
\ifnumgreater{\c@framenumber}{2}{
\ifdefempty{\insertframesubtitle}{
\rule{0pt}{6ex+\beamer@uxTitleHeight}\\
\color{white}\rule{\paperwidth}{\paperheight-\beamer@uxTitleHeight-\beamer@uxFooterHeight-6ex}
}{
\rule{0pt}{6ex+2\beamer@uxTitleHeight}\\
\color{white}\rule{\paperwidth}{\paperheight-2\beamer@uxTitleHeight-\beamer@uxFooterHeight-6ex}
}
}{}
\end{minipage}
}
\defbeamertemplate*{headline}{unix}{%
% \ifnumequal{\c@framenumber}{1}{}{
\vspace{3.5ex}
\hspace{4.5ex}\insertshorttitle
% }
}
\defbeamertemplate*{frametitle}{unix}{
\begin{minipage}[b]{\textwidth}
\vspace{0.5ex}
\raggedright
\vspace{3.5ex}
{\insertframetitle\par}
{\usebeamerfont{framesubtitle}\usebeamercolor*{framesubtitle}\insertframesubtitle}
\end{minipage}
}
% set bullets
\defbeamertemplate*{itemize item}{unix}{$\bullet$}
\defbeamertemplate*{itemize subitem}{unix}{$\bullet$}
\setbeamersize{text margin left=4ex}
\setbeamersize{text margin right=4ex}
\AtBeginDocument{
\begin{frame}[plain]
\vspace*{\stretch{1}}
\begin{center}
\end{center}
\vspace*{\stretch{1}}
\end{frame}
}
\mode<all>
\makeatother
\title[short]{title}
\begin{document}
\begin{frame}
\frametitle{ftitle}
abc
\end{frame}
\end{document}