[Tex/LaTex] Beamerposter and altering blocks, alert blocks and example blocks

beamerposterblockformatting

So I'm just trying to get comfortable with making a poster with beamer. I'd like to be able to customize a few different block type environments and I'm not sure the best way to go about this. Additionally, I'm confused with possible conflicts between different packages and themes. So far I have been exploring two approaches: (1) altering the blocks, alert blocks and example blocks within beamer and (2) defining new block type environments with \newenvironment.

I've been unsuccessful with either, and I have some questions about both. In either case the basic code I'm using is:

\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}

So first with approach (1) I'd like to independently alter and define the three types of blocks so I can get three distinct textbox type things to my liking. Looking at the beamer manual it appeared that \setbeamertemplate{block} could be used but that this can't modify alert and example blocks. Additionally, I can't find a detailed explanation of the different options with the \setbeamertemplate command. I did play around with some pre made color themes like whale and orchid and basically I'd like to do what they do myself. Is there a way to personally affect similar changes within the latex document? Additionally, is \usetheme{confposter} going to affect/conflict with the templates of the blocks? I'm only using it because it won't compile the title and authors and such on the top when I take it out.

The other approach (2) I was playing around with was with \newenvironment which I was trying based on Define a new block environment in LaTeX beamer. For example doing

\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}
}

And then invoking

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

However, I couldn't find additional documentation that really detailed the options in \newenvironment. For example I couldn't get it to not say example in the Title etc. Can you point me in the direction of some documentation about \newenvironment and it's respective options?

So overall, do you think either of these approaches are good? Can you suggest something else or detailed documentation that would be pertinent to my aim?

Best Answer

  1. You can change the color attributes for the foreground and background for each kind of block independently using

    %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}
    

    Using font templates with the same names you can also control the fonts attributes, if desired.

    An example code:

    \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}
    

    enter image description here

  2. I would suggest you to have a look at the tcolorbox package with its beamer skin to define new types of blocks; here's a little example:

    \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}
    

    The result:

    enter image description here