[Tex/LaTex] Make a heading in beamer


I would like to have the ability to add "headings" to content in my beamer slides.
By heading I just mean slightly larger text that automatically breaks the row and adds some margins to the surrounding text.
Basically something that is exactly like the \section command when writing an article.

I have so far done this using the block environment like

\begin{block}{The heading}
The content goes here.

which worked with my previous theme since the block background was the same as the slide background.
But in my new theme I want to have the usual colored boxes, so some other method is required.

I tried implementing a new headingblock environment that is basically a block environment with new colors:

  \setbeamercolor{block body}{bg=white, fg=black}
  \setbeamercolor{block title}{bg=white, fg=liu_blue}

The problem is that everything else inside the block is affected by the \setbeamercolor calls which means I can't have another block inside the headingblock.
Also it feels kind of hackish.

What is the best way to implement this?

To be extra clear, I am not looking for a frame title, but subheadings within the frame. Something like:

  \frametitle{The slide}

  \myheading{The first heading}
  Some text and stuff that goes with the first heading

  \myheading{Second heading}
  More stuff goes here.

Best Answer

You can define your own block structure in a similar way in which beamer defines exampleblock or alertblock, and set the block title and block body colors for this new block as desired. The original definitions can be found in the file beamerbaselocalstructure.sty. Here's a definition of such a block that you can adjust according to your needs:


     \setbeamercolor{block title}{fg=orange,bg=structure}
     %\setbeamercolor{block body}{fg=green,bg=orange} % to customize the colors of the block body
      \usebeamertemplate{block begin}}
      \usebeamertemplate{block end}%


\begin{headingblock}{A test heading}
Some test text.


enter image description here

If you are not interested in a block and want something simpler, you can do something along the following lines (again, adjust the settings according to your needs):




Some test text.
\myheading{A test heading}
Some test text.


enter image description here