HertieDataScience / SyllabusAndLectures

Hertie School of Governance Introduction to Collaborative Social Science Data Analysis
MIT License
37 stars 60 forks source link

Problems compiling PDF when text was written in Word #19

Open christophergandrud opened 9 years ago

christophergandrud commented 9 years ago

A number of students have encountered a problem creating PDF files when they are using text that they originally wrote in Word (or another non-text editor) or when they include some non-standard characters.

Cause of the Problem

The problem is that Word is creating characters or the characters being typed are those that LaTeX doesn't understand. Usually the specific issue is with an em dash (-). Word uses a different character encoding for this character than LaTeX. They may look like the same - but they are encoded totally differently (we will talk about character encoding in Lecture 7). This causes an error when you try to compile to PDF.

Solution

The solution is really easy. In RStudio copy the (-) mentioned in the error message. Then past it into Find and Replace. Replace it with a - that you type in RStudio. They look the same, but they are different. Once you replace all of the - created by Word, you should be good to go.