我怎样才能让投影仪准确填满幻灯片?

我怎样才能让投影仪准确填满幻灯片?

受到最近一个问题的启发,这个问题发音相似的标题,我实际上为投影仪幻灯片实现自动垂直拉伸(也许与完整文档不同,我认为这很有意义!)。

我一直对控制幻灯片中项目的垂直间距非常感兴趣(对我来说,默认设置看起来太“拥挤”),并遵循以下想法,例如这些,我还实现了一些黑客仅使用选项(例如[wide=10pt]框架上的选项)来手动控制幻灯片上的垂直间距。这比手动在幻灯片上添加和\medskips要好\bigskip,而且这种方法有点管用,但并非总是管用(见下文)。

然而,我希望所有这些都能自动完成,而不必手动调整每张幻灯片所需的间距。因此,根据第一个链接中问题的建议,我想到了一个几乎可行的方法,但仍有很多不足之处。

为了测试我使用了如下文档:

\documentclass{beamer}

\newcommand{\addstretch}[1]{\addtolength{#1}{\fill}}
\newcommand\stretchy{\only<2>{%
%  \addstretch{\baselineskip}% Doesn't look very nice
  \addstretch{\abovedisplayskip}%
  \addstretch{\abovedisplayshortskip}%
  \addstretch{\belowdisplayskip}%
  \addstretch{\belowdisplayshortskip}%
  \addstretch{\parskip}%
}}

\begin{document}

%%%%%%%%%%%%%%%%%%%%%%%%
\begin{frame}{A few paragraphs (with\only<1>{out} stretching)}
\stretchy

As any dedicated reader can clearly see, the Ideal of practical reason is a representation of the things in themselves.

I have shown elsewhere, the phenomena should only be used as a canon for our understanding.

The paralogisms of practical reason are what first give rise to the architectonic of practical reason.
\end{frame}

...

前几页如下: 投影机拉伸输出

完整来源是这里生成的 PDF 的注释版本为这里

这种方法与我之前的破解方法一样,存在几个问题:

  • equation环境周围的间距center似乎与段落之间的其他间距不一致。此外,对我来说,很难弄清楚哪些长度是造成我经常遇到的额外空间的原因,不得不再次求助于手动黑客来尝试“消除”额外空间。
  • Beamer 使得在不同环境中一致地修改间距变得非常困难。众所周知,itemize环境columns会重置这些间距,因此需要使用一些卑鄙的黑客手段来传递间距选项,例如从框架传递到条目。有时我可以让它们适用于特定的组合,但通常在未来我很容易找到更多我没有考虑到的组合,从而破坏我想要的间距规则。
  • 嵌套子项尤其成问题,只需在每个项目块的开头设置相同的间距规则就会使某些间距过大。
  • 一般而言,、和环境之间的相互作用itemizeequation产生center(至少对我来说)有些不可预测的结果。
  • 在环境中进行拉伸columns根本不起作用。

理想情况下我只想说:

\begin{frame}[stretch]

... frame contents ...

\end{frame}

然后让框架中的所有内容垂直拉伸并填满幻灯片中的所有空间,只需对幻灯片内容进行最少或无需手动修改。你认为我们可以实现这样的功能吗?

答案1

所有的魔法都在文件顶部的定义中。我的幻灯片内容本身唯一独特的地方是:1) 我没有在\[...\]方程构造前后留下空行;2)\columnskip下面提到的规范。

这里我讨论了普通文本、方程式、居中、中心环境、逐项环境。编辑以解决列环境。我已重新编辑以引入宏\stretchon并使\stretchoff此过程可选。只需在框架之间发出其中一个命令即可更改当前模式。我还已重新编辑以向重新定义提供\item可选参数,这是理所当然的。

通常,主要的事情是重新定义以在 之后\par添加。但是,还需要一些额外的改进。环境中的第一次调用 应该只使用通常定义的,然后重新定义以在后续 之前添加。像和这样的环境也可能需要重新调用的 ed 版本,要么进入环境,要么离开环境,或者两者兼而有之。\vfill\par\item\item\item\vfill\itemcenteritemize\vfill\par

在我针对columns环境进行的编辑中,我确定\vfill解决方案似乎没有效果,这一定与两列分别构造和对齐的方式有关。所以我的解决方案是引入一个长度\columnskip,它将是在环境\parskip中的项目之间以及退出该环境时引入的。因此,对于任何特定的幻灯片,可能需要调整一次或两次才能与页面上的column其余部分很好地匹配\vfill

