我不明白如何在投影仪框架中确定小页面或列的尺寸。
\textwidth
创建宽度为或 的单列(或宽度为或 的\linewidth
两列)会导致水平溢出,如您在图片中看到的那样,框架边界已突出显示0.5 \textwidth
0.5\linewidth
梅威瑟:
\documentclass{beamer}
\usepackage{showframe}
\usepackage{lipsum}
\usepackage{ragged2e}
\begin{document}
\begin{frame}
\justifying
\lipsum[75]
\fbox{
\begin{minipage}[t]{1\textwidth}
mp1
\end{minipage}}
\fbox{
\begin{minipage}[t]{1\linewidth}
mp2
\end{minipage}}
\begin{columns}
\fbox{
\begin{column}{1\textwidth}
c1
\end{column}}
\end{columns}
\begin{columns}
\fbox{
\begin{column}{0.5\textwidth}
c1
\end{column}}
\fbox{
\begin{column}{0.5\textwidth}
c2
\end{column}}
\end{columns}
\fbox{
\begin{minipage}[t]{0.5\textwidth}
mp1
\end{minipage}}
\fbox{
\begin{minipage}[t]{0.5\linewidth}
mp2
\end{minipage}}
\end{frame} %
\end{document}
答案1
好消息是:看起来好像您确实设置了您的column
s 并且您的minipage
s 是正确的。
坏消息是:您没有注意抑制不需要的空白,并且您忘记了 fbox 总会在框和其框架之间添加一个小的间隙。
为了避免出现不需要的空格,您应该%
经常使用注释字符()(在重要的地方,尤其是行尾!)。
为了防止框和框架之间出现间隙,只需将尺寸设置\fboxsep
为0pt
。这种方法效果很好,但如果您将一个 fbox 放在另一个 fbox 旁边,则必须考虑框架的线宽。我在 MWE 的末尾添加了一个示例,以展示效果以及如何防止它。
对于 s column
:将 放在\fbox
代码中的正确位置似乎很重要。您必须构建column
-环境,而不是单个columns
。
以下是我对您的增强型 MWE:
\documentclass{beamer}
\usepackage{showframe}
\usepackage{lipsum}
%% Set the gap between the box and its frame to be exactly 0pt
\setlength{\fboxsep}{0pt}
\begin{document}
\begin{frame}
\lipsum[75]
\fbox{% <--- There was a blank space inserted between the surrounding
% box and the minipage. See next example
\begin{minipage}[t]{1\textwidth}
mp1
\end{minipage}}
\fbox{
\begin{minipage}[t]{1\linewidth}
mp2 with leading blank space
\end{minipage}}
%% Next test: Beamer-Columns It seems, as if the location of the
%% \fbox is important This example works
\fbox{\begin{columns}%
\begin{column}{1\textwidth}
\centering c1 (everthing fine!)
\end{column}%
\end{columns}}
\begin{columns}%
\fbox{\begin{column}{1\textwidth}
\centering c2 (incorrect!)
\end{column}}%
\end{columns}
%% Same problem with two columns.
\fbox{\begin{columns}%
\begin{column}{0.5\textwidth}
\centering c3.1 (fine!)
\end{column}%
\begin{column}{0.5\textwidth}
\centering c3.2 (also fine!)
\end{column}%
\end{columns}}
\begin{columns}%
\fbox{\begin{column}{0.5\textwidth}
\centering c4.1 (not fine!)
\end{column}}%
\fbox{\begin{column}{0.5\textwidth}
\centering c4.2 (neither fine!)
\end{column}}%
\end{columns}
%% This box is too full, because of four thin vertical lines.
\fbox{%
\begin{minipage}[t]{0.5\textwidth}
mp1
\end{minipage}}% <--- blank space!
\fbox{%
\begin{minipage}[t]{0.5\linewidth}
mp2
\end{minipage}}
%% Same again, this time adjustet by the line thickness. Define a new
%% length, set it to half the textwidth and add "- 2 rulewidth" to it
%% (that is, removing them from the length)
\newlength{\halfline}
\setlength{\halfline}{0.5\textwidth}
\addtolength{\halfline}{-2\fboxrule}
\fbox{%
\begin{minipage}{\halfline}
New MP2
\end{minipage}}%
\fbox{%
\begin{minipage}{\halfline}
New MP2
\end{minipage}}%
\end{frame}
\end{document}
结果如下: