Skip to content
master
Go to file
Code
This branch is 1 commit ahead, 2 commits behind jan-glx:master.

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

README.md

patchKintrSynctex

code to patch the Synctex file for use with knitr (similar to patchDVI for sweave)

Usage

Save patchKnitrSynctex.R anywhere on your PC. source() in every R Session. Use patchKnitrSynctex("pathto/yourmaintexfile.tex") to patch the yourmaintexfile.synctex[.gz] after compilation. Enjoy forward and reverse search with your favourite pdf viewer/Latex/Knitr Editor!

Example

For example using StatET with eclipse add a external build configuration (Sweave document Processing) and use 'Run commands in active R Console' with...

require(knitr); 
opts_knit$set(concordance = TRUE); 
texfile <- knit("${resource_loc:${source_file_path}}", encoding="UTF-8")

...in the sweave tab and...

syntex <- if (opts_knit$get('concordance'))"-synctex=1" else "-synctex=0";
command=paste("latexmk -pdf", syntex, "-interaction=nonstopmode", shQuote(texfile));
print(paste("Command ",command,"...\n"));
print(shell(command),intern = TRUE);
if (opts_knit$get('concordance')){
	source("C:/Users/Jan/Documents/New folder/patchKnitrSynctex/patchKnitrSynctex.R", echo=FALSE, encoding="UTF-8");
	patchSynctex(texfile); 
}
print(paste0(substr(texfile,1, nchar(texfile)-3), "pdf"))

...in the Latex tab.

Remarks

This will break the Byte offsets in the sy This R implementation is not optimal. If you are compiling books this may slow down your compile process noticeable.

Acknowledgement

Code was inspired by patchDVI, RStudio and Synctex code. I am not affiliated with StatET, Eclipse, Knitr, RStudio, Synctex or patchDVI. They did all the work !

About

code to patch the Synctex file for use with knitr (similar to patchDVI for sweave)

Resources

License

Releases

No releases published

Packages

No packages published
You can’t perform that action at this time.