I am running into an issue in the process of generating PDFs through R/Sweave/tinytex on a CentOS server. Here is the command that runs the process:

Sweave(rnwFile, encoding = "UTF-8", output=filename)

The error occurs once the .tex is being converted into a .pdf via the tools:texi2pdf command and reads as follows:

! Missing \endcsname inserted.
<to be read again>
l.118 \begin
!  ==> Fatal error occurred, no output PDF file produced!
Calls: <Anonymous> -> texi2dvi

After chopping up my code to figure out where the error occurs from, I can tell it is originating from within its huxtable. I will post the important part of the RNW file here:

<<external-code, warning=FALSE, message=FALSE, echo=FALSE>>=
# r code for getting data here, works fine
huxTable <- as_hux(df1)
huxTable <- huxTable %>%
set_align(1, everywhere, "center") %>%
set_all_borders(brdr(0.5, "solid", "black")) %>%
set_align(-1, 1, ".") %>%
#set_colspan(1, 2, 5) %>%
set_font_size(everywhere, everywhere, 8)

#the header is full of other fields/data, but I have confirmed it is unrelated to this issue.
<<results=tex, include=TRUE, warning=FALSE, message=FALSE, echo=FALSE>>=

I have confirmed that the text inside the huxtable does not have any special characters that caused it to error out. I also ensured that the .aux and .out files generated with the failed attempts were deleted, too. I have generated other PDFs with similar dependencies, and so I am stumped with what's going on here. Any ideas?

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.