Comments (18)
Hi @eugenividal,
I've installed the latest version of rticles
from CRAN, and created an RMarkdown document in RStudio from the rticles
template. I've used the same settings in my yaml
header as you are using above. You don't need to place any files (other than the bibliography) anywhere. All required files are included in the package. For me the pdf is generated without any issues. Which latex engine are you using?
Cheers,
Pepijn
from rticles.
elsarticle-harv.bst
seems not found. Though it should be availabel through the CTAN package
https://ctan.org/tex-archive/macros/latex/contrib/elsarticle
So check that you have this package installed, and latest version.
If you are using TinyTeX, it should be installed automatically when missing. You can also install and update manually
from rticles.
Thanks for the information, @cderv. I've just run tinytex::install_tinytex()
in my Rstudio console and this time the file elsarticle-harv.bst
was not required to work properly.
from rticles.
This is what my yaml-header looks like at the moment. I do have the authoryear
option set at the classoption
. But without the biblio-style
setting defined the bibliography is not formatted correctly. I've added it myself to the default template.
title: "TODO"
author:
- name: TODO
email: TODO
affiliation: TODO
correspondingauthor: true
address:
- code: WUR
organization: TODO
addressline: TODO
city: TODO
postcode: TODO
country: The Netherlands
abstract: |
TODO
keywords:
- TODO
- TODO
journal: "TODO"
date: "`r Sys.Date()`"
classoption: preprint, 3p, authoryear
bibliography: library.bib
biblio-style: elsarticle-harv
linenumbers: true
numbersections: true
# Use a CSL with `citation_package = "default"`
# csl: https://www.zotero.org/styles/elsevier-harvard
output:
rticles::elsevier_article:
keep_tex: true
citation_package: natbib
from rticles.
I did the update in the skeleton following this advice. Thank you !
from rticles.
@cderv Good point. That is probably it. I'm also working with TinyTex as it generally plays nicely with RMarkdown and knitr.
from rticles.
What do you mean by checking that the package is installed?
elsarticle-harv.bst
is availabel through a CTAN package https://ctan.org/tex-archive/macros/latex/contrib/elsarticle, so if that package is installed, files provided by this package should have been found correctly.
Placing the file locally works too though.
from rticles.
CTAN is https://ctan.org/ - this is the package repository for LaTeX package. Like CRAN for R or CPAN for perl.
Installing a package for LaTeX can be done using TeX Live tlmgr install
command. Or tinytex::tlmgr_install()
from R is you use TinyTeX and tinytex R package.
Though as I said, it should be done automatically when a missing package is detected. So if it does not do it for you, it means either you don't use TeX Live, or something else prevent installation.
Anyhow, if you start managing TeX Live yourself, or at least do some stuff with LaTeX distribution, you should understand how it works.
from rticles.
It seems the template was done using plainnat
by default
rticles/inst/rmarkdown/templates/elsevier/resources/template.tex
Lines 57 to 60 in fcbcf83
The LaTeX package guideline (https://www.elsevier.com/authors/policies-and-guidelines/documents/elsdoc-1.pdf)
Three bibliographic style files (*.bst) are provided — elsarticle-num.bst,
elsarticle-num-names.bst and elsarticle-harv.bst
I am fine by using one of this as the default if that is better
from rticles.
Or perhaps include all options in the template and comment out all but one. Than it is visible to the user what the options are.
from rticles.
In fact re-reading the guidelines, I am seeing this about class option
authoryear
author-year citation style of natbib.sty. If you want to add
extra options of natbib.sty, you may use the options as comma
delimited strings as arguments to \biboptions command.
And we use it in the template in classoptions
. Is it set for you ?
Not sure how it effect and which bibliostyle should be set with it 🤔
from rticles.
Hi @cderv. Great package! I have the same problem reported here: The Reference list shows first names instead of last names. Adding biblio-style: elsarticle-harv
to the yaml header does not work for me. If I add it I get:
from rticles.
Hi @eugenividal,
For me the solution above did work. Maybe you could add the complete yaml header that you are using. Otherwise it is impossible to reproduce or solve your problem.
Cheers,
Pepijn
from rticles.
Hi @pepijn-devries, thanks for your quick reply. My complete yaml header is below. Now, if I use biblio-style: elsarticle-harv
, I get no reference list at all; otherwise, I get the reference list but with first names showing first instead of last names. Should I add a file or something in my main folder to support this biblio-style: elsarticle-harv
?
from rticles.
Hi @pepijn-devries, thanks for your answer. I've installed the latest version of rticles
too but I still get an error (below). I've no idea which latex engine I am using. I guess the one markdown uses by default. Not sure how can I check that.
from rticles.
Thanks @cderv. It is working properly now! What do you mean by checking that the package is installed? I just had to save the elsarticle-harv.bst
file in the main folder and knit the Rmd with the biblio-style: elsarticle-harv
uncommented.
from rticles.
Hi @cderv. Thanks for the clarification. This is what I thought. I just do not know how to install the CTAN package. Is this an R package? Can I install it using my ubuntu terminal? Thanks!
from rticles.
This old thread has been automatically locked. If you think you have found something related to this, please open a new issue by following the issue guide (https://yihui.org/issue/), and link to this old issue if necessary.
from rticles.
Related Issues (20)
- Use new addition in pre_knit for metadata processing
- Feature request: Support journals from the American Psychological Association (APA)
- sim_article update HOT 14
- Pandoc 3.1.7 new citeproc for LaTeX breaks some formats
- Add a template for Journal of Experimental Biology HOT 2
- Cross-referencing figures in Copernicus template does not work HOT 5
- Release rticles 0.26 HOT 2
- Taylor & Francis Reference Style needs updating HOT 5
- Unexpected behaviours when making tables for copernicus articles HOT 3
- request for a template for a project MUSE journal HOT 1
- PNAS template not knitting :(
- Error in OUP skeleton.Rmd HOT 3
- JOSS template error with bookdown HOT 1
- Copernicus Publications Correspondence Line Bugfix
- Release rticles 0.27
- I found there has similar error and try to modify the tex file but the outcome doesn't appear the latin greek letters. HOT 1
- Pandoc 3.2.1 update on LaTeX writer
- Issue with mdpi article
- Release rticles 0.28
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rticles.