Beamer - 使用列和小页面构建脚注示例

Beamer - 使用列和小页面构建脚注示例

在尝试构建一个beamer幻灯片来说明该\footnote命令的用法时,我遇到了以下问题。

当我使用以下代码编译幻灯片时:

\documentclass{beamer}
\begin{document}
\begin{frame}[fragile]{Footnotes}
\begin{columns}[t,onlytextwidth]\footnotesize
\begin{column}{0.5\textwidth}
He was a ruffian\footnote{A thug, hoodlum.} to the bone who hated both Alice and White Hare.
\end{column}
\begin{column}{0.5\textwidth}
\begin{semiverbatim}
He was a
ruffian\\footnote\{A thug, hoodlum.\}
to the bone who hated
both Alice and White Hare.
\end{semiverbatim}
\end{column}
\end{columns}
\end{frame}
\end{document}

我收到的是以下幻灯片:

输出

因此我决定借助minipage环境来避免将代码刷新到框架之外:

\documentclass{beamer}
\begin{document}
\begin{frame}[fragile]{Footnotes}
\begin{columns}[t,onlytextwidth]\footnotesize
\begin{column}{0.5\textwidth}
\begin{minipage}[t]{0.5\textwidth}
He was a ruffian\footnote{A thug, hoodlum.} to the bone who hated both Alice and White Hare.
\end{minipage}
\end{column}
\begin{column}{0.5\textwidth}
\begin{minipage}[t]{0.5\textwidth}
\begin{semiverbatim}
He was a
ruffian\\footnote\{A thug, hoodlum.\}
to the bone who hated
both Alice and White Hare.
\end{semiverbatim}
\end{minipage}
\end{column}
\end{columns}
\end{frame}
\end{document}

但在这种情况下,虽然对齐是可以的,但是左侧的文本minipage被挤压,使得它看起来不太雅致:

输出

我想请您帮助我了解这里发生了什么以及为什么会发生这种情况,并告诉我最好的补救措施是什么。我知道有些投影仪包特别适合这样的框架,但我很好奇为什么会出现这些问题,为什么我使用上述工具。

答案1

您必须\textwidth为指定宽度minipage,以便它占据整个列。请注意, 位于minipage列内,并且为\columnwidth。我略微减小了列宽(),并添加了以便更清晰。\textwidthminipage0.47\textwidth\hfill

\documentclass{beamer}

\begin{document}

\begin{frame}[fragile]{Footnotes}
\begin{columns}[t,onlytextwidth]\footnotesize
\begin{column}{0.47\textwidth}
\begin{minipage}[t]{\textwidth}
He was a ruffian\footnote{A thug, hoodlum.} to the bone who hated both Alice and White Hare.
\end{minipage}%
\end{column}
\hfill
\begin{column}{0.47\textwidth}
\begin{minipage}[t]{\textwidth}
\begin{semiverbatim}
He was a
ruffian\\footnote{A thug, hoodlum.}
to the bone who hated
both Alice and White Hare.
\end{semiverbatim}
\end{minipage}
\end{column}
\end{columns}
\end{frame}

\end{document}

在此处输入图片描述

答案2

这更像是一个建议,而不是答案。由于您似乎正在编写LaTeX教程,因此我建议您使用一些可以帮助您的软件包。您正在环境中编写乳胶代码verbatim以显示哪些代码会产生副作用。有些软件包只需要您输入代码并生成代码和结果。看看showexpl或者tcolorbox

最后一个提供了一个tcblisting环境,其代码如下

\begin{tcblisting}{title={Footote example}}
He was a ruffian\footnote{A thug, hoodlum.} to the bone who hated both Alice and White Hare.
\end{tcblisting}

生产

在此处输入图片描述

通过一些选项,您可以获得与您的示例非常相似的结果: 在此处输入图片描述

两个图的完整代码是:

\documentclass{beamer}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}
\usepackage{lmodern}
\usepackage[listingsutf8,skins]{tcolorbox}
\usepackage{lipsum}

\begin{document}

\tcbset{listing style={tcblatex,breakindent=0pt}}

\begin{frame}[fragile]{Footnotes}

\begin{tcblisting}{title={Footote example}}
He was a ruffian\footnote{A thug, hoodlum.} to the bone who hated both Alice and White Hare.
\end{tcblisting}

\end{frame}

\begin{frame}[fragile]{Footnotes}

\begin{tcblisting}{enhanced,text side listing,frame hidden,
segmentation hidden,colback=pink,opacityback=0,left=0pt,right=0pt,middle=0pt, top=0pt, bottom=0pt}
He was a ruffian\footnote{A thug, hoodlum.} to the bone who hated both Alice and White Hare. 
\end{tcblisting}
\end{frame}

\end{document}

相关内容