rmarkdown: yaml references to bibliography - r-markdown

In rmarkdown/bibliography, how can I convert a bunch of YAML encoded references into one of the files formats accepted by the bibliography?
I am currently using:
references:
- id: fenner2012a
title: One-click science marketing
author:
- family: Fenner
given: Martin
container-title: Nature Materials
volume: 11
URL: 'http://dx.doi.org/10.1038/nmat3283'
DOI: 10.1038/nmat3283
issue: 4
publisher: Nature Publishing Group
page: 261-263
type: article-journal
issued:
year: 2012
month: 3
and would like to use:
bibliography: bibliography.???

Turns out I needed to copy the references into a .yaml file. AND to add
---
references:
at the start of the file and --- at the end of the file

Related

Elsevier rticle not rendering affiliation properly

I am using the elsevier rticle template to prepare a paper with rmarkdown. When I knit it, commas do not get rendered in the institutional affiliation. This can be reproduced by installing rticles, creating a rmarkdown from the elsevier template, and knitting it. As can be seen below, the commas between Department, Street etc fail to render out of the box.
Any help would be appreciated.
You can use a raw attribute in the yaml block to properly format the latex code used to specify affiliations. Here I modified the yaml block in the rticles template:
title: Short Paper
author:
- name: Alice Anonymous
email: alice#example.com
affiliation: a
correspondingauthor: true
footnote: 1
- name: Bob Security
email: bob#example.com
affiliation: b
- name: Cat Memes
email: cat#example.com
affiliation: b
footnote: 2
- name: Derek Zoolander
email: derek#example.com
affiliation: b
footnote: 2
address:
- code: a
address: |
```{=latex}
organization={Some Institute of Technology},
addressline={Street},
city={City}, state={State}, postcode={Zip},
country={United States}
```
- code: b
address: |
```{=latex}
organization={Another University},
addressline={Street},
city={City}, state={State}, postcode={Zip},
country={United States}
```

Citations not generating in RMarkdown

