Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Package inputenc Error: Unicode char \u8 in RStudio

In RStudio, when i go for convert my Markdown file to PDF then it gives me the error:

output file: report.knit.md

! Package inputenc Error: Unicode char \u8: not set up for use with LaTeX.

See the inputenc package documentation for explanation. Type H for immediate help. ...

l.117 performance for 32 automobiles (1973â

Try running pandoc with --latex-engine=xelatex. pandoc.exe: Error producing PDF from TeX source Error: pandoc document conversion failed with error 43 In addition: Warning message: running command '"C:/Program Files/RStudio/bin/pandoc/pandoc" +RTS -K512m -RTS report.utf8.md --to latex --from markdown+autolink_bare_uris+ascii_identifiers+tex_math_single_backslash-implicit_figures --output report.pdf --template "C:\Users\USER\Documents\R\win-library\3.2\rmarkdown\rmd\latex\default.tex" --highlight-style tango --latex-engine pdflatex --variable "geometry:margin=1in"' had status 43 Execution halted

My R version (Windows 7):

R version 3.2.1 (2015-06-18) -- "World-Famous Astronaut" Copyright (C) 2015 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 (64-bit)

like image 281
Animesh Kumar Paul Avatar asked Sep 26 '15 06:09

Animesh Kumar Paul


People also ask

What is package Inputenc error?

An inputenc package error such as Invalid UTF-8 byte "96 means that some of the material in the input file does not follow the encoding scheme.

What is Inputenc in LaTeX?

inputenc – Accept different input encodings The package translates various standard and other input encodings into a 'LaTeX internal language'.


2 Answers

Given the almost identical error message, I tried following @scoa's suggestion, but putting that line in the YAML header did not change the error, so for whatever reason, Knitr wasn't looking there to determine the LaTex engine. However, next to the "Knit PDF" button in the control bar is a settings menu that allows you to specify the LaTex ending in the "Advanced" pane. This solved the problem for me. It produces a slight variation on the suggestion above, modifying the YAML header thus:

  output:      pdf_document:          latex_engine: xelatex 

I can see that @scoa may have assumed the YAML output was already formatted this way, but what I was missing was the colon after 'pdf_document'. Using the settings dialogue created the proper syntax in the header.

RStudio version 0.99.896, knitr version 1.12.3.

enter image description here

like image 175
svannoy Avatar answered Sep 18 '22 15:09

svannoy


Here is a less technical solution but it worked for me when everything else didn't. Try deleting (after copying your code elsewhere) parts of your file and then kniting it. Then by process of elimination you will be able to narrow it down to the character/s that are causing the problem. Keep in mind there may be multiple occurrences of the problem. To make it easier to find the character the error message gave me the utf code of the character and I was able to look up what it was. Apparently there was a special 'fi' character used five times in the text I copied and pasted from so I looked for and replaced them with a normal 'fi'.

like image 45
ebeilmann Avatar answered Sep 19 '22 15:09

ebeilmann