gpt4 book ai didi

latex - Markdown : cross-reference image included with markdown syntax

转载 作者:行者123 更新时间:2023-12-03 15:48:00 24 4
gpt4 key购买 nike

我想交叉引用我包含在 Markdown 中的图像 ![caption with spaces](path/to/image.png)句法。
我希望能够将此图像交叉引用为 \@ref(fig:caption-with-spaces) .
我正在使用 bookdown::pdf_document2 .
这可能吗?

最佳答案

可以使用语法 ![caption](path/to/image){#fig:anchor_name} 将标签附加到 Markdown 中包含的图像。 .
也就是说,还有两个进一步的选择

  • 使用 LaTeX \includegraphics命令。
  • 使用knitr的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/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com