在 beamer 中使用 allowframebreaks 时添加空白幻灯片

在 beamer 中使用 allowframebreaks 时添加空白幻灯片

我在投影仪幻灯片中使用长表格,因此尝试使用框架中的 allowframebreaks 命令将它们分布到多张幻灯片上。长表格显示正常,但是,在框架末尾的输出中添加了一个空白幻灯片。我该如何避免这种情况?

\documentclass[10pt]{beamer}
\usepackage[utf8]{inputenc}
\usepackage{multirow,rotating}
\usepackage{color}
\usepackage{hyperref}
\usepackage{tikz-cd}
\usepackage{array}
\usepackage{siunitx}
\usepackage{mathtools,nccmath}%
\usepackage{etoolbox, xparse} 
\usetheme{CambridgeUS}
\usecolortheme{dolphin}
\usepackage{longtable}


% set colors
\definecolor{myNewColorA}{RGB}{158, 27,50}
\definecolor{myNewColorB}{RGB}{158, 27,50}
\definecolor{myNewColorC}{RGB}{158, 27,50} % {130,138,143}
\setbeamercolor*{palette primary}{bg=myNewColorC}
\setbeamercolor*{palette secondary}{bg=myNewColorB, fg = white}
\setbeamercolor*{palette tertiary}{bg=myNewColorA, fg = white}
\setbeamercolor*{titlelike}{fg=myNewColorA}
\setbeamercolor*{title}{bg=myNewColorA, fg = white}
\setbeamercolor*{item}{fg=myNewColorA}
\setbeamercolor*{caption name}{fg=myNewColorA}
\usefonttheme{professionalfonts}
%\usepackage{natbib}
\usepackage{hyperref}
%------------------------------------------------------------
%\titlegraphic{\includegraphics[height=0.75cm]{iitb1.png}} 

% logo of my university


\titlegraphic{%
\includegraphics[width=3.0cm]{iitb1.png}
}

\setbeamerfont{title}{size=\large}
\setbeamerfont{subtitle}{size=\small}
\setbeamerfont{author}{size=\small}
\setbeamerfont{date}{size=\footnotesize}
\setbeamerfont{institute}{size=\footnotesize}
\title[CL689]{Heat Integration Analysis for an Industrial
Ethylbenzene Plant using Pinch Analysis}%title
%\subtitle{ }%%subtitle
%\author[Priyam Nayak]{Priyam Nayak - 214026014\inst{1}}%%authors
\author[Priyam Nayak]{Priyam Nayak - 214026014}
%\institute[IITB]{Indian Institute of Technology Bombay\inst{1}}
\institute[IITB]{Indian Institute of Technology Bombay}
\date[\textcolor{white}{Project Presentation}]
{CL689 - Energy Integration in Chemical Processes\\ Project Presentation\\ Nov 22, 2022}

%------------------------------------------------------------
%This block of commands puts the table of contents at the 
%beginning of each section and highlights the current section:
%\AtBeginSection[]
%{
%  \begin{frame}
%    \frametitle{Contents}
%    \tableofcontents[currentsection]
%  \end{frame}
%}
\AtBeginSection[]{
  \begin{frame}
  \vfill
  \centering
  \begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title}
    \usebeamerfont{title}\insertsectionhead\par%
  \end{beamercolorbox}
  \vfill
  \end{frame}
}
% ------Contents below------
%------------------------------------------------------------

\begin{document}

%The next statement creates the title page.
\frame{\titlepage}
\begin{frame}
\frametitle{Outline}
\tableofcontents
\end{frame}


% consider removing it if it's too redundant
\AtBeginSection[]
{
  \begin{frame}
    \frametitle{Table of Contents}
    \tableofcontents[currentsection]
  \end{frame}
}

%------------------------------------------------------------
\section{Introduction}

