Beamer 标题有误:此处无结尾

Beamer 标题有误:此处无结尾

我正在尝试通过导入我找到的代码来创建标题页。我的代码如下:

\documentclass[10pt,xcolor={dvipsnames}]{beamer}

\mode<article> % only for the article version
{
  \usepackage{fullpage}
  \usepackage{hyperref}
}

\mode<presentation>
{
  \setbeamertemplate{background canvas}[vertical shading][bottom=red!10,top=blue!10]

  \usetheme{JuanLesPins}
  \setbeamercovered{transparent}
  \usefonttheme{serif}
}

\usepackage{pgf,pgfarrows,pgfnodes,pgfautomata,pgfheaps,pgfshade}
\usepackage[latin1]{inputenc}
\usepackage{colortbl}
\usepackage[english]{babel}

\setbeamercovered{dynamic}

\setbeamertemplate{items}[circle]

\defbeamertemplate*{title page}{progressbar theme}{
  \pgfdeclarehorizontalshading{separationtitlepagelineshading}{0.5pt}{color(0cm)=(bg); color(0.5\textwidth)=(structure.fg); color(\textwidth)=(bg)}

  \makeatletter
  \begin{center}
    \textbf{\textcolor{structure.fg}\large\inserttitle}

    \pgfuseshading{separationtitlepagelineshading}
    \vskip\baselineskip
    \footnotesize\insertauthor\\[\baselineskip]
    \ifx\insertinstitute\@empty \else\tiny\insertinstitute\\[\baselineskip]\fi
    \insertlogo
    \vskip\baselineskip
    \pgfuseshading{separationtitlepagelineshading}
    \vfill
    \footnotesize
    \insertdate
  \end{center}
  \makeatother
}

\setbeamertemplate{title page}[mytitlepage]

\title[]{\vspace*{0.5cm}\parbox{10.0cm}{\centering{\LARGE{\sc Title}}}}

\author{\parbox{10.0cm}{\vfill \relax\ifvmode\centering\fi {\normalsize\textbf{Subtitle}} \vfill}
}

\date{{\footnotesize \vspace*{1.0cm} Author}}

\begin{document}

\begin{frame}[plain]

\maketitle

\end{frame}

\begin{frame}

My first slide

\end{frame}

\end{document}

通过编译文件,我收到一个错误:“这里没有结束行”。非常欢迎任何帮助。谢谢。

答案1

在您的自定义标题页中,您硬编码了各种格式指令,例如字体大小。然后您尝试再次用硬编码格式指令覆盖它们\title{...}\author{...}等等。

而是将标题页中的说明更改为您实际想要的内容,这样您就不必再次覆盖它们。

例如:

\documentclass[10pt,xcolor={dvipsnames,table}]{beamer}

\mode<article> % only for the article version
{
  \usepackage{fullpage}
  \usepackage{hyperref}
}

\mode<presentation>
{
  \setbeamertemplate{background canvas}[vertical shading][bottom=red!10,top=blue!10]

  \usetheme{JuanLesPins}
  \setbeamercovered{transparent}
  \usefonttheme{serif}
}

\usepackage[english]{babel}

\setbeamercovered{dynamic}

\setbeamertemplate{items}[circle]

\makeatletter
\defbeamertemplate*{title page}{progressbar theme}{
  \pgfdeclarehorizontalshading{separationtitlepagelineshading}{0.5pt}{color(0cm)=(bg); color(0.5\textwidth)=(structure.fg); color(\textwidth)=(bg)}

  \begin{center}
    \vspace*{0.5cm}%
    \parbox{10.0cm}{%
      \centering
      \usebeamerfont{title}
      \usebeamercolor[fg]{structure}
      \inserttitle
    }
    \vspace{0.5cm}

    \pgfuseshading{separationtitlepagelineshading}
    \vskip\baselineskip
    
    \parbox{10.0cm}{
      \centering
      \usebeamerfont{subtitle}
      \insertsubtitle
    }
    
    \insertinstitute
    \insertlogo
    \vskip\baselineskip
    \pgfuseshading{separationtitlepagelineshading}
    \vfill
    \usebeamerfont{author}
    \insertauthor
  \end{center}
}
\makeatother

\setbeamerfont{title}{shape=\scshape,size=\LARGE}
\setbeamerfont{subtitle}{series=\bfseries,size=\normalsize}
\setbeamerfont{author}{size=\footnotesize}  
  
\setbeamertemplate{title page}[mytitlepage]

\title[]{Title}
\subtitle{Subtitle}
\author{Author}

\begin{document}

\begin{frame}[plain]

\maketitle

\end{frame}

\begin{frame}

My first slide

\end{frame}

\end{document}

在此处输入图片描述

相关内容