【发布时间】:2018-04-23 22:14:55
【问题描述】:
我在获取包含 url 的图形图例的正确 pdf 输出时遇到问题。它作为bookdown::gitbook 工作,但不是bookdown::pdf_book
这是一个例子:
---
output: bookdown::pdf_book
---
## Reference with URL doesn't work
In this experiment, we will use a [spectrophotometer] (https://en.wikipedia.org/wiki/Spectrophotometry) to measure the absorption of light of different wavelength by colored solutions.
(ref:spectrum) [Spectrum of light. V, violet; B, blue; G, green Y, yellow; O, orange; R, red](https://commons.wikimedia.org/wiki/File:Linear_visible_spectrum.svg)
```{r spectrum, fig.cap='(ref:spectrum)', echo=FALSE, message=FALSE, warning=FALSE}
knitr::include_graphics("./figures/photosynthesis/spectrum.png")
```
## Reference without URL does work
In this experiment, we will use a [spectrophotometer] (https://en.wikipedia.org/wiki/Spectrophotometry) to measure the absorption of light of different wavelength by colored solutions.
(ref:spectrumNOurl) Spectrum of light. V, violet; B, blue; G, green Y, yellow; O, orange; R, red.
```{r spectrumNOurl, fig.cap='(ref:spectrumNOurl)', echo=FALSE, message=FALSE, warning=FALSE}
knitr::include_graphics("./figures/photosynthesis/spectrum.png")
```
我想要的是在没有 url 但在脚注中为 url 加上上标的示例中出现的图例。
其他信息
我在 MacBook Pro 13 上的 OS X(10.13.5 Beta)上的 docker 容器(rocker/rstudio)上使用 bookdown (0.7.8)、rstudio (1.1.423) 和 Pandoc 2.1.3。
我已尽我所能,但无法解决这个问题。我将所有 Pandoc 降级到 bookdown 附带的 1.x 版本,但遇到了同样的问题。无论我使用 pdflatex 还是 xelatex 作为引擎都没有关系。
【问题讨论】:
-
您好 Nikolaus,您能否在 YAML 前端添加示例是完全可重现的?我无法用我的最小示例复制该行为:gist.github.com/mikey-harper/1b3b63d19f0564546e4130bbb6beb538
-
嗨 Mikey,当我使用您的示例时,我得到了不同但也不是预期的结果:
Figure 2: [Spectrum of light. V, violet; B, blue; G, green Y, yellow; O, orange; R, red] -
感谢您的更新。您可以编辑问题,包括类似于我的链接的完整示例吗?没有这个就无法提供帮助。
-
@Mikey 我按照你的要求做了,并添加了一个简单的例子。感谢您的帮助!
标签: latex r-markdown pandoc bookdown