papaja icon indicating copy to clipboard operation
papaja copied to clipboard

Update to APA 7?

Open QueenJanine opened this issue 4 years ago • 18 comments

Hi Frederik, great work on the package - thank you! Are you planning on incorporating the APA 7 guidelines anytime soon?

QueenJanine avatar Nov 05 '19 13:11 QueenJanine

Yes, this is definitely planned. I'll look into this more closely as soon as I get my hands on a copy of the manual (anyone at APA willing to donate a copy?).

crsh avatar Nov 13 '19 16:11 crsh

First of all thank you so much for this wonderful package. I use it now pretty much for all of my drafts. I received the new APA 7 Manual in yesterday's mail. So here are two issues I would like to raise:

STYLE

Levels of Headings

The style guidelines note the following five levels of heading in APA style:

L1 = Centered, Bold, Title Case Heading [begins with new paragraph] L2 = Flush left, Bold, Title Case Heading [begins with new paragraph] L3 = Flush left, Bold Italic, Title Case Heading [begins with new paragraph] L4 = Indented, Bold, Title Case Heading, Ending with a Period. [begins on same line and continues as a regular paragraph] L5 = Indented, Bold Italic, Title Case Heading, Ending with a Period. [begins on same line and continues as a regular paragraph]

When I currently render documents using output : papaja::apa6_pdf I get the following results (see attached Test.pdf):

L1 = Centered, Bold, Title Case Heading [begins with new paragraph] > CORRECT L2 = Flush left, Bold, Title Case Heading [begins with new paragraph] > CORRECT L3 = Indented, Bold, Title Case Heading, Ending with a Period. [begins on same line and continues as a regular paragraph] > NOT CORRECT; this resembles the correct version of what should be L4; should be same as L2 only in bold-italic. L4 = Indented, Bold, Title Case Heading, Ending with a Period. [begins new paragraph] > NOT CORRECT, the new paragraph is wrong, shouldn't be italic. L5 = Indented, Title Case Heading, Ending with a Period. [begins new paragraph] > NOT CORRECT, the new paragraph is wrong, should be bold-italic, no new paragraph.

QUESTION 1: Would it be possible to fix this? Especially the incorrect new paragraphs make the whole document very messy.

Author Note