\documentclass{beamer}
\def\itemsymbol{$\blacktriangleright$}
\let\svpar\par
\let\svitemize\itemize
\let\svenditemize\enditemize
\let\svitem\item
\let\svcenter\center
\let\svendcenter\endcenter
\let\svcolumn\column
\let\svendcolumn\endcolumn
\def\newitem{\renewcommand\item[1][\itemsymbol]{\vfill\svitem[##1]}}%
\def\newpar{\def\par{\svpar\vfill}}%
\newcommand\stretchon{%
  \newpar%
  \renewcommand\item[1][\itemsymbol]{\svitem[##1]\newitem}%
  \renewenvironment{itemize}%
    {\svitemize}{\svenditemize\newpar\par}%
  \renewenvironment{center}%
    {\svcenter\newpar}{\svendcenter\newpar}%
  \renewenvironment{column}[2]%
    {\svcolumn{##1}\setlength{\parskip}{\columnskip}##2}%
    {\svendcolumn\vspace{\columnskip}}%
}
\newcommand\stretchoff{%
  \let\par\svpar%
  \let\item\svitem%
  \let\itemize\svitemize%
  \let\enditemize\svenditemize%
  \let\center\svcenter%
  \let\endcenter\svendcenter%
  \let\column\svcolumn%
  \let\endcolumn\svendcolumn%
}
\newlength\columnskip
\columnskip 0pt

\begin{document}
\stretchon
\begin{frame}{A few paragraphs (with stretching)}

As any dedicated reader can clearly see, the Ideal of practical reason is a representation of the things in themselves.

I have shown elsewhere, the phenomena should only be used as a canon for our understanding.

The paralogisms of practical reason are what first give rise to the architectonic of practical reason.
\end{frame}
\begin{frame}{Displayed Equation (with stretching)}

As any dedicated reader can clearly see, the ideal of practical
reason is a representation of the things in themselves

I have shown elsewhere, the phenomena should only be used as a canon for our understanding.
\[
x^2 +y^2 = z^2
\]
The paralogisms of practical reason are what first give rise to the architectonic of practical reason.

Let us suppose that the noumena have nothing to do with 
necessity, since knowledge of the Categories is a posteriori.
\end{frame}
\begin{frame}{\textbackslash centering}

As any dedicated reader can clearly see, the ideal of practical
reason is a representation of the things in themselves

{\centering
BEGINNING CENTERING. I have shown elsewhere, the phenomena should only be used as a canon for our understanding.

The paralogisms of practical reason are what first give rise to the architectonic of practical reason. ENDING CENTERING.

}
Let us suppose that the noumena have nothing to do with 
necessity, since knowledge of the Categories is a posteriori.
\end{frame}
\begin{frame}{center Environment (extra space before/after env)}

As any dedicated reader can clearly see, the ideal of practical
reason is a representation of the things in themselves

\begin{center}
BEGINNING \{CENTER\}. I have shown elsewhere, the phenomena should only be used as a canon for our understanding.

The paralogisms of practical reason are what first give rise to the architectonic of practical reason. ENDING \{CENTER\}.
\end{center}

Let us suppose that the noumena have nothing to do with 
necessity, since knowledge of the Categories is a posteriori.
\end{frame}
\begin{frame}{itemize environment}

As any dedicated reader can clearly see, the Ideal of practical reason is a representation of the things in themselves.

Begin itemize now

\begin{itemize}
\item[$\bullet$] I have shown elsewhere, the phenomena should only be used as a canon for our understanding.

\item The paralogisms of practical reason are what first give rise to the architectonic of practical reason.
\end{itemize}

Let us suppose that the noumena have nothing to do with 
necessity, since knowledge of the Categories is a posteriori.
\end{frame}
\begin{frame}{columns environment}
I have shown elsewhere, the phenomena should only be used as a canon for our understanding.
 \columnskip 2ex%
 \begin{columns}[totalwidth=\linewidth]
  \begin{column}{.5\linewidth}
   xxx

   yyy

   zzz
  \end{column}
  \begin{column}{.5\linewidth}
   qqq

   rrr
  \end{column}
 \end{columns}
The paralogisms of practical reason are what first give rise to the architectonic of practical reason.

Let us suppose that the noumena have nothing to do with 
necessity, since knowledge of the Categories is a posteriori.
\end{frame}
\end{document}

在此处输入图片描述

在此处输入图片描述

在此处输入图片描述

在此处输入图片描述

在此处输入图片描述

在此处输入图片描述

相关内容