我正在嘗試在 Beamer 中製作海報。多列環境的填充是錯誤的:多列的左側正確對齊,但右側添加了額外的填充。見下文:
這個問題可能相關,但該解決方案在這種情況下似乎沒有做任何有用的事情。我也曾看了這個解決方案無濟於事。這個問題似乎相關,並且得到了答案的一半,但沒有解釋虛假的右邊距。這不是區塊內右填充的問題,因為即使只是將列引入到環境中也會出現問題frame
。
這是一個簡化的例子
\documentclass[]{beamer}
% Set up as beamerposter
\usepackage[orientation=landscape,size=A4,debug]{beamerposter}
\usetheme{Singapore4}
% Enable T1 (more modern) fonts
\usepackage[T1]{fontenc}
\usepackage[greek,english]{babel}
\usepackage{textgreek}
\usepackage[utf8]{inputenc}
\usepackage{grffile}
\usepackage{ragged2e}
\usepackage{amsmath,amsthm, amssymb, latexsym}
\title[]{Title}
\author[]{Authors}
\date{}
\institute[]{Institute}
\begin{document}
\setlength\columnsep{0pt}
\begin{frame}{}
\begin{block}{}
I've placed hrules in the columns to show that the spacing error comes from the column environment and not the block environment.\\
\hrulefill
\begin{columns}[T,onlytextwidth]
\begin{column}{.5\textwidth-.5cm}\hrulefill\begin{block}{}\vspace{5em}\end{block}\end{column}
\begin{column}{.5\textwidth-.5cm}\hrulefill\begin{block}{}\end{block}\end{column}
\end{columns}
\end{block}
The problem is not related to Beamer blocks as "naked" columns show the same issue:\\
\hrulefill
\begin{columns}[T,onlytextwidth]
\begin{column}{.5\textwidth-.5cm}\hrulefill\begin{block}{}\end{block}\end{column}
\begin{column}{.5\textwidth-.5cm}\hrulefill\begin{block}{}\end{block}\end{column}
\end{columns}
\end{frame}
\end{document}
這是我的樣式文件的源代碼
% Copyright 2007 by Till Tantau
%
% This file may be distributed and/or modified
%
% 1. under the LaTeX Project Public License and/or
% 2. under the GNU Public License.
%
% See the file doc/licenses/LICENSE for more details.
\usepackage{grffile}
\usepackage{hyperref}
\usepackage{calc}
\usepackage{tcolorbox}
\usepackage{lmodern}% http://ctan.org/pkg/lm
%\ProvidesPackageRCS $Header: /Users/joseph/Documents/LaTeX/beamer/base/themes/theme/beamerthemeSingapore.sty,v d02a7cf4d8ae 2010/06/17 09:11:41 rivanvx $
\DeclareOptionBeamer{compress}{\beamer@compresstrue}
\ProcessOptionsBeamer
\mode<presentation>
\setbeamercolor{section in head/foot}{use=structure,bg=structure.fg!25!bg}
\useoutertheme[subsection=false]{miniframes}
\setbeamertemplate{frametitle}[default][center]
\AtBeginDocument{%
{
\usebeamercolor{section in head/foot}
}
\pgfdeclareverticalshading{beamer@headfade}{\paperwidth}
{%
color(0cm)=(bg);
color(1.25cm)=(section in head/foot.bg)%
}
\setbeamercolor{section in head/foot}{bg=}
}
\beamertemplatedotitem
\mode
<all>
% Template from T has special colors
\definecolor{TYellow}{RGB}{234,230, 99}
\definecolor{TBlue}{RGB}{ 29, 23, 96}
\definecolor{TAzure}{RGB}{151,147,204}
\definecolor{TWhite}{RGB}{255,255,255}
\definecolor{TPale}{RGB}{232,229,177}
\definecolor{VABlue}{RGB}{25,73,128}
\definecolor{RUST}{HTML}{EB7A59}
\definecolor{AZURE}{HTML}{5AA0DF}
\definecolor{OCHRE}{HTML}{EEA300}
\definecolor{TURQUOISE}{HTML}{00BAC9}
\definecolor{BLACK}{HTML}{44525C}
\definecolor{WHITE}{HTML}{F1F0E9}
% Configure the colors for the headline
\setbeamercolor{headline}{bg=BLACK,fg=OCHRE}
\setbeamercolor{title in headline}{bg=BLACK,fg=OCHRE}
\setbeamercolor{author in headline}{bg=BLACK,fg=TWhite}
\setbeamercolor{institute in headline}{bg=BLACK,fg=TWhite}
\setbeamercolor{date in headline}{bg=BLACK,fg=TWhite}
\setbeamercolor{logobox}{bg=BLACK}
\setbeamercolor{block title}{bg=white,fg=VABlue}
\setbeamercolor{block body}{bg=WHITE,fg=black}
\setbeamercolor{block title}{bg=BLACK,fg=TWhite}
% define a new register to hold an intermediate size calculation
% that we'll use in defining the headline
\newlength{\residual}
\setbeamertemplate{headline}{
\leavevmode
\setlength{\residual}{\paperwidth-20cm}
\begin{beamercolorbox}[wd=\paperwidth]{headline}
\begin{columns}[c]
\begin{column}{1cm}
\end{column}
\begin{column}[b]{9cm}
%{\large\usebeamercolor[fg]{author in headline}\href{[email protected]}{[email protected]}}
\end{column}
\begin{column}{\residual}
\vskip1cm
\centering
\usebeamercolor{title in headline}{
\color{fg}{\Huge\selectfont {\inserttitle}}\\[3ex]}
\usebeamercolor{author in headline}{
\color{fg}\Large{\insertauthor}\\[1ex]}
\usebeamercolor{institute in headline}{
\color{fg}\large{\insertinstitute}\\[1ex]}
\end{column}
\begin{column}[t]{9cm}
\end{column}
\begin{column}{1cm}
\end{column}
\end{columns}
\vskip2ex
\end{beamercolorbox}
\begin{beamercolorbox}[wd=\paperwidth]{lower separation line head}
\rule{0pt}{3pt}
\end{beamercolorbox}
}
% Alignment grid
%\beamertemplategridbackground[1cm]
% no navigation on a poster
\setbeamertemplate{navigation symbols}{}
% Make the figure caption labels bold
%\setbeamerfont{caption}{series=\bfseries}
% Beamer disables figure numbering by default (it assumes figure numbers on
% slides would not make sense). This command restores autonubering
\setbeamertemplate{caption}[numbered]
\setbeamerfont{caption name}{series=\bfseries}
\setbeamertemplate{caption label separator}[period]
\setbeamerfont*{block title}{family=\sffamily,series=\bfseries,size=\large}
期望的行為是多列環境的左邊距和右邊距應該相同。有什麼想法嗎?
更最小的 MWE - 觀察\setbeamercolor{block body}{bg=gray,fg=black}
移除後會發生什麼。
\documentclass{beamer}
\setbeamercolor{block body}{bg=gray,fg=black}
\begin{document}
\begin{frame}{}
\hrulefill
\begin{columns}[T,onlytextwidth]
\begin{column}{.4\textwidth}
\hrulefill
\begin{block}{test}
test
\end{block}
\end{column}
\begin{column}{.4\textwidth}
\hrulefill
\begin{block}{test}
test
\end{block}
\end{column}
\end{columns}
\vskip1cm
\hrulefill
\begin{columns}[T,onlytextwidth]
\begin{column}{.4\textwidth}
\hrulefill
\end{column}
\begin{column}{.4\textwidth}
\hrulefill
\end{column}
\end{columns}
\end{frame}
\end{document}
答案1
解決方法:
\documentclass[]{beamer}
%% Set up as beamerposter
%\usepackage{grffile}
%\usepackage{hyperref}
\usepackage{calc}
%\usepackage{tcolorbox}
%\usepackage{lmodern}% http://ctan.org/pkg/lm
%\ProvidesPackageRCS $Header: /Users/joseph/Documents/LaTeX/beamer/base/themes/theme/beamerthemeSingapore.sty,v d02a7cf4d8ae 2010/06/17 09:11:41 rivanvx $
\DeclareOptionBeamer{compress}{\beamer@compresstrue}
\ProcessOptionsBeamer
\mode<presentation>
\setbeamercolor{section in head/foot}{use=structure,bg=structure.fg!25!bg}
\useoutertheme[subsection=false]{miniframes}
\setbeamertemplate{frametitle}[default][center]
\AtBeginDocument{%
{
\usebeamercolor{section in head/foot}
}
\pgfdeclareverticalshading{beamer@headfade}{\paperwidth}
{%
color(0cm)=(bg);
color(1.25cm)=(section in head/foot.bg)%
}
\setbeamercolor{section in head/foot}{bg=}
}
\beamertemplatedotitem
\mode
<all>
% Template from T has special colors
\definecolor{TYellow}{RGB}{234,230, 99}
\definecolor{TBlue}{RGB}{ 29, 23, 96}
\definecolor{TAzure}{RGB}{151,147,204}
\definecolor{TWhite}{RGB}{255,255,255}
\definecolor{TPale}{RGB}{232,229,177}
\definecolor{VABlue}{RGB}{25,73,128}
\definecolor{RUST}{HTML}{EB7A59}
\definecolor{AZURE}{HTML}{5AA0DF}
\definecolor{OCHRE}{HTML}{EEA300}
\definecolor{TURQUOISE}{HTML}{00BAC9}
\definecolor{BLACK}{HTML}{44525C}
\definecolor{WHITE}{HTML}{F1F0E9}
% Configure the colors for the headline
\setbeamercolor{headline}{bg=BLACK,fg=OCHRE}
\setbeamercolor{title in headline}{bg=BLACK,fg=OCHRE}
\setbeamercolor{author in headline}{bg=BLACK,fg=TWhite}
\setbeamercolor{institute in headline}{bg=BLACK,fg=TWhite}
\setbeamercolor{date in headline}{bg=BLACK,fg=TWhite}
\setbeamercolor{logobox}{bg=BLACK}
\setbeamercolor{block title}{bg=white,fg=VABlue}
\setbeamercolor{block body}{bg=WHITE,fg=black}
\setbeamercolor{block title}{bg=BLACK,fg=TWhite}
% define a new register to hold an intermediate size calculation
% that we'll use in defining the headline
\newlength{\residual}
\setbeamertemplate{headline}{
\leavevmode
\setlength{\residual}{\paperwidth-20cm}
\begin{beamercolorbox}[wd=\paperwidth]{headline}
\begin{columns}[c]
\begin{column}{1cm}
\end{column}
\begin{column}[b]{9cm}
%{\large\usebeamercolor[fg]{author in headline}\href{[email protected]}{[email protected]}}
\end{column}
\begin{column}{\residual}
\vskip1cm
\centering
\usebeamercolor{title in headline}{
\color{fg}{\Huge\selectfont {\inserttitle}}\\[3ex]}
\usebeamercolor{author in headline}{
\color{fg}\Large{\insertauthor}\\[1ex]}
\usebeamercolor{institute in headline}{
\color{fg}\large{\insertinstitute}\\[1ex]}
\end{column}
\begin{column}[t]{9cm}
\end{column}
\begin{column}{1cm}
\end{column}
\end{columns}
\vskip2ex
\end{beamercolorbox}
\begin{beamercolorbox}[wd=\paperwidth]{lower separation line head}
\rule{0pt}{3pt}
\end{beamercolorbox}
}
% Alignment grid
%\beamertemplategridbackground[1cm]
% no navigation on a poster
\setbeamertemplate{navigation symbols}{}
% Make the figure caption labels bold
%\setbeamerfont{caption}{series=\bfseries}
% Beamer disables figure numbering by default (it assumes figure numbers on
% slides would not make sense). This command restores autonubering
\setbeamertemplate{caption}[numbered]
\setbeamerfont{caption name}{series=\bfseries}
\setbeamertemplate{caption label separator}[period]
\setbeamerfont*{block title}{family=\sffamily,series=\bfseries,size=\large}
% Enable T1 (more modern) fonts
\usepackage[T1]{fontenc}
\usepackage[greek,english]{babel}
\usepackage{textgreek}
\usepackage[utf8]{inputenc}
\usepackage{grffile}
\usepackage{ragged2e}
\usepackage{amsmath,amsthm, amssymb, latexsym}
\title[]{Title}
\author[]{Authors}
\date{}
\institute[]{Institute}
\newsavebox{\squaredblocktext}
\setbeamertemplate{block begin}{
\par\vskip\medskipamount%
\makebox[\dimexpr\textwidth-1.5ex\relax][l]{%
\begin{beamercolorbox}[colsep*=.75ex]{block title}
\usebeamerfont*{block title}\insertblocktitle%
\end{beamercolorbox}}%
\begin{lrbox}{\squaredblocktext}%
\begin{minipage}[t]{\textwidth}%
\ifbeamercolorempty[bg]{block body}{\vskip-.25ex}{\vskip-.75ex}\vbox{}%
}
\setbeamertemplate{block end}{
\end{minipage}%
\end{lrbox}%
{\parskip0pt\par}%
\ifbeamercolorempty[bg]{block title}{}
{\ifbeamercolorempty[bg]{block body}{}{\nointerlineskip\vskip-0.5pt}}%
\usebeamerfont{block body}%
\makebox[\dimexpr\textwidth-1.5ex\relax][l]{%
\begin{beamercolorbox}[colsep*=.75ex,vmode]{block body}%
\usebox{\squaredblocktext}
\end{beamercolorbox}%
}\vskip\smallskipamount%
}
\begin{document}
\setlength\columnsep{0pt}
\begin{frame}{}
\begin{block}{}
I've placed hrules in the columns to show that the spacing error comes from the column environment and not the block environment.\\
\hrulefill
\begin{columns}[T,onlytextwidth]
\begin{column}{.5\textwidth-.5cm}\hrulefill\begin{block}{}\vspace{5em}\end{block}\end{column}
\begin{column}{.5\textwidth-.5cm}\hrulefill\begin{block}{}\end{block}\end{column}
\end{columns}
\end{block}
The problem is not related to Beamer blocks as "naked" columns show the same issue:\\
\hrulefill
\begin{columns}[T,onlytextwidth]
\begin{column}{.5\textwidth-.5cm}\hrulefill\begin{block}{}\end{block}\end{column}
\begin{column}{.5\textwidth-.5cm}\hrulefill\begin{block}{}\end{block}\end{column}
\end{columns}
\end{frame}
\end{document}