LateX SWeave/Knitr naming file

OMGGGGGGGGGGGGGGGGGGGGGGGG this is just one of those days….. when you keep hitting the same problem over and over again. But miraculously under certain conditions, the problem is not there! Indicting that it’s not your computer set up that’s the issue. The problem lies with you but for the love of god you cannot figure out why!

I was modifying my Sweave files for knitr and trying to compile. I could run the files through knitr with no problem by M-n r after installing knitr (as per my previous post). But after when I’m running latex (C-c in emacs in the .tex file), I kept running into the problem of ERROR: LaTeX Error: Missing \begin{document}. I kept thinking it was my knitr conversion process that screwed up my preamble. After about an hour of struggle and double, triple checking a working file that I downloaded from the knitr webpage, and finding that although two files have the exact same content, one would work while another doesn’t. Turns out it’s because of the stupid file name!!!!! The saddest thing is that I knew about it before when I was working in Sweave…… \textbf{File names cannot have spaces!} I just forgot… damn brain!

Well I hope if you ever come across this problem, it won’t take you THAT long to figure it out. This is a clear indication that my brain is going to mush compared to before. I used to think that I would naturally remember these things but clearly not………………………………

At least now I know and hopefully I won’t forget next time. And I can start knitting(knitr-ing) :P~


Tags: , , , ,

About lucialam

attempts at organizing my thoughts and mind

2 responses to “LateX SWeave/Knitr naming file”

  1. Yihui says :

    I never create files with spaces in their names. Spaces are simply disasters.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: