我正在制作 Beamer 演示文稿,但不知何故作者姓名未显示在标题页上。我搜索了论坛并找到了很多相关主题,但似乎没有一个主题有像这个一样简单的问题。这是我的序言(我会让它更简洁,但通常情况下,我不知道哪些信息可能相关,哪些软件包可能会干扰,等等)。
有任何想法吗?
\documentclass{beamer}
\usefonttheme[onlymath]{serif}
\usetheme{CambridgeUS}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{tipa}
\usepackage{eurosym}
\usepackage{wasysym}
\usepackage{colortbl}
\usepackage{wrapfig}
\usepackage{graphics}
\usepackage{linguex}
\usepackage{cgloss4e}
\usepackage{authblk}
\usepackage{csquotes}
\usepackage{xspace}
\usepackage{color}
\usepackage{xyling}
\usepackage{setspace}
\usepackage{amsfonts}
\usepackage{phonetic}
\usepackage{multicol}
\usepackage{booktabs}
\usepackage{multirow}
\usepackage[backend=biber, style=authoryear-comp]{biblatex}
\let\eachwordone\itshape
\addbibresource{ref2.bib}
% \strikeout{text}: prints a struck-out version of #1
\newlength{\howlong}
\newcommand{\strikeout}[1]{
\settowidth{\howlong}{#1}%
#1\unitlength0.5ex%
\begin{picture}(0,0)
\put(0,1){\line(-1,0){\howlong\divide\unitlength}}
\end{picture}%
}
\setbeamertemplate{headline}{%
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=\paperwidth,ht=2.5ex,dp=1.125ex]{palette quaternary}%
\insertsectionnavigationhorizontal{\paperwidth}{}{\hskip0pt plus1filll}
\end{beamercolorbox}%
}
}
\setbeamertemplate{footline}
{%
\begin{beamercolorbox}[colsep=1.5pt]{upper separation line foot}
\end{beamercolorbox}
\begin{beamercolorbox}[ht=2.5ex,dp=1.125ex,%
leftskip=.3cm,rightskip=.3cm plus1fil]{author in head/foot}%
\leavevmode{\usebeamerfont{author in head/foot}\insertshortauthor}%
\hfill%
\leavevmode{\usebeamerfont{title in head/foot}\insertshorttitle}%
\hfill%
{\usebeamerfont{institute in head/foot}\usebeamercolor[fg]{institute in head/foot}\insertshortinstitute}%
\end{beamercolorbox}%
\begin{beamercolorbox}[colsep=1.5pt]{lower separation line foot}
\end{beamercolorbox}
}
\setbeamercovered{transparent=30}
\beamertemplateballitem
\title{XXX}
\subtitle{YYY}
\author{Batman}
\institute{ZZZ}
\date{\today}
\newcommand{\textunderscript}[1]{$_{\text{#1}}$}
\begin{document}
\frame{\titlepage}
....
\end{document}
答案1
看起来authoblk
您加载的包与您想要实现的目标相冲突。
我发现尝试从您的代码中创建 MWE 时发生了冲突,即逐个注释掉所有包并进行编译以查看运行代码所需的包。
例如,beamer 会graphics
自动加载包,因此不需要它。
\documentclass{beamer}
\usetheme{CambridgeUS}
\usepackage[english]{babel}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\setbeamertemplate{headline}{%
\leavevmode%
\hbox{%
\begin{beamercolorbox}[wd=\paperwidth,ht=2.5ex,dp=1.125ex]{palette quaternary}%
\insertsectionnavigationhorizontal{\paperwidth}{}{\hskip0pt plus1filll}
\end{beamercolorbox}%
}
}
\setbeamertemplate{footline}
{%
\begin{beamercolorbox}[colsep=1.5pt]{upper separation line foot}
\end{beamercolorbox}
\begin{beamercolorbox}[ht=2.5ex,dp=1.125ex,%
leftskip=.3cm,rightskip=.3cm plus1fil]{author in head/foot}%
\leavevmode{\usebeamerfont{author in head/foot}\insertshortauthor}%
\hfill%
\leavevmode{\usebeamerfont{title in head/foot}\insertshorttitle}%
\hfill%
{\usebeamerfont{institute in head/foot}\usebeamercolor[fg]{institute in head/foot}\insertshortinstitute}%
\end{beamercolorbox}%
\begin{beamercolorbox}[colsep=1.5pt]{lower separation line foot}
\end{beamercolorbox}
}
\setbeamercovered{transparent=30}
\beamertemplateballitem
\title{XXX}
\subtitle{YYY}
\author{Batman}
\institute{ZZZ}
\date{\today}
\begin{document}
\frame{\titlepage}
\end{document}
答案2
您正在加载包authblk
,它启用了更多选项,可以在文章类型的文档中显示具有不同隶属关系的多个作者。但是,它无法与 beamer 正常工作。因此,只需删除以下行
\usepackage{authblk}
并且“蝙蝠侠”将显示为你的作者。如果你确实需要多个作者,请查看这个答案如何实现这一目标。