我想交叉引用我包含在 Markdown 中的图像 ![caption with spaces](path/to/image.png)
句法。
我希望能够将此图像交叉引用为 \@ref(fig:caption-with-spaces)
.
我正在使用 bookdown::pdf_document2
.
这可能吗?
最佳答案
可以使用语法 ![caption](path/to/image){#fig:anchor_name}
将标签附加到 Markdown 中包含的图像。 .
也就是说,还有两个进一步的选择
\includegraphics
命令。 include_graphics
功能。 LaTeX 解决方案如下所示:
\begin{figure}
\includegraphics{path/to/picture.png}
\caption{Caption with spaces}
\label{fig:example}
\end{figure}
knitr 解决方案看起来像```{r, fig.cap = "Caption with spaces", label="example"}
knitr::include_graphics("path/to/picture.png")
```
使用这两种解决方案,您可以使用 \ref{fig:example}
交叉引用生成的图像。 .
关于latex - Markdown : cross-reference image included with markdown syntax,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/64363508/