不能使用带注释的 Beamer 的子部分吗?

不能使用带注释的 Beamer 的子部分吗?

与 Beamer 和笔记一起使用时\subsection,出现错误

! Undefined control sequence.
<write> ...\000w\000e\000d\000\040\000?}{\Parent2 
                                                  }% 1

如果\subsection注释掉,.tex 文件将编译成功,不会出现错误。您能帮忙评论一下如何使用 Beamer 中的 subsection 吗?非常感谢!

使用 xeLatex 处理的 MWE.tex:

\PassOptionsToPackage{unicode=true}{hyperref} % options for packages loaded elsewhere
\PassOptionsToPackage{hyphens}{url}
%
\documentclass[ignorenonframetext,notes]{beamer}
\setbeamertemplate{caption}[numbered]
\setbeamertemplate{caption label separator}{: }
\setbeamercolor{caption name}{fg=normal text.fg}
\beamertemplatenavigationsymbolsempty
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
  \usepackage{textcomp} % provides euro and other symbols
\else % if luatex or xelatex
  \usepackage{unicode-math}
  \defaultfontfeatures{Ligatures=TeX,Scale=MatchLowercase}
    \setmainfont[]{Times New Roman}
  \ifxetex
    \usepackage{xeCJK}
    \setCJKmainfont[]{FangSong}
  \fi
  \ifluatex
    \usepackage[]{luatexja-fontspec}
    \setmainjfont[]{FangSong}
  \fi
\fi
\usefonttheme{serif} % use mainfont rather than sansfont for slide text
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage[]{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\IfFileExists{parskip.sty}{%
\usepackage{parskip}
}{% else
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
}
\usepackage{hyperref}
\hypersetup{
            pdftitle={Example proj},
            pdfborder={0 0 0},
            breaklinks=true}
\urlstyle{same}  % don't use monospace font for urls
\newif\ifbibliography
% Prevent slide breaks in the middle of a paragraph:
\widowpenalties 1 10000
\raggedbottom
\setbeamertemplate{part page}{
\centering
\begin{beamercolorbox}[sep=16pt,center]{part title}
  \usebeamerfont{part title}\insertpart\par
\end{beamercolorbox}
}
\setbeamertemplate{section page}{
\centering
\begin{beamercolorbox}[sep=12pt,center]{part title}
  \usebeamerfont{section title}\insertsection\par
\end{beamercolorbox}
}
\setbeamertemplate{subsection page}{
\centering
\begin{beamercolorbox}[sep=8pt,center]{part title}
  \usebeamerfont{subsection title}\insertsubsection\par
\end{beamercolorbox}
}
\AtBeginPart{
  \frame{\partpage}
}
\AtBeginSection{
  \ifbibliography
  \else
    \frame{\sectionpage}
  \fi
}
\AtBeginSubsection{
  \frame{\subsectionpage}
}
\setlength{\emergencystretch}{3em}  % prevent overfull lines
\providecommand{\tightlist}{%
  \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\setcounter{secnumdepth}{0}

% set default figure placement to htbp
\makeatletter
\def\fps@figure{htbp}
\makeatother


\title{Example proj}
\date{}

\begin{document}
\frame{\titlepage}

\begin{frame}{%
\protect\hypertarget{my-frame}{%
My frame}}

\subsection{No section allowed ?} % <----------------- error

No content allowed ?

\note{My }

\end{frame}

\end{document}

答案1

投影机中的框架不能按部分或子部分划分。它只能在框架外部使用。例如,而不是你的

\begin{document}
\frame{\titlepage}

\begin{frame}{%
\protect\hypertarget{my-frame}{My frame}}   
\subsection{No section allowed ?} % <----------------- error
No content allowed ?    
\note{My }    
\end{frame}
\end{document}

您只能在框架外部分段写入:

\begin{document}
\frame{\titlepage}

\subsection{No section allowed ?} % <--- he re is allowed
\begin{frame}{%
\protect\hypertarget{my-frame}{My frame}}   
No content allowed ?    
\note{My }    
\end{frame}
\end{document}

当然,章节(小节等)标题不能在框架上可见,但它在包含的框架中可见\tableofcontents。例如:

\documentclass{beamer}

\begin{document}
\begin{frame}
\tableofcontents
\end{frame}

\section{first section}
\begin{frame}\frametitle{frame A}
\end{frame}

\section{second section}
\begin{frame}\frametitle{frame B}
\end{frame}

\section{third section}
\begin{frame}\frametitle{frame C}
\end{frame}
\end{document}

\end{document}

相关内容