如何在rmarkdown beamer马德里演示中结束标题3框?

时间:2022-11-16 12:06:02

When using the Madrid beamer theme (and some others) the Header 3 is rendered as a box covering the whole section, but in markdown the header is only specified at the start. How can I specify the end of the section?

当使用Madrid beamer主题(以及其他一些主题)时,Header 3将呈现为覆盖整个部分的框,但在markdown中,标题仅在开头指定。如何指定该部分的结尾?

In the example below, I want the second sentence to be inside the box, but the third to be back on the white background.

在下面的例子中,我想要第二个句子在框内,但第三个要回到白色背景。

Example:

---
title: "Example"
output: 
  beamer_presentation:
    colortheme: beaver
    theme: Madrid
---

## Slide with Box

Hello, I'm not in the box

### This is a box
And this text is in the box!


I don't want to be in the box, but I am.

Output

如何在rmarkdown beamer马德里演示中结束标题3框?

2 个解决方案

#1


6  

This works for me:

这对我有用:

## Slide with block 2

Hello, I'm not in the block.

\begin{block}{This is a block}
  And this text is in the block!
\end{block}


Hi, I'm not in the block either!

#2


0  

With newer versions of Pandoc (I have 2.2.3.2), you can use fenced divs to enclose a block. Did not work for me previously with 1.6.

对于更新版本的Pandoc(我有2.2.3.2),您可以使用fenced div来封闭块。以前用1.6不适合我。

Thus, this would work:

因此,这将工作:

## Slide with Box

Hello, I'm not in the box

::: {.block}
### This is a box
And this text is in the box!
:::

I don't want to be in the box, and I am not.

::: {.block} and ::: delimit the block. See https://github.com/jgm/pandoc/issues/2957

::: {。block}和:::分隔块。请参阅https://github.com/jgm/pandoc/issues/2957

An advantage with respect to using \begin{block} and \end{block} is that you get to use markdown within the block.

使用\ begin {block}和\ end {block}的一个优点是你可以在块中使用markdown。

#1


6  

This works for me:

这对我有用:

## Slide with block 2

Hello, I'm not in the block.

\begin{block}{This is a block}
  And this text is in the block!
\end{block}


Hi, I'm not in the block either!

#2


0  

With newer versions of Pandoc (I have 2.2.3.2), you can use fenced divs to enclose a block. Did not work for me previously with 1.6.

对于更新版本的Pandoc(我有2.2.3.2),您可以使用fenced div来封闭块。以前用1.6不适合我。

Thus, this would work:

因此,这将工作:

## Slide with Box

Hello, I'm not in the box

::: {.block}
### This is a box
And this text is in the box!
:::

I don't want to be in the box, and I am not.

::: {.block} and ::: delimit the block. See https://github.com/jgm/pandoc/issues/2957

::: {。block}和:::分隔块。请参阅https://github.com/jgm/pandoc/issues/2957

An advantage with respect to using \begin{block} and \end{block} is that you get to use markdown within the block.

使用\ begin {block}和\ end {block}的一个优点是你可以在块中使用markdown。