paezha / macdown

https://paezha.github.io/macdown/
Other
3 stars 1 forks source link

LaTeX Error: Lonely \item--perhaps a missing list environment. #5

Open GregForkutza opened 3 months ago

GregForkutza commented 3 months ago

I am using the cloned repo as is and no changes are made initially. I try to knit index. Rmd. The pdf does not compile. I get the following Errors in the Render window

tlmgr: Remote database (revision 70801 of the texlive-scripts package) seems to be older than the local installation (rev 70821 of texlive-scripts); please use a different mirror and/or wait a day or two. ! LaTeX Error: Lonely \item--perhaps a missing list environment. Error: LaTeX failed to compile thesis.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. See thesis.log for more info. In addition: Warning message: In system2("tlmgr", args, ...) : running command ''tlmgr' search --file --global '/authoryear.dbx'' had status 1 Execution halted

I made sure tlmgr is fully upgraded.

There is further related behaviour I cannot explain.

If I remove both line 15 from 01-chap1.Rmd

Here is a reference to @angel2000.

and lines 35-38 from 99-references.Rmd


nocite: | @angel2000, @angel2001, @angel2002a ...

then the pdf compiles directly from index.Rmd

However If I leave the above lines in and knit Index.Rmd and then compile the thesis.tex file directly it produces a thesis.pdf file that contains the in text citation and the references list is filled, both correctly formatted. However Figure 2.1 now is missing its content but its caption is present.

Here is the errors from the thesis.log from trying to compile thesis.tex

This is for Language 'nil' not supported:

Package biblatex Info: Trying to load language 'nil'... Package biblatex Info: ... file 'nil.lbx' not found. Package biblatex Warning: Language 'nil' not supported. (biblatex) Using dummy definitions on input line 220.

This is for _Line 450LaTeX Error: File `thesisfiles/figure-latex/ch1-scatterplot-1' not found.

Package biblatex Info: Trying to load bibliographic data... Package biblatex Info: ... file 'thesis.bbl' not found. No file thesis.bbl. Package biblatex Info: Reference section=0 on input line 220. Package biblatex Info: Reference segment=0 on input line 220. Package pgfplots notification 'compat/show suggested version=true': you might benefit from \pgfplotsset{compat=1.18} (current compat level: 1.12).

and further downstream

! LaTeX Error: Lonely \item--perhaps a missing list environment. See the LaTeX manual or LaTeX Companion for explanation. Type H for immediate help. ...
l.548 \bibitem[\citeproctext]{ref-angel2000}
Try typing to proceed. If that doesn't work, type X to quit.

and

Underfull \hbox (badness 10000) detected at line 548 [][] [] ! Undefined control sequence.

...\bibcite {ref-angel2000}{\citeproctext} l.548 \bibitem[\citeproctext]{ref-angel2000} The control sequence at the end of the top line of your error message was never \def'ed. If you have misspelled it (e.g., `\hobx'), type `I' and the correct spelling (e.g., `I\hbox'). Otherwise just continue, and I'll forget about whatever was undefined.
GregForkutza commented 3 months ago

I found the solution here: https://github.com/Zettlr/Zettlr/issues/4879

Specifically i made the following replacement in template.tex

I replaced lines 125-153 with

$if(csl-refs)$ % 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}} \usepackage{calc} \newcommand{\CSLBlock}[1]{\hfill\break\parbox[t]{\linewidth}{\strut\ignorespaces#1\strut}} \newcommand{\CSLLeftMargin}[1]{\parbox[t]{\csllabelwidth}{\strut#1\strut}} \newcommand{\CSLRightInline}[1]{\parbox[t]{\linewidth - \csllabelwidth}{\strut#1\strut}} \newcommand{\CSLIndent}[1]{\hspace{\cslhangindent}#1} $endif$

GregForkutza commented 3 months ago

I decided to reopen this , so that when you have the chance you can see if the template.tex file should be updated or not to reflect this. Its not clear to me what the exact issue is because some machines and not others have this bug. sample size is n= 4 and its a 50% split of experiencing the bug or not.

knaaptime commented 3 months ago

stumbled onto this today because i sometimes have similar issues over in mandown. Not sure how the R side of things handles pandoc et al, but the underlying issue (afaict) is that pandoc updates its latex templates (and template args) and you sometimes need to pull those changes into your custom template

so the csl handling as you have it

needs to look like this with newer versions of pandoc. But if you're on an old pandoc, you still need the old template

rpoisel commented 1 month ago

... the underlying issue (afaict) is that pandoc updates its latex templates (and template args) and you sometimes need to pull those changes into your custom template

That's actually the root-cause of many such errors, afaics. Thanks for pointing this out!