\begin{frame}[allowframebreaks]{Problem Data - Cold Stream}
\begin{table}
\begin{longtable}[c]{|c|c|c|c|c|}
\hline
\textbf{Stream} & \textbf{T\textsubscript{in} ($\degree$C)} & \textbf{T\textsubscript{out} ($\degree$C)} & \textbf{Heat Duty (kW)} & \textbf{Heat Capacity (kW/$\degree$C)} \\ \hline
\endfirsthead
%
\endhead
C1 & 162 & 206 & 9020 & 205 \\ \hline
C2 & 158 & 200 & 3210 & 76 \\ \hline
C3 & 205 & 206 & 4445 & 4445 \\ \hline
C4 & 40 & 180 & 75 & 0.5 \\ \hline
C5 & 34 & 87 & 1007 & 19 \\ \hline
C6 & 241 & 242 & 8999 & 8999 \\ \hline
C7 & 221 & 244 & 5951 & 259 \\ \hline
C8 & 271 & 279 & 2105 & 263 \\ \hline
C9 & 55 & 130 & 230 & 3 \\ \hline
C10 & 33 & 90 & 2625 & 46 \\ \hline
C11 & 242 & 246 & 16989 & 4247 \\ \hline
C12 & 221 & 236 & 8082 & 539 \\ \hline
C13 & 268 & 282 & 3789 & 271 \\ \hline
C14 & 55 & 130 & 512 & 7 \\ \hline
C15 & 38 & 48 & 537 & 54 \\ \hline
C16 & 104 & 105 & 447 & 447 \\ \hline
C17 & 103 & 104 & 407 & 407 \\ \hline
\end{longtable}
%\caption{Cold stream data}
%\label{tab:cs-data}
\end{table}
\end{frame}

\section*{Acknowledgement}  
\begin{frame}

\textcolor{myNewColorA}{\huge{\centerline{Thank you!}}}
\vspace*{0.5cm}

\textcolor{myNewColorA}{\Large{\centerline{E-mail: }}}

\end{frame}

\end{document}

overleaf 的 pdf 输出

答案1

有几个问题:

  • 如果您想使用\degree宏,您必须定义它或加载提供它的包之一。 Overleaf 非常擅长隐藏错误消息,但右上角应该有一个红色方块提醒您有错误。 如果 latex 遇到错误,它只会检查文档的其余部分,而不一定会产生合理的输出

  • 你的表格也太宽了,无法放在框架上。你可以通过缩小最后一列来节省一点空间

  • 即使 beamer 没有浮动机制,tableetc 等环境也不打算跨越多张幻灯片。正如您注释掉的标题一样,它实际上也没有什么用处。删除它。

  • 您无需加载colorhyperref或者etoolbox,beamer 会为您加载

  • 使用最新的 latex,你也不需要\usepackage[utf8]{inputenc},这是默认的

  • 不要多次加载同一个包

  • 与 latex 无关,但你确定在演示中真的需要这么长的表格吗?观众几乎不会记住所有的数字。通常,展示你从表格中学到的东西比展示表格更好。如果你真的必须包含表格,请查看软件包的文档,booktabs了解如何创建专业的表格。

\documentclass[10pt]{beamer}
%\usepackage[utf8]{inputenc}
\usepackage{multirow,rotating}
%\usepackage{color}
%\usepackage{hyperref}
\usepackage{tikz-cd}
\usepackage{array}
\usepackage{siunitx}
\usepackage{mathtools,nccmath}%
\usepackage{
%etoolbox, 
xparse} 
\usetheme{CambridgeUS}
\usecolortheme{dolphin}
\usepackage{longtable}
\usepackage{gensymb}


% set colors
\definecolor{myNewColorA}{RGB}{158, 27,50}
\definecolor{myNewColorB}{RGB}{158, 27,50}
\definecolor{myNewColorC}{RGB}{158, 27,50} % {130,138,143}
\setbeamercolor*{palette primary}{bg=myNewColorC}
\setbeamercolor*{palette secondary}{bg=myNewColorB, fg = white}
\setbeamercolor*{palette tertiary}{bg=myNewColorA, fg = white}
\setbeamercolor*{titlelike}{fg=myNewColorA}
\setbeamercolor*{title}{bg=myNewColorA, fg = white}
\setbeamercolor*{item}{fg=myNewColorA}
\setbeamercolor*{caption name}{fg=myNewColorA}
\usefonttheme{professionalfonts}
%\usepackage{natbib}
%\usepackage{hyperref}
%------------------------------------------------------------
%\titlegraphic{\includegraphics[height=0.75cm]{iitb1.png}} 

