3

UPDATE

SweaveOpts are now shut off and the macro is no longer auto populating, but I still cannot get my plot into the document

I am using R-Studio, the latest version on my laptop and my desktop. All my packages are up-to-date as of this morning. I am trying to on my laptop insert a plot into a pdf. I am using knitr and pdfLatex, the global options in R-Studio are set to knitr and pdfLatex, the same as on my desktop.

When trying this on my laptop the following always appears in my .Rnw file:

\SweaveOpts{concordance=TRUE}

which is preventing me from rendering my pdf the way I want, meaning my plots do not show inside the document but as a separate file. I ensured I have exactly the same settings in R-studio on the laptop and desktop, I am using the same exact version of R in each 3.1.3 and the same exact packages to produce the document knitr and ggplot2

I am completely baffled on how to shut \SweaveOpts{concordance=TRUE} off and make it stay off.

The head of the document on my desktop looks like this:

\documentclass{article}
\begin{document}
\begin{titepage}
     \begin{center}
 ...

And on my laptop for a different document

\documentclass{article}
\usepackage{setspace}
\begin{document}
\begin{title}
    \begin{center}
...

I did get rid of the \usepackage{setspace} line just to see if that was the issue and it was not.

I have also noticed that when I insert a code chunk and start to type options inside of it, like fig.align='center' the autocomplete works on the desktop but not the laptop, almost like it does not recognize that the knitr library is loaded.

MCP_infiltrator
  • 3,961
  • 10
  • 45
  • 82
  • If you meant to use knitr instead of Sweave, choose the option knitr instead of Sweave in the `Tools -> Global Options`. This has confused quite a few users, but I'm not sure if we (RStudio) should just change the default option to knitr. – Yihui Xie Nov 10 '15 at 17:52
  • Hi Yihui I do ind Ed have knitr set as the default in my global settings. I ended up making a new folder, a new project and a new .Rnw file and that seemed to do it, maybe there was something funky going on with the image? – MCP_infiltrator Nov 11 '15 at 00:06

1 Answers1

4

Try the menu

Tools ->  Global Options -> Sweave

and unselect Always enable Rnw concordance (required for Synctex) which should take care of it.

Dirk Eddelbuettel
  • 360,940
  • 56
  • 644
  • 725
  • No graph...also I have that optioned check off on my desktop machine and graphs produce from there fine. All settings were equal between machines in R-Studio - perplexing – MCP_infiltrator Nov 10 '15 at 12:58
  • Maybe start out with a fresh document: _File -> New File -> Sweave Document_ I can assure that this does not place a the concordance macro into the generated tex file on my box. – Dirk Eddelbuettel Nov 10 '15 at 13:13
  • That worked on my laptop, I will create a new file and dump in my stuff in there and see if that works. – MCP_infiltrator Nov 10 '15 at 13:18
  • so I created a new document and placed the contents of the old one into the new one and still not plots....I have not even finished my morning coffee... – MCP_infiltrator Nov 10 '15 at 13:26
  • Given that, I think it must be something in my document – MCP_infiltrator Nov 10 '15 at 13:32
  • I marked your answer as accepted as that did infact shut the macro off, yet I still cannot for the life of me get my plots in this particular document, it's really nothing fancy either. – MCP_infiltrator Nov 10 '15 at 13:36
  • 1
    I ended up making a new folder, a new project and not useing the `setspace` package and now everything seems to magically work... – MCP_infiltrator Nov 10 '15 at 14:06
  • your problem was that you had "Sweave" instead of knitr in the project options (changing the global options after that doesnt change it in once created projects). – Fitzroy Hogsflesh Apr 14 '19 at 09:08