3

Is it possible to create 3 blocks in a single frame in beamer with a distribution as shown in the image below? The blocks must have the same width, and block C should be centered.

-----   -----
| A |   | B |
-----   -----
    -----
    | C |
    -----
  • You may have to resort to ERTs though... – Werner Jun 15 '14 at 17:38
5

One way to do this is with the help of some boxes.

  1. Inside a frame, add first an ERT with Ctrl + L and write \centering inside this.

  2. Do Insert --> Box --> Frameless.

  3. Right click the 'header' of the box, and click Settings. Set the width to for example 40% of the column width.

  4. Add a block inside this box, by selecting Block from the style drop down menu.

  5. Place the cursor just outside the box, and repeat steps 2-4. (Or you can simply copy-paste the first box with block.)

  6. (Optionally) Place the cursor between the two boxes, and add some horizontal space with Insert --> Formatting --> Horizontal space. Using Horizontal Fill will push the to blocks to the edges.

  7. Place the cursor after the second box and hit Enter. Optionally add some vertical space.

  8. Repeat steps 2-4 (or copy/paste one of the other boxes) to add the third box with block.

Here is how this can look in LyX and in the PDF:

enter image description here

And here is the .lyx file itself. (Copy the code, paste it into a text editor, save as something.lyx.)

#LyX 2.1 created this file. For more info see http://www.lyx.org/
\lyxformat 474
\begin_document
\begin_header
\textclass beamer
\begin_preamble
\usetheme{Boadilla}
\end_preamble
\use_default_options true
\maintain_unincluded_children false
\language english
\language_package default
\inputencoding auto
\fontencoding global
\font_roman default
\font_sans default
\font_typewriter default
\font_math auto
\font_default_family default
\use_non_tex_fonts false
\font_sc false
\font_osf false
\font_sf_scale 100
\font_tt_scale 100
\graphics default
\default_output_format default
\output_sync 1
\bibtex_command default
\index_command default
\paperfontsize default
\spacing single
\use_hyperref false
\papersize default
\use_geometry true
\use_package amsmath 1
\use_package amssymb 1
\use_package cancel 0
\use_package esint 1
\use_package mathdots 1
\use_package mathtools 0
\use_package mhchem 1
\use_package stackrel 0
\use_package stmaryrd 0
\use_package undertilde 0
\cite_engine basic
\cite_engine_type default
\biblio_style plain
\use_bibtopic false
\use_indices false
\paperorientation portrait
\suppress_date false
\justification true
\use_refstyle 1
\index Index
\shortcut idx
\color #008000
\end_index
\secnumdepth 3
\tocdepth 3
\paragraph_separation indent
\paragraph_indentation default
\quotes_language english
\papercolumns 1
\papersides 1
\paperpagestyle default
\tracking_changes false
\output_changes false
\html_math_output 0
\html_css_as_file 0
\html_be_strict false
\end_header

\begin_body

\begin_layout Frame

\end_layout

\begin_layout Frame
\begin_inset ERT
status open

\begin_layout Plain Layout


\backslash
centering
\end_layout

\end_inset


\end_layout

\begin_layout Frame

\end_layout

\begin_layout Frame

\end_layout

\begin_layout Frame

\end_layout

\begin_layout Frame

\end_layout

\begin_layout Frame

\end_layout

\begin_layout Frame
\begin_inset Box Frameless
position "t"
hor_pos "c"
has_inner_box 1
inner_pos "t"
use_parbox 0
use_makebox 0
width "40col%"
special "none"
height "1in"
height_special "totalheight"
status open

\begin_layout Block
\begin_inset Argument 2
status open

\begin_layout Plain Layout
First block
\end_layout

\end_inset


\end_layout

\begin_layout Block
Block 1 content
\end_layout

\end_inset


\begin_inset space \hfill{}
\end_inset


\begin_inset Box Frameless
position "t"
hor_pos "c"
has_inner_box 1
inner_pos "t"
use_parbox 0
use_makebox 0
width "40col%"
special "none"
height "1in"
height_special "totalheight"
status open

\begin_layout Block
\begin_inset Argument 2
status open

\begin_layout Plain Layout
Second block
\end_layout

\end_inset


\end_layout

\begin_layout Block
Block 2 content
\end_layout

\end_inset


\end_layout

\begin_layout Frame
\begin_inset VSpace 0.5cm
\end_inset


\end_layout

\begin_layout Frame
\begin_inset Box Frameless
position "t"
hor_pos "c"
has_inner_box 1
inner_pos "t"
use_parbox 0
use_makebox 0
width "40col%"
special "none"
height "1in"
height_special "totalheight"
status open

\begin_layout Block
\begin_inset Argument 2
status open

\begin_layout Plain Layout
First block
\end_layout

\end_inset


\end_layout

\begin_layout Block
Block 1 content
\end_layout

\end_inset


\end_layout

\end_body
\end_document
1

With tcolorbox

\documentclass{beamer}
\usepackage[most]{tcolorbox}

\newtcolorbox{myblock}[1]{beamer, width=.475\linewidth,title=#1,on line}

\begin{document}
\begin{frame}

\begin{myblock}{First block}
Some text
\end{myblock}\hfill
\begin{myblock}{Second block}
Some text
\end{myblock}
\bigskip
{\par\centering
\begin{myblock}{Third block}
Some text
\end{myblock}
\par}
\end{frame}
\end{document}

enter image description here

With minipages and beamer blocks.

\documentclass{beamer}
\usetheme{Boadilla}

\begin{document}
\begin{frame}

\begin{minipage}[t]{.45\linewidth}
\begin{block}{First block}
Some text
\end{block}
\end{minipage}\hfill
\begin{minipage}[t]{.45\linewidth}
\begin{block}{Second block}
Some text
\end{block}
\end{minipage}
\bigskip
{\par\centering
\begin{minipage}[t]{.45\linewidth}
\begin{block}{Third block}
Some text
\end{block}
\end{minipage}
\par}

\end{frame}
\end{document}

enter image description here

A similar result can be obtained with beamer's beamerboxesrounded boxes and columns.

\documentclass{beamer}
\usetheme{Boadilla}

\begin{document}
\begin{frame}

\begin{columns}[onlytextwidth]
\column{.45\linewidth}
\begin{beamerboxesrounded}[width=\linewidth,shadow]{First block}
Some text
\end{beamerboxesrounded}%
\column{.45\linewidth}
\begin{beamerboxesrounded}[width=\linewidth,shadow]{Second block}
Some text
\end{beamerboxesrounded}
\end{columns}
\bigskip
\begin{columns}[onlytextwidth]
\column{.275\linewidth}
\column{.45\linewidth}
\begin{beamerboxesrounded}[width=\linewidth,shadow]{Third block}
Some text
\end{beamerboxesrounded}
\column{.275\linewidth}
\end{columns}
\end{frame}
\end{document}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.