Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature request: Build With: R Sweave knitr executes main document instead of child #26

Open
adibender opened this issue Feb 9, 2019 · 2 comments

Comments

@adibender
Copy link

LaTeXTools: allows to place something like
%!TEX root = main.tex
at the top of a .tex file that is included in main.tex and when the build is triggered, main.tex is build instead of the child document. It would be nice to have similar feature for .Rnw (and .Rmd) files.

@randy3k
Copy link
Member

randy3k commented Aug 25, 2019

It would be a bit tricky, for instance, consider that TEX root could be also a Sweave file.

@pascalsiemsen
Copy link

I know that this is an old post but the following settings get the job done:

Create a custom ride_exec command where you replace the standard '$file_name' with your main file. In my case it is index.Rnw.
This can be done in the R-IDE settings.

{
"caption": "Knit Rnw Index",
"cmd": "knitr::knit2pdf('index.Rnw',compiler = 'xelatex')",
"working_dir": "$file_path",
"selector": "text.tex.latex.rsweave"
}

You can also create a keybinding for this command that only works for rsweave

{"keys": ["ctrl+alt+b"], "command": "ride_exec",
"args": {"cmd": "knitr::knit2pdf('index.Rnw',compiler = 'xelatex')", "selector": "text.tex.latex.rsweave", "working_dir": "$file_path"},
"context": [ { "key": "selector", "operator": "equal", "operand":
"text.tex.latex.rsweave" } ]}

But cmd/ctrl+b let's you also choose resp. just uses the command created above. So I just use that.

Hope that helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants