Closed cjvanlissa closed 2 months ago
Just changing output : papaja::revision_letter_pdf
to output : papaja::apa6_pdf
allows me to render successfully, so I do think something might be missing from the revision_letter_pdf template.
Adding that I am also getting this error.
Thanks for reporting this. I'll take a look as soon as possible.
Any update or workaround for this error?
Following @cjvanlissa comment, I notice that if I try to render the Rmd file, get the LaTeX Error: Lonely \item--perhaps a missing list environment
error, and then inspect the .tex file, this section appears to be incomplete:
\newlength{\cslhangindent}
\setlength{\cslhangindent}{1.5em}
\newlength{\csllabelwidth}
\setlength{\csllabelwidth}{3em}
\newenvironment{CSLReferences}[2] % #1 hanging-ident, #2 entry spacing
{% don't indent paragraphs
\setlength{\parindent}{0pt}
% turn on hanging indent if param 1 is 1
\ifodd #1 \everypar{\setlength{\hangindent}{\cslhangindent}}\ignorespaces\fi
% set entry spacing
\ifnum #2 > 0
\setlength{\parskip}{#2\baselineskip}
\fi
}%
{}
\usepackage{calc}
\newcommand{\CSLBlock}[1]{#1\hfill\break}
\newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{#1}}
\newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{#1}\break}
\newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1}
If I switch to papaja::apa6_pdf and rerender, it works fine. So, I can copy and paste the relevant section of the CSL code into the .tex file (after trying to render with papaja::revision_letter_pdf) and it works correctly. The code I am copy/pasting is the following:
% definitions for citeproc citations
\NewDocumentCommand\citeproctext{}{}
\NewDocumentCommand\citeproc{mm}{%
\begingroup\def\citeproctext{#2}\cite{#1}\endgroup}
\makeatletter
% allow citations to break across lines
\let\@cite@ofmt\@firstofone
% avoid brackets around text for \cite:
\def\@biblabel#1{}
\def\@cite#1#2{{#1\if@tempswa , #2\fi}}
\makeatother
\newlength{\cslhangindent}
\setlength{\cslhangindent}{1.5em}
\newlength{\csllabelwidth}
\setlength{\csllabelwidth}{3em}
\newenvironment{CSLReferences}[2] % #1 hanging-indent, #2 entry-spacing
{\begin{list}{}{%
\setlength{\itemindent}{0pt}
\setlength{\leftmargin}{0pt}
\setlength{\parsep}{0pt}
% turn on hanging indent if param 1 is 1
\ifodd #1
\setlength{\leftmargin}{\cslhangindent}
\setlength{\itemindent}{-1\cslhangindent}
\fi
% set entry spacing
\setlength{\itemsep}{#2\baselineskip}}}
{\end{list}}
I assume this needs to be added to the template to fix this issue, which appears to be lines 173-194 of https://github.com/crsh/papaja/blob/main/inst/rmarkdown/templates/revision_letter/resources/revision_letter.tex.
@crsh thanks for fixing this! While you're at it: I had the same error when rendering an APA6 document recently; might have been a problem with my bib file, but if it happens again I will open an issue.
I think that some change posterior to https://github.com/crsh/papaja/pull/593 has affected this, as I am not getting this error again.
Edit: I notice that if I reinstall the CRAN version the error is not present.
Thanks for letting us know! I plan to submit an update to CRAN shortly.
I'm sorry, this won't be a reproducible example. If it's not a bug, feel free to ignore.
I'm unable to render a revision_letter_pdf with references, because the bibliography entries each give this error:
LaTeX Error: Lonely \item--perhaps a missing list environment.
The entries look like this:
Which seems to be the same as the entries from my papaja::apa6_pdf manuscript:
Maybe some package is missing from the revision_letter template?