如何设置 beamer 中整列的背景颜色?

如何设置 beamer 中整列的背景颜色?

我正在制作一张海报(a2 尺寸),使用图片作为背景。但是,我需要在左上角添加一个带有白色背景的徽标。

\documentclass{beamer}
\usepackage[size=a2, orientation=landscape]{beamerposter}

\setbeamercolor{separation line}{bg=black}

% ----------- Global Background -------------
\usebackgroundtemplate%
{%
    \includegraphics[width=\paperwidth,height=\paperheight]{background_image}%
}

% ----------------- Headline ------------------
\setbeamertemplate{headline}{

\begin{columns}
\begin{column}{0.2\textwidth}
% ############ This is the column I want a white background for #################
\usebackgroundtemplate{bg=white}
\begin{beamercolorbox}{headline}
    \centering \includegraphics{logo}
\end{beamercolorbox}
\end{column}
\vline
\begin{column}{0.6\textwidth}
\begin{beamercolorbox}[wd=.6\paperwidth]{headline}
                                \centering
        \vskip2ex
        \usebeamercolor{title in headline}{\color{fg}\textbf{\LARGE{\inserttitle}}\\[1ex]}
        \usebeamercolor{author in headline}{\color{fg}\large{\insertauthor}\\[1ex]}
        \usebeamercolor{institute in headline}{\color{fg}\large{\insertinstitute}\\[1ex]}
\end{beamercolorbox}
\end{column}

% This column is just to make the title column centered... Let me know if you have  a better solution
\begin{column}{0.2\textwidth}

\end{column}
\end{columns}

\begin{beamercolorbox}[wd=\paperwidth]{lower separation line head}
    \rule{0pt}{2pt}
\end{beamercolorbox}
}

\title{Title}
\author{Author}
\institute{institute}


\begin{document}
This is some text
\end{document}

我希望左上角有白色背景,其余部分有 background_image 作为背景。有办法吗?

如果有更好的方法使标题等居中,而不需要标题中最右边的列,我也会很感激这方面的建议。

使用(例如)http://en.wikipedia.org/wiki/File:Chiswick_Lion.png作为“徽标”和 http://en.wikipedia.org/wiki/File:KA-Tapete-Beerdigung05.JPG作为“background_image”来说明问题。


蹩脚的半途而废的解决方案:

宣布

\setbeamercolor{headline}{bg=white}
\setbeamercolor*{example header}{fg=black}

将前两列的类型更改为“示例标题”,并将图像移动到最右边的列(之前为空的列)。

\setbeamertemplate{headline}{
\begin{columns}
\begin{column}{0.2\textwidth}
\begin{beamercolorbox}[wd=0.2\paperwidth]{example header}

\end{beamercolorbox}
\end{column}

\begin{column}{0.6\textwidth}
\begin{beamercolorbox}[wd=.6\paperwidth]{example header}
                                \centering
        \vskip2ex
        \usebeamercolor{title in headline}{\color{fg}\textbf{\LARGE{\inserttitle}}\\[1ex]}
        \usebeamercolor{author in headline}{\color{fg}\large{\insertauthor}\\[1ex]}
        \usebeamercolor{institute in headline}{\color{fg}\large{\insertinstitute}\\[1ex]}
\end{beamercolorbox}
\end{column}
\vline
\begin{column}{0.2\textwidth}
\begin{beamercolorbox}[wd=0.2\paperwidth]{headline}
    \vfill
    \centering
    \includegraphics[scale=1]{logo}
    \vfill
    \end{beamercolorbox}
\end{column}
\end{columns}

\begin{beamercolorbox}[wd=\paperwidth]{lower separation line head}
    \rule{0pt}{2pt}
\end{beamercolorbox}
}

然后,标志现在出现在右边,我不喜欢,但背景是白色的,我就像.. 在 之前似乎有一些无法用其他方式填充的空间\vline

另请注意,您可能需要根据图片的大小缩放图片。

