beamerposter 将肖像选项传递给自定义主题

beamerposter 将肖像选项传递给自定义主题

嗨,我正在为 beamerposter 准备一个自定义主题,以与我所在机构的主题保持一致。我必须在标题上添加一个图形横幅,并可能包含 2 个不同的徽标。到目前为止,我在 .sty 文件中已经这样做了

\setbeamertemplate{headline}{  
\leavevmode
 \parbox{\textwidth}{\includegraphics[width=\paperwidth]{poster-banner}}
 \vskip-35ex
 \begin{beamercolorbox}[wd=\paperwidth]{headline}
 \begin{columns}[T]
  \begin{column}{.2\paperwidth}
    \begin{center} 
      \ifdefined\LeftLogo 
      \includegraphics[width=.6\linewidth,keepaspectratio,clip]{\LeftLogo} 
      \else 
      \fi 
    \end{center} 
    \vskip1.5cm 
  \end{column}
  \begin{column}{.65\paperwidth}
    \hskip1ex
    \vskip4ex
    \raggedright
    \usebeamercolor{title in headline}{\color{fg}\textbf{\LARGE{\inserttitle}}\\[1ex]}
    \usebeamercolor{author in headline}{\color{fg}\Large{\insertauthor}\\[0.5ex]}
    \usebeamercolor{institute in headline}{\color{fg}\large{\insertinstitute}\\[1ex]}     
  \end{column}
  \begin{column}{.15\paperwidth}
    \begin{center} 
      \ifdefined\RightLogo 
      \includegraphics[width=.6\linewidth,keepaspectratio,clip]{\RightLogo} 
      \else 
      \fi 
    \end{center} 
    \vskip1.5cm 
\end{column}
\end{columns}
\end{beamercolorbox}}

其中 \RightLogo 和 \LeftLogo 在

\def\RightLogo{logoa.pdf}
\def\LeftLogo{logob.pdf}
\documentclass[final]{beamer}

这个技巧在 Beamerposter 的纵向模式下效果很好。但每当我使用横向选项时,横幅的高度就太大了。所以我认为我应该根据传递给 Beamerposter 的选项以不同的方式传递横幅的尺寸和 vskip 的数量(即 orientation=portrait,orientation=landscape)。但我不知道如何推断这些选项。我希望我能解释清楚。我知道我应该给出 MWE,但我希望它足够了,因为我已经这样做了

答案1

该命令\ifportrait检测的值orientation。因此,您可以替换您的行

\parbox{\textwidth}{\includegraphics[width=\paperwidth]{poster-banner}}

对每种情况进行测试并给出适当的代码

\ifportrait 
  \parbox{\textwidth}{\includegraphics[width=\textwidth]{poster-banner}}
\else
  \parbox{\textwidth}{\includegraphics[width=\textwidth,height=10cm]{poster-banner}}
\fi

格式是\ifportrait <portait-case> \else <landscape-case> \fi。我随机选择了 10cm 的高度landscape,您需要根据具体情况写一些合适的内容。例如,您可能会发现比minipage更合适的,\parbox并且可以写

\begin{minipage}{\textwidth}
   \centering\includegraphics[width=0.5\textwidth]{poster-banner}
\end{minipage}

在景观案例中。

要将其用作样式,请将以下内容放入文件中beamerthemeProva.sty

\mode<presentation>

