I have two YAML metadata blocks, and it appears that the 2nd metadata block is not being read. I think this has something to do with Pandoc, but I'm not sure. I used the same code several months ago, and it was working.
I do get the warning [WARNING] Could not parse YAML metadata at line 73 column 1: :2:41: Expected start of line
which I've never gotten before. If I try to include the 2nd block in the first, nothing runs.
Does anyone have any ideas?
Thanks,
James
Here are the two metadata blocks:
---
fig: no crop
geometry: left=1mm, right=1mm, top=1mm, bottom=1mm, asymmetric
indent: TRUE
output:
word_document:
reference_docx: my-styles.docx
html_document:
df_print: paged
fig_caption: yes
includes:
in_header: my_header.tex
pdf_document: default
header-includes:
- \usepackage{placeins}
- \usepackage{indentfirst}
- \usepackage{setspace}\doublespacing
- \usepackage{lineno}
- \linenumbers
---
---
title: Education and Crime Across America: Inequity's Cost
author: |
| James Ades ^[Jades@UCSD.edu] $^1$, Jyoti Mishra $^2$, Project i-Lead $^3$
| $^1$$^2$UCSD, $^3$Berkeley, Stanford, UCSF
bibliography: Ed.Crime.bib
abstract: |
All of my abstract information...
---
The problem is the colon in your title. I have had this issue before (but didn't seen it on SO anywhere after a quick search, so I don't think this is a duplicate). You'll notice that for many of your entries in the YAML you have a colon followed by more specification. Anytime it sees a colon, it thinks that's what you're trying to do, so the title with a colon messes up the parsing.
You can fix with either
title: Education and Crime Across America: Inequity's Cost
since :
is HTML for colon, or use quotes:
title: "Education and Crime Across America: Inequity's Cost"
For me, your code with both of those slight modifications knitted just fine on my machine (after deleting the lines about the bib and header include that refer to local files not on my machine).
So, here's the full R Markdown file I used:
---
fig: no crop
geometry: left=1mm, right=1mm, top=1mm, bottom=1mm, asymmetric
indent: TRUE
output:
html_document:
df_print: paged
fig_caption: yes
word_document: default
pdf_document: default
header-includes:
- \usepackage{placeins}
- \usepackage{indentfirst}
- \usepackage{setspace}\doublespacing
- \usepackage{lineno}
- \linenumbers
title: "Education and Crime Across America: Inequity's Cost"
---
---
author: |
| James Ades ^[Jades@UCSD.edu] $^1$, Jyoti Mishra $^2$, Project i-Lead $^3$
| $^1$$^2$UCSD, $^3$Berkeley, Stanford, UCSF
abstract: |
All of my abstract information...
---
xxx
And here is a screenshot of the output:
Here's the sessionInfo()
in case there are differences in the software versions we're running:
R version 4.0.0 (2020-04-24)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 20.04 LTS
Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/openblas-pthread/libblas.so.3
LAPACK: /usr/lib/x86_64-linux-gnu/openblas-pthread/liblapack.so.3
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5] LC_MONETARY=en_US.UTF-8 LC_MESSAGES=en_US.UTF-8
[7] LC_PAPER=en_US.UTF-8 LC_NAME=C
[9] LC_ADDRESS=C LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
attached base packages:
[1] stats graphics grDevices utils datasets methods base
loaded via a namespace (and not attached):
[1] compiler_4.0.0 rsconnect_0.8.16 htmltools_0.5.0 tools_4.0.0
[5] yaml_2.2.1 rmarkdown_2.3 knitr_1.29 xfun_0.15
[9] digest_0.6.25 rlang_0.4.7 evaluate_0.14