如果有聪明人找到了一个好方法来做到这一点,请告诉我。


最终编辑,一年零三个月后(为了完整性,随机重新发现更新)。我实际上并没有解决我最初的问题,所以这是以防万一有人想尝试做同样的事情,而且一直知道它最终看起来不会很好;

我最终放弃了最初的意图,做了一些更漂亮的事情,将徽标放在页脚的中央(在纯色背景上,所以我可能设法用这种方式做了标题,但意识到它看起来很糟糕)。海报最终看起来不错。页脚如下所示:

\setbeamertemplate{footline}{
    \leavevmode
        \hbox{

            \begin{beamercolorbox}[wd=.333\paperwidth,ht=2.5cm,leftskip=1cm,rightskip=1cm,center]{footline}
                \insertinstitute\hspace*{2em}
                \vspace{.8cm}
            \end{beamercolorbox}

            \begin{beamercolorbox}[wd=.333\paperwidth,ht=2.5cm,leftskip=1cm,rightskip=1cm,center]{footline}%
                \includegraphics[scale=1]{logo}
                \vskip.5ex
            \end{beamercolorbox}

            \begin{beamercolorbox}[wd=.333\paperwidth,ht=2.5cm,leftskip=1cm,rightskip=1cm,center]{footline}
                \insertfooter\hspace*{2em}
                \vspace{.8cm}
            \end{beamercolorbox}

        }
}

并且是我编写的自定义主题的一部分(创建为.sty带有声明的文件并包含在with\ProvidesPackage{theme_name}中),这使得它更容易调整和维护,因为所有的设计都在其中(有点类似于文档的文件)。.tex\usetheme{theme_name}CSSHTML

\insertinstitute一边使用\insertfooter,另一边使用可能看起来很奇怪,但仅仅因为它说的是“机构”或“页脚”并不意味着你不能将它们用于更有用的东西(我就是这么做的)!

答案1

根据您的“半途而废”解决方案,首先放置徽标列会将徽标移到左侧,如您所愿。此外,放置在环境\vline内部column会消除行前的空间。这可能不太优雅,但希望这是您想要的。请注意,使用此方法时,徽标的高度决定了标题的高度。

\documentclass{beamer}
\usepackage[size=a2, orientation=landscape]{beamerposter}
\usepackage{mwe}
\setbeamercolor{separation line}{bg=black}
\setbeamercolor{headline}{bg=white}
\setbeamercolor*{example header}{fg=black}

% ----------- Global Background -------------
\usebackgroundtemplate{%
    \includegraphics[width=\paperwidth,height=\paperheight]{example-image}%
}

% ----------------- Headline ------------------
\setbeamertemplate{headline}{%
\begin{columns}
\begin{column}{0.2\paperwidth}
\begin{beamercolorbox}[wd=0.99\linewidth]{headline}
    \vfill
    \centering
    \includegraphics[height=9cm]{example-image-golden-upright}
    \vfill
    \end{beamercolorbox}
\vline
\end{column}%

\begin{column}{0.6\textwidth}
\begin{beamercolorbox}[wd=.6\paperwidth]{example header}
    \centering
    \usebeamercolor{title in headline}{\color{fg}\textbf{\Huge{\inserttitle}\\[1ex]}}
    \usebeamercolor{author in headline}{\color{fg}{\huge{\insertauthor}\\[1ex]}}
    \usebeamercolor{institute in headline}{\color{fg}{\LARGE{\insertinstitute}\\[1ex]}}
\end{beamercolorbox}
\end{column}

\begin{column}{0.2\textwidth}
\begin{beamercolorbox}[wd=0.2\paperwidth]{example header}
\end{beamercolorbox}
\end{column}
\end{columns}

\begin{beamercolorbox}[wd=\paperwidth]{lower separation line head}
    \rule{0pt}{2pt}
\end{beamercolorbox}
}
\title{Title}
\author{Author}
\institute{Institute}

\begin{document}
This is some text.
\end{document}

相关内容