\setbeamertemplate{headline}{  
\leavevmode
\ifportrait 
  \parbox{\textwidth}{\includegraphics[width=\textwidth]{example-image-a}}
\else
  \begin{minipage}{\textwidth}\centering\includegraphics[width=0.5\textwidth,height=15cm]{example-image-a}\end{minipage}
\fi
 \vskip-35ex
 \begin{beamercolorbox}[wd=\paperwidth]{headline}
 \begin{columns}[T]
  \begin{column}{.2\paperwidth}
    \begin{center} 
      \ifdefined\LeftLogo 
      \includegraphics[width=.6\linewidth,keepaspectratio,clip]{\LeftLogo} 
      \else 
      \fi 
    \end{center} 
    \vskip1.5cm 
  \end{column}
  \begin{column}{.65\paperwidth}
    \hskip1ex
    \vskip4ex
    \raggedright
    \usebeamercolor{title in headline}{\color{fg}\textbf{\LARGE{\inserttitle}}\\[1ex]}
    \usebeamercolor{author in headline}{\color{fg}\Large{\insertauthor}\\[0.5ex]}
    \usebeamercolor{institute in headline}{\color{fg}\large{\insertinstitute}\\[1ex]}     
  \end{column}
  \begin{column}{.15\paperwidth}
    \begin{center} 
      \ifdefined\RightLogo 
      \includegraphics[width=.6\linewidth,keepaspectratio,clip]{\RightLogo} 
      \else 
      \fi 
    \end{center} 
    \vskip1.5cm 
\end{column}
\end{columns}
\end{beamercolorbox}}

\mode<all>

然后你就可以得到一个主文档(beamerposter 发行版中标准示例的变体),如下所示

\def\RightLogo{example-image-a.pdf}
\def\LeftLogo{example-image-b.pdf}
\documentclass[final]{beamer}

\mode<presentation> { \usetheme{Berlin} 
\usepackage{times}
\usepackage{amsmath,amsthm, amssymb, latexsym}
\boldmath
\usepackage[english]{babel}
\usepackage[latin1]{inputenc}
\usepackage[orientation=landscape,size=a0,scale=1.4,debug]{beamerposter}
\usetheme{Prova} }

  \graphicspath{{figures/}}
  \title[Fancy Posters]{Making Really Fancy Posters with \LaTeX}
  \author[Dreuw \& Deselaers]{Philippe Dreuw and Thomas Deselaers}
  \institute[RWTH Aachen University]{Human Language Technology and Pattern Recognition, RWTH Aachen University}
  \date{Jul. 31th, 2007}


  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%5
  \begin{document}
  \begin{frame}{} 
    \vfill
    \begin{block}{\large Fontsizes}
      \centering
      {\tiny tiny}\par
      {\scriptsize scriptsize}\par
      {\footnotesize footnotesize}\par
      {\normalsize normalsize}\par
      {\large large}\par
      {\Large Large}\par
      {\LARGE LARGE}\par
      {\veryHuge VeryHuge}\par
      {\VeryHuge VeryHuge}\par
      {\VERYHuge VERYHuge}\par
    \end{block}
    \vfill
    \vfill
    \begin{block}{\large Fontsizes}
      \centering
      {\tiny tiny}\par
      {\scriptsize scriptsize}\par
      {\footnotesize footnotesize}\par
      {\normalsize normalsize}\par
      {\large large}\par
      {\Large Large}\par
      {\LARGE LARGE}\par
      {\veryHuge VeryHuge}\par
      {\VeryHuge VeryHuge}\par
      {\VERYHuge VERYHuge}\par
    \end{block}
    \vfill
    \begin{columns}[t]
      \begin{column}{.48\linewidth}
        \begin{block}{Introduction}
          \begin{itemize}
          \item some items
          \item some items
          \item some items
          \item some items
          \end{itemize}
        \end{block}
      \end{column}
      \begin{column}{.48\linewidth}
        \begin{block}{Introduction}
          \begin{itemize}
          \item some items and $\alpha=\gamma, \sum_{i}$
          \item some items
          \item some items
          \item some items
          \end{itemize}
          $$\alpha=\gamma, \sum_{i}$$
        \end{block}

        \begin{block}{Introduction}
          \begin{itemize}
          \item some items
          \item some items
          \item some items
          \item some items
          \end{itemize}
        \end{block}

        \begin{block}{Introduction}
          \begin{itemize}
          \item some items and $\alpha=\gamma, \sum_{i}$
          \item some items
          \item some items
          \item some items
          \end{itemize}
          $$\alpha=\gamma, \sum_{i}$$
        \end{block}
      \end{column}
    \end{columns}
  \end{frame}
\end{document}

您现在可以将方向从 更改为landscapeportrait获得不同的效果。

相关内容