I have a variable, x
, which is a character formatted using markdown:
(我有一个变量x
,这是一个使用markdown格式化的字符:)
x <- "Here is some _great_ text in a **variable** and some blank spaces ____."
I want to convert it to Tex so that it looks like this
(我想将其转换为Tex,使其看起来像这样)
y <- some_library::md2tex(x)
y
[1] "Here is some extit{great} text in a extbf{variable} and some blank spaces \_\_\_\_."
Is there an R function that achieves this?
(是否有R函数可以实现这一目标?)
The backslashes themselves might need to be escaped, but you get the idea. (反斜杠本身可能需要转义,但是您明白了。)
I'm certain this exists as it's easy to convert an from .Rmd
to a .pdf, but I'd prefer not to create and write an intermediate .tex
file since this will need to be repeated a lot. (我确信这是存在的,因为很容易将.Rmd
转换为.pdf,但是我不希望创建和编写中间.tex
文件,因为这需要重复很多次。)
I've dug around the vignettes, documentation, and source code for both knitr
and RMarkdown
but I can't find what I'm looking for.
(我已经研究了knitr
和RMarkdown
的小插曲,文档和源代码,但找不到所需的内容。)
EDIT
(编辑)
So I found knitr::pandoc
which is almost there but requires input and output files.
(所以我找到了knitr::pandoc
,它几乎在那里,但是需要输入和输出文件。)
ask by haff translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…