文章中的 JSS 模板无法正常工作
JSS template in rticles do not work properly
使用 JSS 模板时发生了一些奇怪的事情。该模板似乎可以很好地处理徽标、作者等,但不能处理其他内容:
- 根据 JSS 样式指南,代码块内没有提示 'R>'。
- 具体期刊的卷号不加粗,再次根据样式指南。
- 在隶属关系中,"first line"和"second line"并排放置。
感谢您的帮助。
谢谢!
sessionInfo()
R version 3.3.1 RC (2016-06-17 r70798)
Platform: x86_64-suse-linux-gnu (64-bit)
Running under: openSUSE Leap 42.1 (x86_64)
locale:
[1] LC_CTYPE=es_ES.UTF-8 LC_NUMERIC=C LC_TIME=es_ES.UTF-8 LC_COLLATE=es_ES.UTF-8 LC_MONETARY=es_ES.UTF-8
[6] LC_MESSAGES=es_ES.UTF-8 LC_PAPER=es_ES.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rticles_0.2 knitr_1.13 rmarkdown_0.9.6
loaded via a namespace (and not attached):
[1] htmltools_0.3.5 tools_3.3.1 Rcpp_0.12.4 digest_0.6.9
您可以在 rticles 包中找到 JSS 模板 (https://github.com/rstudio/rticles)。我还添加了一个简单的bib文件来编译参考书目:
test.Rmd 文件:
author:
- name: FirstName LastName
affiliation: University/Company
address: >
First line
Second line
email: name@company.com
url: http://rstudio.com
- name: Second Author
affiliation: Affiliation
title:
formatted: "A Capitalized Title: Something about a Package \pkg{foo}"
# If you use tex in the formatted title, also supply version without
plain: "A Capitalized Title: Something about a Package foo"
# For running headers, if needed
short: "\pkg{foo}: A Capitalized Title"
abstract: >
The abstract of the article.
keywords:
# at least one keyword must be supplied
formatted: [keywords, not capitalized, "\proglang{Java}"]
plain: [keywords, not capitalized, Java]
preamble: >
\usepackage{amsmath}
output: rticles::jss_article
bibliography: biblio.bib
---
# Introduction
This template demonstrates some of the basic latex you'll need to know to create a JSS article.
*A citation* [see @rtip2016; and @Hadley2011]
## Code formatting
Don't use markdown, instead use the more precise latex commands:
* \proglang{Java}
* \pkg{plyr}
* \code{print("abc")}
# R code
Can be inserted in regular R markdown blocks.
```{r, prompt=TRUE}
x <- 1:10
x
```
#References
和biblio.bib文件:
@Manual{rtip2016,
title = {rtip: Inequality, Welfare and Poverty Indices and Curves using
the EU-SILC Data},
author = {Angel Berihuete and Carmen Dolores Ramos and Miguel Angel Sordo},
year = {2016},
note = {R package version 1.0.0},
url = {https://CRAN.R-project.org/package=rtip},
}
@Article{Hadley2011,
title = {The Split-Apply-Combine Strategy for Data Analysis},
author = {Hadley Wickham},
journal = {Journal of Statistical Software},
year = {2011},
volume = {40},
number = {1},
pages = {1--29},
url = {http://www.jstatsoft.org/v40/i01/},
}
提示问题是 jss_article
的 rticles
设置中的错误。您可以通过
尝试固定版本
devtools::install_github("rstudio/rticles")
编辑添加:
引文风格问题很容易解决。只是改变
output: rticles::jss_article
到
output:
rticles::jss_article:
citation_package: natbib
在文档的 YAML header 中。这可能会在 rticle
中作为默认设置完成,但我不知道需要进行哪些更改。
使用 JSS 模板时发生了一些奇怪的事情。该模板似乎可以很好地处理徽标、作者等,但不能处理其他内容:
- 根据 JSS 样式指南,代码块内没有提示 'R>'。
- 具体期刊的卷号不加粗,再次根据样式指南。
- 在隶属关系中,"first line"和"second line"并排放置。
感谢您的帮助。 谢谢!
sessionInfo()
R version 3.3.1 RC (2016-06-17 r70798)
Platform: x86_64-suse-linux-gnu (64-bit)
Running under: openSUSE Leap 42.1 (x86_64)
locale:
[1] LC_CTYPE=es_ES.UTF-8 LC_NUMERIC=C LC_TIME=es_ES.UTF-8 LC_COLLATE=es_ES.UTF-8 LC_MONETARY=es_ES.UTF-8
[6] LC_MESSAGES=es_ES.UTF-8 LC_PAPER=es_ES.UTF-8 LC_NAME=C LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=es_ES.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rticles_0.2 knitr_1.13 rmarkdown_0.9.6
loaded via a namespace (and not attached):
[1] htmltools_0.3.5 tools_3.3.1 Rcpp_0.12.4 digest_0.6.9
您可以在 rticles 包中找到 JSS 模板 (https://github.com/rstudio/rticles)。我还添加了一个简单的bib文件来编译参考书目:
test.Rmd 文件:
author:
- name: FirstName LastName
affiliation: University/Company
address: >
First line
Second line
email: name@company.com
url: http://rstudio.com
- name: Second Author
affiliation: Affiliation
title:
formatted: "A Capitalized Title: Something about a Package \pkg{foo}"
# If you use tex in the formatted title, also supply version without
plain: "A Capitalized Title: Something about a Package foo"
# For running headers, if needed
short: "\pkg{foo}: A Capitalized Title"
abstract: >
The abstract of the article.
keywords:
# at least one keyword must be supplied
formatted: [keywords, not capitalized, "\proglang{Java}"]
plain: [keywords, not capitalized, Java]
preamble: >
\usepackage{amsmath}
output: rticles::jss_article
bibliography: biblio.bib
---
# Introduction
This template demonstrates some of the basic latex you'll need to know to create a JSS article.
*A citation* [see @rtip2016; and @Hadley2011]
## Code formatting
Don't use markdown, instead use the more precise latex commands:
* \proglang{Java}
* \pkg{plyr}
* \code{print("abc")}
# R code
Can be inserted in regular R markdown blocks.
```{r, prompt=TRUE}
x <- 1:10
x
```
#References
和biblio.bib文件:
@Manual{rtip2016,
title = {rtip: Inequality, Welfare and Poverty Indices and Curves using
the EU-SILC Data},
author = {Angel Berihuete and Carmen Dolores Ramos and Miguel Angel Sordo},
year = {2016},
note = {R package version 1.0.0},
url = {https://CRAN.R-project.org/package=rtip},
}
@Article{Hadley2011,
title = {The Split-Apply-Combine Strategy for Data Analysis},
author = {Hadley Wickham},
journal = {Journal of Statistical Software},
year = {2011},
volume = {40},
number = {1},
pages = {1--29},
url = {http://www.jstatsoft.org/v40/i01/},
}
提示问题是 jss_article
的 rticles
设置中的错误。您可以通过
devtools::install_github("rstudio/rticles")
编辑添加:
引文风格问题很容易解决。只是改变
output: rticles::jss_article
到
output:
rticles::jss_article:
citation_package: natbib
在文档的 YAML header 中。这可能会在 rticle
中作为默认设置完成,但我不知道需要进行哪些更改。