I have a hard-to-understand LaTeX error on the R Win-builder test website.

My R package stationery has examples of LaTeX (Sweave or knit) and R markdown documents. The documents all build fine on my systems, but there is one markdown file that fails to compile to PDF on the test server for Windows.

The workflow goes like this. Rmarkdown.Rmd is converted to a markdown file. Which pandoc converts to tex. Then the pdf compiler tries to turn to PDF. On the remote test server, I don't have direct access to all of the processing steps, I just get a check.log file.

This is an entirely new problem, with same files I was fine in past.

Here is the error that need to understand:

-- re-building 'Rmarkdown.Rmd' using rmarkdown
! Undefined control sequence.
\lst@HRefStepCounter ...\begingroup \c@lstlisting 
                                                  \lst@neglisting \advance \...
l.197 \begin{lstlisting}

Error: processing vignette 'Rmarkdown.Rmd' failed with diagnostics:
Failed to compile Rmarkdown.tex. See Rmarkdown.log for more info.
--- failed re-building 'Rmarkdown.Rmd'

--- re-building 'code_chunks.Rmd' using rmarkdown
--- finished re-building 'code_chunks.Rmd'

--- re-building 'stationery.Rnw' using Sweave
--- finished re-building 'stationery.Rnw'

SUMMARY: processing the following file failed:

Error: Vignette re-building failed.
Execution halted

Because the build happens on the Windows build server, I don't actually have access to Rmarkdown.log for more details and I'm quite baffled about what is wrong now that was not wrong before.

I don't know which file is being referred to by "l.197", that's not my document Rmarkdown.Rmd for sure.

In the listings.sty file, I do find a stanza with the same words (line 1653 in listings.sty version 1.6, 2015/06/04:

    \advance\c@lstlisting\m@ne \xdef\lst@neglisting{\the\c@lstlisting}%
\gdef\lst@neglisting{\z@}% init

If you were me, what would you do to try to fix the document?

  • 2
    Sorry, but I can not see any LaTeX code resulting in the error you showed. This is the page for LaTeX and friends and not for programming R or html. Please show us the compilable LaTeX code resulting in that error or ask on a better suited site handling programming or R (I do not know R and can not suggest where you should look, sorry). – Kurt Feb 24 at 23:14
  • Since You have run some of these tex blocks with sucess apart from this one you are best able to point to where there could be a difference in vignetting or which command chains you use, the best guide is this which says if it works be thankful :-) cran.r-project.org/web/packages/stationery/vignettes/… – KJO Feb 24 at 23:43
  • you get such an error if you try to compile a listing in the preamble of your document, e.g. by trying to store it in a box as the lstlisting counter is only setup at begin document. – Ulrike Fischer Feb 25 at 9:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.