英文:
When converting markdown to latex with pandoc, how can I end a block before the next heading?
问题
以下是翻译好的部分:
我正在尝试将一句话放在幻灯片上(以Markdown编写,然后使用Pandoc转换为LaTeX/Beamer),并将其放在一个块中,而不包括接下来的句子。在Markdown中,唯一对应块的东西是标题,但对我的用例来说,这不起作用,因为它总是延伸到同一级别或更高级别的下一个标题的开始。以下是一个最小示例:
这会生成以下的LaTeX输出:
是否有一种方法可以“结束”由标题隐式创建的范围?或者,是否有其他可以在需要时结束的语法结构可以用来创建Beamer块?
我尝试过的方法:
1. 添加段落(不会结束块)
2. 添加暂停(不会结束块)
3. 添加一个空标题(创建新块)
英文:
I am trying to put one sentence on a slide (written in markdown and translated to latex/beamer with pandoc) in a block without also including the following sentence. The only thing I can find in markdown that corresponds to a block is a heading, but that doesn't work for my use case, since it always extends to the start of the next heading of the same level or higher. Here is a minimal example:
# Example slide
Here is an example slide.
## Block
This should be within the block.
This shouldn't be within the block.
This produces the following latex output:
[preamble omitted]
\begin{document}
\begin{frame}{Example slide}
\protect\hypertarget{example-slide}{}
Here is an example slide.
\begin{block}{Block}
\protect\hypertarget{block}{}
This should be within the block.
This shouldn't be within the block.
\end{block}
\end{frame}
\end{document}
Is there a way I can "end" the scope implicitly created by the heading? Alternatively, is there another syntactic construct I can use to create a beamer block that I can end at will?
What I tried:
- Adding a paragraph (doesn't end the block)
- Adding a pause (doesn't end the block)
- Adding an empty heading (creates a new block)
答案1
得分: 0
基于 @jgm 在 https://github.com/jgm/pandoc/issues/2957#issuecomment-340855258 中展示的示例,你可以使用 divs:
示例幻灯片
这是一个示例幻灯片。
::: {.block}
区块
这应该在区块内。
:::
这不应该在区块内。
英文:
Based on the example show by @jgm at https://github.com/jgm/pandoc/issues/2957#issuecomment-340855258 you could use divs:
# Example slide
Here is an example slide.
::: {.block}
## Block
This should be within the block.
:::
This shouldn't be within the block.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论