new to Stackoverflow, and relatively new to writing documents in RMarkdown. I have most other things down, however, I cannot generate citations and the bibliography in RMarkdown. For the example code below, I have used the \cite{REFNAME} as well as [#REFNAME] syntax. The [#REFNAME] will not even let the document be generated, the \cite{} generates the document but the citation is [?] and the reference is not after the #References section.
I have looked through this site and I cannot get suggested fixes to work. I am hoping that the error I am showing after the code sections will tell someone what the error really is.
---
title: "Title for my document"
date: "`r format(Sys.Date(), '%d %B, %Y')`"
output:
pdf_document:
fig_caption: yes
keep_tex: true
number_sections: true
geometry: margin=0.5in
header-includes: \usepackage{float}
urlcolor: blue
bibliography: bibliography_file.bib
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
knitr::knit_hooks$set(mysize = function(before, options, envir) {
if (before)
return(options$size)
})
```
text written \cite{neil_increasing_2008} more text written
# References
My .bib file entry looks like this
#article{neil_increasing_2008,
title = {Increasing incidence of legionellosis in the {United} {States},
1990-2005: changing epidemiologic trends.},
volume = {47},
journal = {Clinical Infectious Diseases},
author = {Neil, K. and Berkelman, R.},
year = {2008},
pages = {591--599}
}
The error is:
Warning message: LaTeX Warning(s): Citation `neil_increasing_2008'
on page 1 undefined on input lin There were undefined references.
If I use the [#neil_increasing_2008] as opposed to the \cite{} then the following error is generate, and it does not generate the document either
pandoc-citeproc: Cannot decode byte '\x87':
Data.Text.Internal.Encoding.Fusion.streamUtf8: Invalid UTF-8 stream
pandoc.exe: Error running filter pandoc-citeproc Filter returned error
status 1 Error: pandoc document conversion failed with error 83
Execution halted

Migrate taxonomy reference field into entity reference

Am trying to migrate a taxonomy-reference field attached to a field_collection entity-type (Drupal 7) into an entity-reference field attached to a paragraphs entity-type (Drupal 8.6).
Although it seems one of the basic tasks to do while migration but I couldn't find a clear reference of how to do it.
id: d7_field_collection_field_name
label: My Field name
migration_tags:
- Drupal 7
migration_group: migrate_drupal_7
source:
plugin: d7_custom_source_plugin
process:
field_title:
plugin: get
source: field_title
field_job_category:
plugin: get
source: field_job_category
destination:
plugin: 'entity_reference_revisions:paragraph'
default_bundle: my_paragraphs_bundle
migration_dependencies:
required:
- upgrade_d7_field
- upgrade_d7_node_type
- upgrade_d7_field_collection_type
- upgrade_d7_field_instance
The migration process is explained here: https://www.mtech-llc.com/blog/ada-hernandez/migration-field-collection-d7-paragraphs-node-d8
So, field_job_category is not working. I tried so many ways in process plugins without luck. For example I used:
field_job_category:
plugin: migration_lookup
migration: upgrade_d7_taxonomy_term_job_categories
source: term_id
Then tried to use sources since am using Drupal 8.6
field_job_category:
plugin: migration_lookup
migration: upgrade_d7_taxonomy_term_job_categories
sources:
upgrade_d7_taxonomy_term_job_categories:
- term_id
I believe its a configuration mistake under field_job_category, but i couldn't figure it out yet.
Your help is much appreciated!
This has been resolved by doing two things.
First, use sub_process process plugin for my field.
field_job_category:
-
plugin: sub_process
source: field_job_category
process:
target_id: tid
Finally, implement hook_migrate_prepare_row() to provide data with right structure to be consumed by the above sub_process
$row->setSourceProperty($field_name, $new_value);
And $new_value should be
Array
(
[0] => Array
(
[tid] => Term ID
)
)
Hope this helps! Cheers.

bibtext references not processing in bookdown

I have a bookdown document that cites other documents using a bibtex bibliography file. It appears to no process at all, since the output (both gitbook format and pdf) don't translate the actual citation to a reference. The output always copies the plain text of the citation, not the actual reference, like this:
Here's a minimal reproducing example, which I build using:
Rscript -e 'bookdown::render_book("index.Rmd", "bookdown::gitbook")'
index.Rmd:
---
title: "test"
site: "bookdown::bookdown_site"
documentclass: book
bibliography: test.bib
biblio-style: apalike
link-citations: true
# toc: yes
# toc_depth: 2
---
# Introduction {#ch:intro}
Conference publication takes the lead role in describing innovative research,
while journals are often delegated to archival purposes [#vrettas15:conferences].
```{r echo=FALSE}
sessionInfo()
```
test:bib:
#article{vrettas15:conferences,
title = {Conferences versus journals in computer science},
author = {Vrettas, George and Sanderson, Mark},
journal = {Journal of the Association for Information Science and Technology},
volume = 66,
number = 12,
pages = {2674--2684},
year = 2015,
publisher = {Wiley Online Library}
}
_bookdown.yml:
rmd_files: [
"index.Rmd",
]
new_session: no
bookdown::gitbook:
split_bib: no
It turns out to be due to the too low version of Pandoc. A version 1.19.x or higher should fix the problem.

Single Table Inheritance and Yaml configuration

I want to use in my project Single Table Inheritance for symfony2/doctrine, but I can't find any working examples with yaml configuration for it. In official documentation there is only annotation configuration presented. I found xml examples, but I want to use yaml configuration. Can somebody help and share with some working code?
Okay built-in converter saves life.
In order to save time this an example of inheritance converted into yaml :
#file: Resources/config/doctrine/Person.orm.yml
Person:
type: entity
table: null
fields:
id:
type: integer
id: true
generator:
strategy: AUTO
inheritanceType: SINGLE_TABLE
discriminatorColumn:
name: discr
type: string
length: 255
discriminatorMap:
person: Person
employee: Employee
lifecycleCallbacks: { }
#file: Resources/config/doctrine/Employee.orm.yml
Employee:
type: entity
table: null
lifecycleCallbacks: { }
Here is an example of YAML markup:
Entities config files should be put into src/Acme/StoreBundle/Resources/config/doctrine/<EntityName>.orm.yml according to reference.
Also built-in converter can be used: how to model inheritance in doctrine2 with yaml?