我正在尝试制作一张投影机海报。我将海报按列组织起来。在两列中,我想将一些块对齐到页面的中间。我目前的方法是尝试强制它们上方的块具有相同的高度,尽管我愿意接受其他建议。我\vbox
在块内插入 s 以尝试设置它们的高度。这在一定程度上有效,但会与垂直填充相互作用,并导致不同的有效高度,具体取决于块包含文本还是图形。让第二行块垂直对齐的最佳方法是什么?
以下是我不太简单的例子
\documentclass[]{beamer}
% Set up as beamerposter
\usepackage[orientation=landscape,size=A2,scale=1.47,debug]{beamerposter}
\usetheme{Modified}
\usepackage[T1]{fontenc}
\usepackage[greek,english]{babel}
\usepackage{textgreek}
\usepackage[utf8]{inputenc}
\graphicspath{{./figures/}}
\usepackage[super]{nth}
\usepackage{grffile}
\usepackage{amsmath,amsthm, amssymb, latexsym}
\usepackage{subcaption}
\usepackage{lipsum}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document information
\title{Title}
\author[]{Authors}
\institute[]{
Institute1\\
Institute2
}
% 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]
\begin{document}
% beamer has a problem filling vertical space in colums
% have to manually specify column heights
%
\newlength{\colheightb}
\setlength{\colheightb}{0.8775\paperheight}
% beamer can't really vertically align blocks properly
% Workaround is to do manual alignment
%
\newlength{\blockheight}
\setlength{\blockheight}{23cm}
% Latex places too much space beneath figure captions.
% This variable makes an adjustment
\setlength{\belowcaptionskip}{-0.5ex}
% I want the scatter plots to be exactly the same size
\newlength{\scatterwidth}
\setlength{\scatterwidth}{30cm}
% There was too much space between the title and the blocks, this was the patch
\newlength{\yfudge}
\setlength{\yfudge}{-0.85cm}
\begin{frame}{}
\begin{columns}[T, totalwidth=\textwidth]
\begin{column}{.49\linewidth}
\vspace{\yfudge}
\vbox to \colheightb{%
\begin{block}{Section}
\vbox to \blockheight{
The block containing text is a little bit taller, and also the vertical padding between the title and the text is reduced (eliminated?).
}
\end{block}
\begin{block}{Section}
\end{block}
\vfill
}
\end{column}
\begin{column}{.49\linewidth}
\vspace{\yfudge}
\vbox to \colheightb{%
\begin{block}{Section}
\vbox to \blockheight{
\begin{figure}[H]
\vspace{10ex}
\caption{The block contianing a figure is not the correct height!}
\end{figure}
}
\end{block}
\begin{block}{Section}
{
}
\end{block}
\vfill
}
\end{column}
\end{columns}
\end{frame}
\end{document}
这是样式文档
\usepackage{grffile}
\usepackage{calc}
\usepackage{tcolorbox}
\usepackage{lmodern}
\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>
\setbeamercolor{headline}{bg=black,fg=white}
\setbeamercolor{title in headline}{bg=black,fg=white}
\setbeamercolor{author in headline}{bg=black,fg=white}
\setbeamercolor{institute in headline}{bg=black,fg=white}
\setbeamercolor{date in headline}{bg=black,fg=white}
\setbeamercolor{block body}{bg=white,fg=black}
\setbeamercolor{block title}{bg=black,fg=white}
\setbeamertemplate{headline}{
\leavevmode
\begin{beamercolorbox}[wd=\paperwidth]{headline}
\vskip1cm
\raggedright
\usebeamercolor{title in headline}{
\color{fg}{\fontsize{110}{110}\selectfont {\inserttitle}}\\[3ex]}
\usebeamercolor{author in headline}{
\color{fg}\LARGE{\insertauthor}\\[1ex]}
\usebeamercolor{institute in headline}{
\color{fg}\large{\insertinstitute}\\[1ex]}
\vskip2ex
\end{beamercolorbox}
\begin{beamercolorbox}[wd=\paperwidth]{lower separation line head}
\rule{0pt}{3pt}
\end{beamercolorbox}
}
% no navigation on a poster
\setbeamertemplate{navigation symbols}{}
% Use rounded blocks
%\setbeamertemplate{blocks}[rounded]
% Larger titles for the block
\makeatletter
\newcommand\semiHuge{\@setfontsize\semiHuge{45}{40}}
\makeatother
\setbeamerfont*{block title}{family=\sffamily,series=\bfseries,size=\semiHuge}
编辑:更新:我可以通过手动调整块高度直到它们大致匹配来完成我的海报。这不是解决方案,但必须这样做。
编辑:堆叠列环境无法按需要工作
有人建议通过堆叠两列环境来实现正确的垂直对齐。如果只有两列,这种方法是可行的,但我的用例更复杂,这在之前的最小示例中没有反映出来。我创建了一个新的最小示例来说明为什么列对齐方法不适合这里,因为它需要嵌套列环境,这会在顶部产生新的垂直对齐问题。
\documentclass[]{beamer}
% Set up as beamerposter
\usepackage[orientation=landscape,size=A2,scale=1.47,debug]{beamerposter}
\usetheme{Modified}
\usepackage[T1]{fontenc}
\usepackage[greek,english]{babel}
\usepackage{textgreek}
\usepackage[utf8]{inputenc}
\graphicspath{{./figures/}}
\usepackage[super]{nth}
\usepackage{grffile}
\usepackage{amsmath,amsthm, amssymb, latexsym}
\usepackage{subcaption}
\usepackage{lipsum}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document information
\title{Title}
\author[]{Authors}
\institute[]{
Institute1\\
Institute2
}
% 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]
\begin{document}
% beamer has a problem filling vertical space in colums
% have to manually specify column heights
%
\newlength{\colheightb}
\setlength{\colheightb}{0.7\paperheight}
% beamer can't really vertically align blocks properly
% Workaround is to do manual alignment
%
\newlength{\blockheight}
\setlength{\blockheight}{10cm}
% Latex places too much space beneath figure captions.
% This variable makes an adjustment
\setlength{\belowcaptionskip}{-0.5ex}
% There was too much space between the title and the blocks, this was the patch
\newlength{\yfudge}
\setlength{\yfudge}{-0.85cm}
\begin{frame}{}
\begin{columns}[T, totalwidth=\textwidth]
\begin{column}{.32\linewidth}
\vbox to \colheightb{%
\begin{block}{Section}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
\end{block}
\vfill
\begin{block}{Section}
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{block}
}
\end{column}
\begin{column}{.67\linewidth}
\vbox to \colheightb{%
\begin{columns}[t,totalwidth=\textwidth]
\begin{column}{.48\linewidth}
\begin{block}{Section}
\vbox to \blockheight{Different height, and vertical padding between is reduced?!}
\end{block}
\end{column}
\begin{column}{.48\linewidth}
\begin{block}{Section}
\begin{figure}[H]
\vbox to \blockheight{
\vspace{10ex}
\caption{The block contianing a figure is not the correct height!}}
\end{figure}
\end{block}
\end{column}
\end{columns}
\begin{columns}[T, totalwidth=\textwidth]
\begin{column}{.48\linewidth}
\begin{block}{Section}
\end{block}
\end{column}
\begin{column}{.48\linewidth}
\begin{block}{Section}
\end{block}
\end{column}
\end{columns}
\vfill
}
\end{column}
\end{columns}
\end{frame}
\end{document}
答案1
以下是使用迷你页面而不是列环境。minipages 的优点是您可以指定高度。垂直对齐由 完成\hfill
。
命令是\begin{minipage}[alignment][HEIGHT][alignment]{WIDTH}...\end{minipage}
文本和图形现在似乎对齐了,但如果它没有按照您希望的方式工作,请告诉我。
我还创建了一个新的环境(称为 MRuleBlock),这可能会简化您的代码。代码生成两个幻灯片,一个没有新环境,一个有。
代码:
\documentclass[]{beamer}
% Set up as beamerposter
\usepackage[orientation=landscape,size=A2,scale=1.47,debug]{beamerposter}
\usetheme{Modified}
\usepackage[T1]{fontenc}
\usepackage[greek,english]{babel}
\usepackage{textgreek}
\usepackage[utf8]{inputenc}
\graphicspath{{./figures/}}
\usepackage[super]{nth}
\usepackage{grffile}
\usepackage{amsmath,amsthm, amssymb, latexsym}
%\usepackage{subcaption}
\usepackage{lipsum}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Document information
\title{Title}
\author[]{Authors}
\institute[]{
Institute1\\
Institute2
}
\newlength{\blockheight}
\setlength{\blockheight}{.5\textheight}
\newlength{\blockwidth}
\setlength{\blockwidth}{.31\textwidth}
\newenvironment{MRuleBlock}[3]{%
\begin{minipage}[t][#2][t]{#3}%
\begin{block}{#1}%
}{%
\end{block}%
\end{minipage}%
}
% 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]
\begin{document}
\begin{minipage}[t][\blockheight][t]{\blockwidth}
\begin{block}{Section}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
\end{block}
\end{minipage}
\hfill
\begin{minipage}[t][\blockheight][t]{\blockwidth}
\begin{block}{Section}
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{block}
\end{minipage}
\hfill
\begin{minipage}[t][\blockheight][t]{\blockwidth}
\begin{block}{Section}
\end{block}
\end{minipage}
\begin{minipage}[t][][t]{\blockwidth}
\begin{block}{Section}
Different height, and vertical padding between is reduced?!
\end{block}
\end{minipage}
\hfill
\begin{minipage}[t][][t]{\blockwidth}
\begin{block}{Section}
\begin{figure}[H]
\caption{The block containing a figure is the correct height!}
\end{figure}
\end{block}
\end{minipage}
\hfill
\begin{minipage}[t][][t]{\blockwidth}
\begin{block}{Section}
\lipsum[1]
\end{block}
\end{minipage}
\newpage
\begin{MRuleBlock}{Section}{\blockheight}{\blockwidth}
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
\end{MRuleBlock}
\hfill
\begin{MRuleBlock}{Section}{\blockheight}{\blockwidth}
Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
\end{MRuleBlock}
\hfill
\begin{MRuleBlock}{Section}{\blockheight}{\blockwidth}
\end{MRuleBlock}
\begin{MRuleBlock}{Section}{}{\blockwidth}
Different height, and vertical padding between is reduced?!
\end{MRuleBlock}
\hfill
\begin{MRuleBlock}{Section}{}{\blockwidth}
\begin{figure}[H]
\caption{The block containing a figure is the correct height!}
\end{figure}
\end{MRuleBlock}
\hfill
\begin{MRuleBlock}{Section}{}{\blockwidth}
\lipsum[1]
\end{MRuleBlock}
\end{document}
这使:
您显然可以尝试各种参数\blockheight
并\blockwidth
微调各个块。
答案2
columns
这会为您开启一套新的解决方案吗?
\documentclass[t]{beamer}
% Set up as beamerposter
\usepackage[orientation=landscape,size=A2,scale=1.47,debug]{beamerposter}
\begin{document}
\begin{frame}{}
\begin{columns}[T, totalwidth=\textwidth]
\begin{column}{.49\linewidth}
\begin{block}{Section}
The block containing text is a little bit taller, and also the vertical padding between the title and the text is reduced (eliminated?).
\end{block}
\end{column}
\begin{column}{.49\linewidth}
\begin{block}{Section}
\begin{figure}[H]
\vspace{60ex}
\caption{The block contianing a figure is not the correct height!}
\end{figure}
\end{block}
\end{column}
\end{columns}
\begin{columns}[T, totalwidth=\textwidth]
\begin{column}{.49\linewidth}
\begin{block}{Section}
The block containing text is a little bit taller, and also the vertical padding between the title and the text is reduced (eliminated?).
\end{block}
\end{column}
\begin{column}{.49\linewidth}
\begin{block}{Section}
The block containing text is a little bit taller, and also the vertical padding between the title and the text is reduced (eliminated?).
\end{block}
\end{column}
\end{columns}
\end{frame}
\end{document}