R Markdown/Bookdown-如何切换到标准书? [英] R markdown / bookdown - how to switch to rticles?
问题描述
输入数据
我准备了一个示例Rmd文件,其中引用了图形,表格和等式,并将其设置为输出'bookdown :: pdf_document2'.它可以毫无错误地编译为PDF.
I prepared an example Rmd file with references to figure, table and equation, setting as an output 'bookdown::pdf_document2'. It compiles without errors to PDF.
我将其放在了保管箱上: https://www.dropbox.com/sh/zmu0a4wq95ywssv/AAD- nHlkDiLknLk2NVR4Xup3a?dl = 0
I placed it on dropbox: https://www.dropbox.com/sh/zmu0a4wq95ywssv/AAD-nHlkDiLknLk2NVR4Xup3a?dl=0
问题
现在,我希望将"rticles :: elsevier_article"设置为输出格式
Now I wish to set as an output format 'rticles::elsevier_article'
我该怎么做?
问题
当我从以下位置更改输出线时: bookdown :: pdf_document2 到 rticles :: elsevier_article
When I change output line from: bookdown::pdf_document2 to rticles::elsevier_article
我收到一条错误消息.
即使我从输出中删除其他参数:
Even if I remove other parameters from output:
我仍然收到错误消息:
! Undefined control sequence.
推荐答案
输入原样"时的重音字符在elsevier_article
上表现不佳.请参阅下面的建议.
Accented characters when input "as is" do not appear to behave well with elsevier_article
. See suggestions below.
这是使用rticles::elsevier_article
的基本文档:
---
title: "Sample document"
author:
- name: "Mateusz Kędzior"
affiliation: Some Institute of Technology
email: Mateusz@example.com
footnote: Corresponding Author
- name: Żąćł Źęń
csl: https://www.zotero.org/styles/geoderma
output:
rticles::elsevier_article:
citation_package: natbib
keep_tex: yes
number_sections: yes
toc: no
keywords: keywordA, keywordB
abstract: This is a sample abstract \newline This is the second line of abstract.
---
Hello world.
没有任何抱怨的呈现
Now, we wish to add a reference with accents. We follow the answer here: https://tex.stackexchange.com/questions/57743/how-to-write-%C3%A4-and-other-umlauts-and-accented-letters-in-bibliography. I imported your bibliography into Zotero, and then exported the item with a "Central European (ISO)" encoding (not UTF-8) to obtain
@article{kedzior_this_2018,
title = {This is sample title only {\k A} {\L }},
volume = {99},
url = {http://megooglethat.com/},
journal = {Some journal},
author = {K{\k e}dzior, Mateusz and {\'Z}{\k e}{\'n}, {\.Z}{\k a}{\'c}{\l }},
year = {2018},
keywords = {keywordC},
pages = {21 -- 31}
}
R Markdown文档现在变为
The R Markdown document now becomes
---
title: "Sample document"
author:
- name: "Mateusz Kędzior"
affiliation: Some Institute of Technology
email: Mateusz@example.com
footnote: Corresponding Author
- name: Żąćł Źęń
csl: https://www.zotero.org/styles/geoderma
output:
rticles::elsevier_article:
citation_package: natbib
keep_tex: yes
number_sections: yes
toc: no
biblio-files: bibliography2.bib
keywords: keywordA, keywordB
abstract: This is a sample abstract \newline This is the second line of abstract.
---
## Citations and references
Let me cite an article: [@kedzior_this_2018]
# References
然后我在RStudio中进行了knit
的操作,但是意识到我必须获取tex
输出并对其进行重建(在RStudio外部)以获取所需的输出
I then knit
ed this in RStudio, but realised that I had to get the tex
output and rebuild it (outside of RStudio) to get the desired output
对于图形标题中的重音字符,请对其进行相应编码(与参考书目一样).您可能会找到 http://w2.syronex.com/jmr/latex-symbols-converter 有用.另外,据我所知,bookdown
样式交叉引用不适用于rticles
.如果您有后续问题,将问题分解成更小的部分,可能会得到更多有用的答案.
For accented characters in figure captions, encode them accordingly (as with the bibliography). You may find http://w2.syronex.com/jmr/latex-symbols-converter helpful. In addition, to the best of my knowledge bookdown
style cross-referencing does not work with rticles
. If you have follow-up questions, you may get more helpful answers if you break your question down into smaller chunks.
这篇关于R Markdown/Bookdown-如何切换到标准书?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!