2

I am using the papaja for R and compiling to .pdf. I'd like to include a note field that has latex formatting in it, but it looks like the note field gets parsed so that it doesn't compile latex syntax. Is there a way around this? A short reprex is below.

---
title             : "My paper"
shorttitle        : "My jerky paper"
note              : "Forthcoming in \\textit{Journal of Jerkface Psychobabble}."

author: 
  - name          : "A. Jerk"
    affiliation   : "1"
    corresponding : yes    # Define only one corresponding author
    address       : "Back alley, New Jersey"
    email         : "a-jerk@hotmail.com"

affiliation:
  - id            : "1"
    institution   : "University of Stuff"

authornote: |
  Shout out to my man Wilbur.

abstract: |
  This paper is amazing

keywords          : "Awesome"

bibliography      : ["r-references.bib"]

floatsintext      : no
figurelist        : no
tablelist         : no
footnotelist      : no
linenumbers       : no
mask              : no
draft             : no
keep_tex          : yes

documentclass     : "apa6"
classoption       : "man"
output            : papaja::apa6_pdf
---

```{r setup, include = FALSE}
library("papaja")
```


Blah blah blah.


# References
```{r create_r-references}
r_refs(file = "r-references.bib")
```

\begingroup
\setlength{\parindent}{-0.5in}
\setlength{\leftskip}{0.5in}

<div id="refs" custom-style="Bibliography"></div>
\endgroup

The resulting .tex file has the following for the note field:

\note{Forthcoming in \textbackslash{}textit\{Journal of Jerkface Psychobabble\}.}

Is there any way to write the note so that the latex symbols are not parsed this way?

Session info as follows:

- Session info -----------------------------------------
 setting  value                       
 version  R version 3.6.3 (2020-02-29)
 os       Windows 10 x64              
 system   x86_64, mingw32             
 ui       RStudio                     
 language (EN)                        
 collate  English_United States.1252  
 ctype    English_United States.1252  
 tz       America/Chicago             
 date     2020-05-05                  

- Packages ---------------------------------------------
 package     * version    date       lib source                      
 assertthat    0.2.1      2019-03-21 [1] CRAN (R 3.6.3)              
 cli           2.0.2      2020-02-28 [1] CRAN (R 3.6.3)              
 crayon        1.3.4      2017-09-16 [1] CRAN (R 3.6.3)              
 digest        0.6.25     2020-02-23 [1] CRAN (R 3.6.3)              
 evaluate      0.14       2019-05-28 [1] CRAN (R 3.6.3)              
 fansi         0.4.1      2020-01-08 [1] CRAN (R 3.6.3)              
 glue          1.4.0      2020-04-03 [1] CRAN (R 3.6.3)              
 htmltools     0.4.0      2019-10-04 [1] CRAN (R 3.6.3)              
 knitr         1.28       2020-02-06 [1] CRAN (R 3.6.3)              
 papaja        0.1.0.9942 2020-05-05 [1] Github (crsh/papaja@b0a224a)
 Rcpp          1.0.4.6    2020-04-09 [1] CRAN (R 3.6.3)              
 rlang         0.4.5      2020-03-01 [1] CRAN (R 3.6.3)              
 rmarkdown     2.1        2020-01-20 [1] CRAN (R 3.6.3)              
 rstudioapi    0.11       2020-02-07 [1] CRAN (R 3.6.3)              
 sessioninfo   1.1.1      2018-11-05 [1] CRAN (R 3.6.3)              
 withr         2.1.2      2018-03-15 [1] CRAN (R 3.6.3)              
 xfun          0.12       2020-01-13 [1] CRAN (R 3.6.3)              
 yaml          2.2.1      2020-02-01 [1] CRAN (R 3.6.2)
Pusto
  • 55
  • 4
  • Hey I just looked into this. I wasn't able to recreate the error. It is parsing correctly for me i.e., `\note{Forthcoming in \textit{Journal of Jerkface Psychobabble}.}`, the only edit I made to script was to remove to bib. I am running papaja 0.1.0 – John-Henry May 05 '20 at 21:26
  • Thanks for checking on this! I added my session info. I'm running the current version, 0.1.0.9942. Do you have a sub-minor version? – Pusto May 05 '20 at 21:45
  • I just updated to version papaja_0.1.0.9942 and now I have the same error as you. I am on OSX. I'll look into this further. I was on 0.1.0.9842 before – John-Henry May 05 '20 at 21:56
  • 1
    Hi there, I just pushed a commit to the development branch of `papaja` that should make this work as expected (without the need for header-includes). If you like, give it a try and let me know if it works (`remotes::install_github("crsh/papaja@devel")`) – crsh May 27 '20 at 00:01

2 Answers2

2

Figuring this out in the new version in papaja was really hard! My solution is based off this answer

If you remove your note from the title area and instead add it to a header-includes part it will work:

header-includes:
  - \note{Forthcoming in \textit{Journal of Jerkface Psychobabble}.}

In essence, your new yaml need to be:

---
title             : "My paper"
shorttitle        : "My jerky paper"

author: 
  - name          : "A. Jerk"
    affiliation   : "1"
    corresponding : yes    # Define only one corresponding author
    address       : "Back alley, New Jersey"
    email         : "a-jerk@hotmail.com"

affiliation:
  - id            : "1"
    institution   : "University of Stuff"

authornote: |
  Shout out to my man Wilbur.

abstract: |
  This paper is amazing

keywords          : "Awesome"


floatsintext      : no
figurelist        : no
tablelist         : no
footnotelist      : no
linenumbers       : no
mask              : no
draft             : no
keep_tex          : yes

documentclass     : "apa6"
classoption       : "man"
output            : papaja::apa6_pdf
header-includes:
  - \note{Forthcoming in \textit{Journal of Jerkface Psychobabble}.}
John-Henry
  • 1,556
  • 8
  • 20
1

With the most recent development version (remotes::install_github("crsh/papaja@devel")), you should be able to style the note with the customary markdown syntax:

note              : "Forthcoming in *Journal of Jerkface Psychobabble*."
crsh
  • 1,699
  • 16
  • 33