Knitr Spin and Rmarkdown Fig.cap (figure caption). Producing double numbering pdf document

时光怂恿深爱的人放手 提交于 2019-12-24 04:29:09

问题


I am referring to this Suppress automatic figure numbering in pdf output with r markdown/knitr which I don't think was answered fully.

Essentially, I am using knitr::spin and rmarkdown to produce word, pdf and html documents.

For word, there appears to be no numbering when one puts in +fig.1, fig.cap = "Figure name" You only get an output Figure name in the caption. To solve that, I used captioner class. figs = captioner("Figure") That works fine for word

But I am not faced with rewriting the script for pdf document as the caption turns up as figure 1: figure 1: The name

I am using knitr::spin to actually generate the RMD document for forward outputs in word and pdf.

I am not sure I can use hooks in knitr::spin, as I have tried it as advertised but can't get it to work.

I also tried

header-includes: \usepackage{caption} \usepackage{float}

\captionsetup[table]{labelformat=empty} \captionsetup[figure]{labelformat=empty}

as suggested somehere to surpress the prefix for pdf but I get errors from pandoc. It uses pdf2latex.

I am not sure how one would query the output format in knitr::spin to actually produce different actions for different formats which could be a solution although cumbersome.

Thank you so much for your help from a novice.

来源:https://stackoverflow.com/questions/41659348/knitr-spin-and-rmarkdown-fig-cap-figure-caption-producing-double-numbering-pd

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!