R 当有';什么是分页符?

R 当有';什么是分页符?,r,latex,r-markdown,pandoc,R,Latex,R Markdown,Pandoc,由于我的问题没有有效的解决方案,我试着把一个引文放在一个图形的正下方,直到图形自动分页符为止。然后,引文被放在我想放这个图的地方,但是这个图本身出现在下一页,并且两个都被分开了。有人知道补救办法吗 以下是我的代码和屏幕截图: --- title: "Test" output: pdf_document: default references: - id: hawking_thermodynamics_1983 author: - family: Hawking given:

由于我的问题没有有效的解决方案,我试着把一个引文放在一个图形的正下方,直到图形自动分页符为止。然后,引文被放在我想放这个图的地方,但是这个图本身出现在下一页,并且两个都被分开了。有人知道补救办法吗

以下是我的代码和屏幕截图:

---
title: "Test"
output:
  pdf_document: default
references:
- id: hawking_thermodynamics_1983
  author:
  - family: Hawking
    given: S. W.
  - family: Page
    given: Don. N.
  publisher: Communications in Mathematical Physics
  title: Thermodynamics of Black Holes in Anti-de Sitter Space.
  volume: 87
  type: article-journal
  issued:
    year: 1983
header-includes:
- \usepackage{lipsum}  # just used for producing example text in document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```

## Headline
\lipsum[1-5]

\begin{figure}[h]
\centering
\includegraphics[width=10cm]{example.png}
\caption{Example figure}\label{fig1}
\end{figure}
[source: @hawking_thermodynamics_1983]

\lipsum[1-4]

## Bibliography
编辑:这适用于*.bib版本:

@article{hawking_thermodynamics_1983,
    title = {Thermodynamics of black holes in anti-de Sitter space},
    volume = {87},
    pages = {577--588},
    number = {4},
    journaltitle = {Communications in Mathematical Physics},
    author = {Hawking, S. W. and Page, Don N.},
    date = {1983-12},
}

使用bib文件时,可以使用
stackengine
包和
\cite{}

\usepackage{stackengine}

% ....

\begin{figure}[h]
\centering
\stackunder[5pt]{\includegraphics[width=10cm]{unnamed.png}}{\cite{hawking_thermodynamics_1983}}%
\caption{Example figure}\label{fig1}
\end{figure}

您可以将
[来源:
作为
图的一部分

\begingroup
\figure[h]
  \centering
  \includegraphics[width=10cm]{example.png}
  \caption{Example figure}\label{fig1}
  [source: @hawking_thermodynamics_1983]
\endfigure
\endgroup
上面模拟了
\begin{figure}[h]
..
\end{figure}
所建议的相同分组,而无需显式使用
figure
环境;Rmarkdown过程跳过并假设LaTeX环境中的所有内容(如
)都将只包含LaTeX代码,因此它无法识别标记语法
[source:@]
,而是抱怨
包含下划线,该下划线只能在数学模式中使用

或者,如果必须,将添加到YAML前言中

header-includes:
- <other packages>
- \usepackage{float}

请注意,如果浮动不适合页面,这将破坏文本的常规设置。

虽然狗很酷,但它不会工作。只有[?]显示如图所示。是否使用bib文件?或者使用您的示例文档?请确保使用bib文件。我只需将
\usepackage{stackengine}
放入YAML标题中。我想您必须使用纯乳胶添加参考书目,然后才能使其生效。我也逐渐被这一点说服了!图形的正常pandoc/rmarkdown语法是只包含图像的段落;标题取自图像描述:
[来源:@hawking_热力学_1983](example.png){width=10cm}
。这能给我一个选择吗?
float
的替代方案确实有效,谢谢!!!当然可以中断,但这样我可以更好地手动放置图形,直到最终找到一个可行的解决方案。第一个选项是直观的,我以前确实尝试过,但给我带来了一个错误
!缺少插入的$。
;我应该在我的问题中提到这一点。@jaySf:我已经提供了一个选项来解决
[source:@]
环境中的
问题。这是很棒的东西,正是我所需要的!它甚至比
float
解决方案更好,因为在页面底部之前没有任何东西像文本、脚注等那样被破坏。甚至引用都居中,并且与图形标题和文本的距离正常。谢谢
\begin{figure}[H]
  \centering
  \includegraphics[width=10cm]{example.png}
  \caption{Example figure}\label{fig1}
\end{figure}
[source: @hawking_thermodynamics_1983]