Beamerposter 和更改區塊、警報區塊和範例區塊

Beamerposter 和更改區塊、警報區塊和範例區塊

所以我只是想熟悉用 製作海報beamer。我希望能夠自訂一些不同的區塊類型環境,但我不確定實現此目的的最佳方法。此外,我對不同包和主題之間可能存在的衝突感到困惑。到目前為止,我一直在探索兩種方法:(1) 更改blocks、alert blocks 和example blocks 內的s、s 和beamers,(2) 使用 定義新的區塊類型環境\newenvironment

我對這兩件事都沒有成功,我對這兩件事都有一些疑問。在任何一種情況下,我使用的基本程式碼是:

\documentclass[final]{beamer}
\usepackage[scale=0.90]{beamerposter} %scale is for fontsize?
\usepackage[absolute,overlay]{textpos}
\usepackage{color}
\usepackage{tikz}
\usepackage{amsmath,amssymb,latexsym}

\setlength{\TPHorizModule}{\paperwidth}
\setlength{\TPVertModule}{1 cm}

\usetheme{confposter}

\title{Title}
\author{Some People}
\institute{Department of Blah}
\begin{document}

\begin{textblock}{0.3}(.01,10)
    \begin{exampleblock}{An exampleblock environment}
Some text.
\end{exampleblock}

\begin{block}{A block environment}
Some text.
\end{block}
\begin{alertblock}{An alertblock environment}
Some text.
\end{alertblock}
\end{textblock}
\end{document}

因此,首先使用方法(1),我想獨立地更改和定義三種類型的區塊,以便我可以獲得三種不同的文字方塊類型的東西,以滿足我的喜好。查看beamer手冊,似乎\setbeamertemplate{block}可以使用,但不能修改alertexample阻止。此外,我找不到該\setbeamertemplate命令的不同選項的詳細解釋。我確實嘗試過一些預製的顏色主題,例如whaleorchid,基本上我想做他們自己做的事情。有沒有辦法親自影響乳膠文件中的類似更改?此外,是否\usetheme{confposter}會影響/與區塊的模板發生衝突?我只是使用它,因為當我取出它時,它不會在頂部編譯標題和作者等內容。

我正在嘗試的另一種方法(2)是\newenvironment我嘗試基於的在 LaTeX Beamer 中定義新的區塊環境。例如做

\newenvironment<>{test1}[1][]{
    \setbeamercolor{block body example}{fg=black,bg=blue}
    \setbeamercolor{block title example}{fg=white,bg=red!75!black}
    \setbeamertemplate{blocks}[rounded][shadow=false]
  \begin{example}[]}{\end{example}
}

然後調用

\begin{test1}[blah title]
stuff
\end{test1}

但是,我找不到真正詳細說明\newenvironment.例如,我無法在標題等中不說範例\newenvironment

總的來說,您認為這兩種方法都好嗎?您能否提出與我的目標相關的其他內容或詳細文件?

答案1

  1. 您可以使用以下命令獨立更改每種區塊的前景和背景的顏色屬性

    %For example blocks
    \setbeamercolor{block title example}{fg=red,bg=orange}
    \setbeamercolor{block body example}{fg=cyan,bg=yellow}
    
    %For alert blocks
    \setbeamercolor{block title alerted}{fg=olive,bg=pink}
    \setbeamercolor{block body alerted}{fg=blue,bg=magenta}
    
    %For blocks
    \setbeamercolor{block title}{fg=white,bg=blue}
    \setbeamercolor{block body}{fg=white,bg=green!40!black}
    

    如果需要,請使用具有相同名稱的字體模板,您還可以控製字體屬性。

    範例程式碼:

    \documentclass[final]{beamer}
    \usepackage[scale=0.90]{beamerposter} %scale is for fontsize?
    \usepackage[absolute,overlay]{textpos}
    \usepackage{color}
    \usepackage{tikz}
    \usepackage{amsmath,amssymb,latexsym}
    
    \setlength{\TPHorizModule}{\paperwidth}
    \setlength{\TPVertModule}{1 cm}
    
    %For example blocks
    \setbeamercolor{block title example}{fg=red,bg=orange}
    \setbeamercolor{block body example}{fg=cyan,bg=yellow}
    
    %For alert blocks
    \setbeamercolor{block title alerted}{fg=olive,bg=pink}
    \setbeamercolor{block body alerted}{fg=blue,bg=magenta}
    
    %For blocks
    \setbeamercolor{block title}{fg=white,bg=blue}
    \setbeamercolor{block body}{fg=white,bg=green!40!black}
    
    %\usetheme{confposter}
    
    \title{Title}
    \author{Some People}
    \institute{Department of Blah}
    \begin{document}
    
    \begin{textblock}{0.3}(.01,10)
        \begin{exampleblock}{An exampleblock environment}
    Some text.
    \end{exampleblock}
    
    \begin{block}{A block environment}
    Some text.
    \end{block}
    \begin{alertblock}{An alertblock environment}
    Some text.
    \end{alertblock}
    \end{textblock}
    \end{document}
    

    在此輸入影像描述

  2. 我建議你看看tcolorbox與其皮膚一起封裝beamer以定義新類型的塊;這是一個小例子:

    \documentclass[final,dvipsnames]{beamer}
    \usepackage[scale=0.90]{beamerposter} %scale is for fontsize?
    \usepackage[absolute,overlay]{textpos}
    \usepackage{color}
    \usepackage{tikz}
    \usetikzlibrary{shadings}
    \usepackage{amsmath,amssymb,latexsym}
    \usepackage[many]{tcolorbox}
    
    %\usetheme{confposter}
    
    \newtcolorbox{myblock}[1][]{
      beamer,
      width=\textwidth+7pt,
      enlarge left by=-3pt,
      colframe=block body.bg,
      bottom=0pt,
      top=-2pt,
      left=0pt,
      right=0pt,
      toptitle=-1pt,
      bottomtitle=-1pt,
      fonttitle=\normalfont,
      adjusted title=#1,
      interior titled code={
        \shade[left color=Maroon!80,right color=Dandelion,middle color=Salmon] 
          (title.south west) --
          (title.south east) {[rounded corners] -- 
          (title.north east)  -- 
          (title.north west)} --
          (title.south west); 
      }
    }
    
    \title{Title}
    \author{Some People}
    \institute{Department of Blah}
    
    \begin{document}
    
    \begin{frame}
    \begin{columns}
    \column{0.3\textwidth}
    \begin{block}{A standard block}
    This box ia a box provided by the \texttt{beamer} class.
    \end{block}
    
    \begin{myblock}[An example with \texttt{tcolorbox}]
    This box looks like a box provided by the \texttt{beamer} class.
    \end{myblock}
    \end{columns}
    \end{frame}
    
    \end{document}
    

    結果:

    在此輸入影像描述

相關內容