0

While trying to knit .rmd file to pdf, if code chunks has stargazer function, the file is not knitting to pdf format. I have several tables (both long and short) with combination of regression output via stargazer in latex format but none of them are converting to pdf. I am using MikTeX as LaTeX distribution. I have used following code (as an example)

stargazer(pre.ols.sp01SIOI,pre.ols.sp02SIOI,pre.ols.sp03SIOI,pre.ols.sp04SIOI,
post.ols.sp01SIOI,post.ols.sp02SIOI,post.ols.sp03SIOI,post.ols.sp04SIOI,
style = "qje", type = "latex", header=FALSE, title = "Regression Analysis").

I am getting the following error.

This is pdfTeX, Version 3.14159265-2.6-1.40.21 (MiKTeX 2.9.7440 64-bit) entering extended mode I was unable to find any missing LaTeX packages from the error log Paper1.v7_11Jun2020.log. Error: LaTeX failed to compile Paper1.v7_11Jun2020.tex. See https://yihui.org/tinytex/r/#debugging for debugging tips. In addition: Warning messages: 1: In readLines(log) : line 888 appears to contain an embedded nul 2: In readLines(log) : incomplete final line found on 'Paper1.v7_11Jun2020.log' 3: In readLines(log) : line 888 appears to contain an embedded nul 4: In readLines(log) : incomplete final line found on 'Paper1.v7_11Jun2020.log' 5: In readLines(log) : line 888 appears to contain an embedded nul 6: In readLines(log) : incomplete final line found on 'Paper1.v7_11Jun2020.log' Execution halted

I have followed the debugging tips mentioned on the yihui.org. But still no luck. I have also tried to assign the stargazer output and then use kable() and still it's not working. Moreover, I have tried to using landscape style.

I appreciate any assistance with the issue.

Thanks

Edit: The YAML header

title: XXX 
documentclass: article 
date: "r format(Sys.Date(),'%d %B, %Y')" 
output: 
    pdf_document: 
        df_print: paged 
        fig_caption: yes 
        highlight: tango 
        number_sections: yes 
        citation_package: natbib 
        keep_tex: yes 
        bibliography: library.bib 
header-includes: 
-\usepackage{amsmath} 
-\usepackage[utf8]{inputenc} 
-\usepackage{autobreak} 
-\usepackage{setspace} 
-\usepackage{hyperref} 
-\usepackage[authoryear]{natbib} 
-\usepackage{caption} 
-\usepackage{babel
-\usepackage{multirow}
-\usepackage{pdflscape}
-\usepackage{dcolumn} 
-\usepackage{rotating}
J_F
  • 9,956
  • 2
  • 31
  • 55
  • Welcome to StackOverflow! Can you provide your complete YAML header, and a reproducible example? We do not have your objects `pre.ols...`. – J_F Jun 14 '20 at 13:54
  • ` title: XXX documentclass: article date: "`r format(Sys.Date(),'%d %B, %Y')`" output: pdf_document: df_print: paged fig_caption: yes highlight: tango number_sections: yes citation_package: natbib keep_tex: yes bibliography: library.bib header-includes: \usepackage{amsmath} \usepackage[utf8]{inputenc} \usepackage{autobreak} \usepackage{setspace} \usepackage{hyperref} \usepackage[authoryear]{natbib} \usepackage{caption} \usepackage{babel\usepackage{multirow}\usepackage{pdflscape}\usepackage{dcolumn} \usepackage{rotating} ` – sunmastermind Jun 14 '20 at 16:00
  • pre. OLS are named for different OLS model results. It's working fine while kniting in html but not is pdf. If you want I can upload reproducible code in github. – sunmastermind Jun 14 '20 at 16:05
  • You saw the missing bracket `}` for the `usepackage{babel}`? – J_F Jun 14 '20 at 16:14
  • Apologise for type. Due to character limit, I couldn't include full YAML, I have `}` in original file. Even though the reproducible file is converting to pdf, in my original project file, I keep getting error. Moroever, whenever I am adding` \blandscape` or `float.env = "sidewaystable"` the file isn't converting. I have included the reproducible file here with sample dataset [link](https://github.com/sunmastermind/Volatility-Connectedness). Thanks – @J_F – sunmastermind Jun 14 '20 at 19:39
  • works fine for me. – J_F Jun 14 '20 at 19:50
  • Any idea what could be the issue from my end? I have tried in different ways but it doesn't seem to work. – sunmastermind Jun 14 '20 at 20:46
  • I think you need to pay attention to this error message: "In readLines(log) : line 888 appears to contain an embedded nul". We know neither your code nor your data (please read about [minimal examples](https://stackoverflow.com/q/5963269/2706569)!), but it looks like you're reading a file that contains a `nul` character where it should not. – CL. Jun 17 '20 at 17:45

0 Answers0