% logo of my university


\titlegraphic{%
\includegraphics[width=3.0cm]{example-image-duck}
}

\setbeamerfont{title}{size=\large}
\setbeamerfont{subtitle}{size=\small}
\setbeamerfont{author}{size=\small}
\setbeamerfont{date}{size=\footnotesize}
\setbeamerfont{institute}{size=\footnotesize}
\title[CL689]{Heat Integration Analysis for an Industrial
Ethylbenzene Plant using Pinch Analysis}%title
%\subtitle{ }%%subtitle
%\author[Priyam Nayak]{Priyam Nayak - 214026014\inst{1}}%%authors
\author[Priyam Nayak]{Priyam Nayak - 214026014}
%\institute[IITB]{Indian Institute of Technology Bombay\inst{1}}
\institute[IITB]{Indian Institute of Technology Bombay}
\date[\textcolor{white}{Project Presentation}]
{CL689 - Energy Integration in Chemical Processes\\ Project Presentation\\ Nov 22, 2022}

%------------------------------------------------------------
%This block of commands puts the table of contents at the 
%beginning of each section and highlights the current section:
%\AtBeginSection[]
%{
%  \begin{frame}
%    \frametitle{Contents}
%    \tableofcontents[currentsection]
%  \end{frame}
%}
\AtBeginSection[]{
  \begin{frame}
  \vfill
  \centering
  \begin{beamercolorbox}[sep=8pt,center,shadow=true,rounded=true]{title}
    \usebeamerfont{title}\insertsectionhead\par%
  \end{beamercolorbox}
  \vfill
  \end{frame}
}
% ------Contents below------
%------------------------------------------------------------

\begin{document}

%The next statement creates the title page.
\frame{\titlepage}
\begin{frame}
\frametitle{Outline}
\tableofcontents
\end{frame}


% consider removing it if it's too redundant
\AtBeginSection[]
{
  \begin{frame}
    \frametitle{Table of Contents}
    \tableofcontents[currentsection]
  \end{frame}
}

%------------------------------------------------------------
\section{Introduction}

\begin{frame}[allowframebreaks]{Problem Data - Cold Stream}
%\begin{table}
\begin{longtable}[c]{|c|c|c|c|>{\centering\arraybackslash}p{3cm}|}
\hline
\textbf{Stream} & \textbf{T\textsubscript{in} ($\degree$C)} & \textbf{T\textsubscript{out} ($\degree$C)} & \textbf{Heat Duty (kW)} & \textbf{Heat Capacity (kW/$\degree$C)} \\ \hline
\endfirsthead
%%
\endhead
C1 & 162 & 206 & 9020 & 205 \\ \hline
C2 & 158 & 200 & 3210 & 76 \\ \hline
C3 & 205 & 206 & 4445 & 4445 \\ \hline
C4 & 40 & 180 & 75 & 0.5 \\ \hline
C5 & 34 & 87 & 1007 & 19 \\ \hline
C6 & 241 & 242 & 8999 & 8999 \\ \hline
C7 & 221 & 244 & 5951 & 259 \\ \hline
C8 & 271 & 279 & 2105 & 263 \\ \hline
C9 & 55 & 130 & 230 & 3 \\ \hline
C10 & 33 & 90 & 2625 & 46 \\ \hline
C11 & 242 & 246 & 16989 & 4247 \\ \hline
C12 & 221 & 236 & 8082 & 539 \\ \hline
C13 & 268 & 282 & 3789 & 271 \\ \hline
C14 & 55 & 130 & 512 & 7 \\ \hline
C15 & 38 & 48 & 537 & 54 \\ \hline
C16 & 104 & 105 & 447 & 447 \\ \hline
C17 & 103 & 104 & 407 & 407 \\ \hline
\end{longtable}
%\caption{Cold stream data}
%\label{tab:cs-data}
%\end{table}
\end{frame}

\section*{Acknowledgement}  
\begin{frame}

\textcolor{myNewColorA}{\huge{\centerline{Thank you!}}}
\vspace*{0.5cm}

\textcolor{myNewColorA}{\Large{\centerline{E-mail: }}}

\end{frame}

\end{document}

在此处输入图片描述

相关内容