-1

Edit: I am using RStudio

Up till now, while commenting something, I was using % symbol. Alternatively, I am just using Ctrl+Shift+C shortcut, which results in commenting with % or %' (or # for chunks).

The problem is, even if I comment something, it still often causes compilation errors. Look at the part of screenshot below:

compilation error

Lines 1 to 23 are fully commented and document starts at line 24. However, even if parts of the code are commented out and shouldn't affect it, they for some reason still results in errors.

If I move code from lines 24to32 at the very beginning of the file, it compiles without problems. I thought that maybe there can't be comments at the beginning of the file, but looks like it's not an issue, as trying things like moving \documentclass{article} at the very beginning still results in errors, even though there are less of them.

How can I comment lines, so they won't be calling compilation errors?

alistaire
  • 42,459
  • 4
  • 77
  • 117
Kusavil
  • 294
  • 6
  • 15
  • 1
    You might have better luck at [tex.stackexchange.com](http://tex.stackexchange.com/), where there are more folks who know a lot about how LaTeX is converted. – alistaire Jan 01 '17 at 18:11
  • This thread might answer your question: [Comments in Markdown](http://stackoverflow.com/questions/4823468/comments-in-markdown) – G. Belton Jan 01 '17 at 18:38
  • The `66.tex` referenced in the console is probably not the same as the code we see, since RStudio will process the `.Rnw` (using pandoc) to produce `66.tex` and then compile it with pdfLaTeX. I think pandoc might insert content before `\documentclass{article}`. Could you provide a more relevant minimal example that we can try within RStudio? – Werner Jan 01 '17 at 19:42
  • Please post text, not images. – Mark Rotteveel Jan 02 '17 at 09:28
  • there's a possibility that the knitr translator gets confused by having `\documentclass{article}` *not* be the first line in the file. Try putting it first and see if that resolves your problem? – Ben Bolker Jan 02 '17 at 14:36

1 Answers1

0

First, Make sure that all the lines you don't need are "correctely"commented.

Then, i think that you can't put commented code on the top of your document, also avoid to put commented code on your document it's a lousy code.