The Manual for APA 7 recommends the following for the author note (see attached Test.pdf):

  1. paragraph: ORCID iDs
  2. paragraph: Change of Affiliation.
  3. paragraph: Disclosures and Acknowledgments (1 - Study Registration; 2 - Open Practices and Data Sharing; 3 - Acknowledgments of Financial Support and Other Assistance)
  4. paragraph: Contact Information: Correspondence concerning this article should be addressed to [author's name], [complete mailing address]. Email: [email protected]

APA recommends the use of the ORCID iD icon. This can be downloaded from the ORCID website.

QUESTION 2: Would it be possible to make the according changes in the template? I don't think it's possible to make use of ai Icons using the icon package, so I simply used the provided 16x16 .png file. Perhaps it would be helpful to insert the following lines in the template:

authornote: |
  Author ![](img/orcid.png) [https://orcid.org/XXX](https://orcid.org/XXX).
  CHANGE_OF_AFFILIATION
  DISCLOSURES_ACKNOWLEDGEMENTS_(1 - Study Registration; 2 - Open Practices and Data Sharing; 3 - Acknowledgments of Financial Support and Other Assistance)
  <add here the existing code that you currently use to create the Contact Information>

Something along those lines.

The ORCID logo solution isn't pretty. If there's a way to make it work with Academicons that would be far superior. Or use a more high-resolution .png file version and scale it down?

Again, thanks for you great service to the academic community here!

jrennstich avatar Nov 19 '19 10:11 jrennstich

Hi Joachim, thanks for the analysis and feedback. If you find anything else please feel free to add it here.

The problem with level 4 headings has been raised before here and here and it is indeed an issue with papaja (or rather the pandoc conversion of headings). I simply haven't found the time to look into it further. I'll try to look into it as soon as possible.

Similarly, I'll need to see whether the issues regarding the other headings you identified are related to papaja/pandoc or the underlying apa6-LaTeX document class. If the latter is the case, the issue would be most aptly addressed in the LaTeX class.

The inclusion of ORCIDs has also been suggested before but now that the new manual requires inclusion and specifies how to do it, I'd be ready to tackle soon. I think your solution is what would be required for Word documents, in LaTeX documents the tikz approach mentioned in the other issue could be used.

crsh avatar Nov 19 '19 13:11 crsh

Thanks for your quick reply and looking into this. The tikz solution looks great, especially the second one.

jrennstich avatar Nov 19 '19 14:11 jrennstich

Great to hear that the implementation of the 7th edition is underway! Just so you know, Daniel Weiss recently published a sort of updated apa6 LaTeX package: apa7 (https://ctan.org/pkg/apa7). This should take some work off of your shoulders.

benediktclaus avatar Jan 03 '20 15:01 benediktclaus

Excellent. Thank you for bringing this to my attention. If you have an urgent need for APA 7th, you could try using apa7 with the following YAML setting (assuming you installed the LaTeX package):

documentclass     : "apa7"

I'd be interested to hear if that works for you or what problems you are seeing.

crsh avatar Jan 09 '20 15:01 crsh

Would love to try it. For some reason I now get the following error for all my papaja docs:

Error in rmdfiltr::add_wordcount_filter(args, report = "warn") : 
  unused argument (report = "warn")
Calls: <Anonymous> -> <Anonymous> -> pdf_pre_processor

This is true even for brand-new created docs. Any suggestions?

jrennstich avatar Jan 09 '20 19:01 jrennstich

Excellent. Thank you for bringing this to my attention. If you have an urgent need for APA 7th, you could try using apa7 with the following YAML setting (assuming you installed the LaTeX package):

documentclass     : "apa7"

I'd be interested to hear if that works for you or what problems you are seeing. So just to be clear, the following line stays the same?

output : papaja::apa6_pdf # pdf or word

or is it

output : papaja::apa7_pdf # pdf or word

jrennstich avatar Jan 09 '20 19:01 jrennstich

You need to keep using output : papaja::apa6_pdf for now.

For some reason I now get the following error for all my papaja docs

Could you try updating rmdfiltr and reintall papaja from the development branch (devtools::install_github("crsh/papaja@devel"))?

crsh avatar Jan 09 '20 21:01 crsh

Thanks for the quick reply. Did as suggested. Now I get the new following error msg:

/usr/local/bin/pandoc +RTS -K512m -RTS Digitalkompetenz_PB.utf8.md --to latex --from markdown+autolink_bare_uris+tex_math_single_backslash+raw_attribute --output Digitalkompetenz_PB.tex --self-contained --highlight-style tango --pdf-engine pdflatex --include-in-header /Library/Frameworks/R.framework/Versions/3.6/Resources/library/papaja/rmarkdown/templates/apa6/resources/apa6_header_includes.tex --variable graphics --lua-filter /Library/Frameworks/R.framework/Versions/3.6/Resources/library/rmarkdown/rmd/lua/pagebreak.lua --lua-filter /Library/Frameworks/R.framework/Versions/3.6/Resources/library/rmarkdown/rmd/lua/latex-div.lua --wrap preserve --csl /Library/Frameworks/R.framework/Versions/3.6/Resources/library/papaja/rmd/apa6.csl --filter /usr/local/bin/pandoc-citeproc --lua-filter /Library/Frameworks/R.framework/Versions/3.6/Resources/library/rmdfiltr/replace_ampersands.lua --lua-filter /Library/Frameworks/R.framework/Versions/3.6/Resources/library/rmdfiltr/wordcount.lua --variable 'classoption:man' 'classoption:a4paper' --variable 'lang:de-DE' --include-in-header /var/folders/hh/vy5948dx2jv2v9qc_m2tbrx00000gn/T//RtmpPj6dGf/includes_5ecc19a846ad.tex --filter /usr/local/bin/pandoc-citeproc 
pandoc: classoption:a4paper: openBinaryFile: does not exist (No such file or directory)
Error: pandoc document conversion failed with error 1

I used successfully in the past the following option in the YAML header:

classoption : ["man", "a4paper"]

When deleting this (needed) option, I get the following error msg:

! LaTeX Error: Option clash for package babel.

When removing babel it works. Any suggestions, how to include both, babel and a4paperas an option?

Working on MacOS 10.15.2 (19C57).

jrennstich avatar Jan 09 '20 21:01 jrennstich

Excellent. Thank you for bringing this to my attention. If you have an urgent need for APA 7th, you could try using apa7 with the following YAML setting (assuming you installed the LaTeX package):

documentclass     : "apa7"

I'd be interested to hear if that works for you or what problems you are seeing.

Works nicely here (except for the problems described above), with some exceptions.

Using apa6_pdf

  • the previous formatting/style errors I had (reported above) are fixed using apa7
  • all headlines are now formatted as they should be, as far as I can tell
  • bibliography is not conforming to APA 7 style, though; publication places are still being used, for example
  • image links don't seem to work
  • figures do seem to work using both, man and doc

Using apa6_word I get the following error msg:

Error running filter /Library/Frameworks/R.framework/Versions/3.6/Resources/library/papaja/rmd/docx_fixes.lua:
[string "--[[..."]:216: Constructor for Emph failed: [string "--[[..."]:247: attempt to index a nil value (local 'x')

stack traceback:
	[C]: in function 'error'
	[string "--[[..."]:216: in field 'Emph'
	[string "/Library/Frameworks/R.framework/Versions/3.6/..."]:15: in function 'Image'
Error: pandoc document conversion failed with error 83
Execution halted

This is true for both man and doc.

jrennstich avatar Jan 09 '20 21:01 jrennstich

Thanks, I'll look into it.

For APA 7th citations, you need to manually specify an updated CSL file, which is available form this repository: https://www.zotero.org/styles?q=apa

crsh avatar Jan 09 '20 22:01 crsh

Really appreciate your input and feedback! Would you mind opening a new issue for the apa6_word() problem with a minimal reproducible example?

crsh avatar Jan 09 '20 22:01 crsh

Thanks, I'll look into it.

For APA 7th citations, you need to manually specify an updated CSL file, which is available form this repository: https://www.zotero.org/styles?q=apa

I did that. But the info in the YAML header gets ignored for some reason. I added:

csl : ["apa7.csl"]

and the csl file in the same folder to no avail. When using a wrong file name reference there was no difference. It still used the default apa regardless. Any suggestions, what I am missing here?

jrennstich avatar Jan 09 '20 22:01 jrennstich

Really appreciate your input and feedback! Would you mind opening a new issue for the apa6_word() problem with a minimal reproducible example?

When I tried, I actually could create a Word document. But then discovered a different issue: the references are listed twice. No idea why. This happens for both, PDF and Word and with apa6. Will try to create that error in minimal rep example. Should I open a different issue for the problem I just described?

I also added a second .Rmd file where I tried to link to a different .csl file, american-political-science-review.csl (also included here). Doesn't work. APA default is still being used.

Example_apa7.docx Example_apa7.pdf Example_apa7.Rmd.txt Example_apsa7.Rmd.zip apa7.csl.zip

american-political-science-review.csl.zip

> sessionInfo()
R version 3.6.2 (2019-12-12)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS Catalina 10.15.2

Matrix products: default
BLAS:   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.6/Resources/lib/libRlapack.dylib

locale:
[1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

loaded via a namespace (and not attached):
 [1] compiler_3.6.2    htmltools_0.4.0   tools_3.6.2       yaml_2.2.0        gtree_0.0.1       Rcpp_1.0.3       
 [7] rmarkdown_2.0     papaja_0.1.0.9842 knitr_1.26        data.table_1.12.8 xfun_0.11         digest_0.6.23    
[13] rlang_0.4.2       evaluate_0.14 

jrennstich avatar Jan 09 '20 22:01 jrennstich

I think what you are experiencing is the issue described in https://github.com/crsh/papaja/issues/338

crsh avatar Jan 09 '20 23:01 crsh

Thanks for the MWE! I think I found the culprit that was causing the problems with specifying a custom CSL file. I just pushed the commit. Let me know if it works for you, too.

crsh avatar Jan 15 '20 22:01 crsh

For further discussion on APA 7th edition, please go to https://github.com/crsh/papaja/issues/342

crsh avatar Jan 16 '20 09:01 crsh

Closing in favor of #342.

crsh avatar Nov 22 '22 08:11 crsh