是否可以在 beamer 中以如下图所示的分布在单个帧中创建 3 个块?块必须具有相同的宽度,并且块 C 应居中。
----- -----
| A | | B |
----- -----
-----
| C |
-----
答案1
一种方法是借助一些盒子。
在框架内,首先添加一个带有Ctrl+的 ERT L,然后在其中写入内容
\centering
。执行插入-->盒子-->无框。
右键单击框的“标题”,然后单击设置. 将宽度设置为例如列宽的 40%。
通过选择,在此框内添加一个块堵塞从样式下拉菜单中。
将光标放在框的外面,然后重复步骤 2-4。(或者您可以简单地复制粘贴第一个带有块的框。)
(可选)将光标放在两个框之间,然后使用插入 --> 格式 --> 水平空间添加一些水平空间。使用水平填充将会把两个块推到边缘。
将光标放在第二个框后面并点击Enter。可选择添加一些垂直空间。
重复步骤 2-4(或复制/粘贴其他框之一)以添加带有块的第三个框。
在 LyX 和 PDF 中,其显示效果如下:
这是.lyx
文件本身。(复制代码,粘贴到文本编辑器中,另存为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
答案2
和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}
带有minipages
和beamer
块。
\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}
beamerboxesrounded
使用 beamer 的盒子和可以获得类似的结果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}