I am not sure if this is the correct place to post this request
I am using the combination of the Latex, Sweave & R Textmate bundles for my project.
My main project fie is a latex file which calls include files that are tex files created by Sweave. Essentially, I do almost all the work in the Sweave mode which compiles my main tex file when I CMB-B it. My problem is that when I CMD-click my synched TeXniscope file I end up being taken to the intermediate (tex) file that Sweave created. Since this looks so similar to my sweave file I at times end up editing that tex file rather than the sweave equivalent (snw) when in reality I should be in the Sweave as the true source to edit.
Is it possible for the TeXniscope sync to go to the Sweave (snw) source file rather than the tex equivalent in this case?
Thanks in advance.
Danstan
On 4/7/2006, at 8:22, xolela@mac.com wrote:
[...] Is it possible for the TeXniscope sync to go to the Sweave (snw) source file rather than the tex equivalent in this case?
One idea which springs to mind is to let TeXniscope call a script rather than call mate directly. This script would map the filename to the actual source and possibly also ensure that the line number is adjusted if there is a discrepancy.
On Jul 4, 2006, at 1:44 AM, Allan Odgaard wrote:
On 4/7/2006, at 8:22, xolela@mac.com wrote:
[...] Is it possible for the TeXniscope sync to go to the Sweave (snw) source file rather than the tex equivalent in this case?
One idea which springs to mind is to let TeXniscope call a script rather than call mate directly. This script would map the filename to the actual source and possibly also ensure that the line number is adjusted if there is a discrepancy.
TeXniscope uses pdfsync to find out where to take you, and i am guessing pdfsync links back to the tex file, not the sweave file. So one would need some script that, seeing the tex file, knows that it has come from a sweave file and knows how to find a location in the sweave file given a location in the tex file. I know nothing about sweave, but given such a sweave<->tex sync script the rest can be done.
Haris
On Jul 4, 2006, at 6:55 AM, Charilaos Skiadas wrote:
On Jul 4, 2006, at 1:44 AM, Allan Odgaard wrote:
On 4/7/2006, at 8:22, xolela@mac.com wrote:
[...] Is it possible for the TeXniscope sync to go to the Sweave (snw) source file rather than the tex equivalent in this case?
One idea which springs to mind is to let TeXniscope call a script rather than call mate directly. This script would map the filename to the actual source and possibly also ensure that the line number is adjusted if there is a discrepancy.
TeXniscope uses pdfsync to find out where to take you, and i am guessing pdfsync links back to the tex file, not the sweave file. So one would need some script that, seeing the tex file, knows that it has come from a sweave file and knows how to find a location in the sweave file given a location in the tex file. I know nothing about sweave, but given such a sweave<->tex sync script the rest can be done.
This sounds maybe doable, though tricky. I'm somewhat not encouraged by this text on the pdfsync page:
"The most important problem is the support for multiple input files, which is not detailled here. However, people will appreciate the difficulties to design and implement the pdfsync feature."
I appreciate those difficulties after taking a quick look at one of my Sweave projects:
diss.tex includes a separate file for each chapter, some of which are generated by Sweave. If I understand pdfsync correctly, it manages to identify all those files and then locate a line number according to mappings of coordinates in the PDF. It must do a little magic to concatenate the included input files and then find line numbers -- have I got that right? The problem is that the line number is likely to be erroneous in the case of Sweave, because the Snw files can have a great number of extra lines.
One possibility might be to take the pdfsync line, find some text that corresponds to that line number, and then find the line that corresponds to some match of that text in the sweave file(s). There's any number of things that would prevent that from working (the line corresponds to a table that's generated by sweave code, for example). I'll think about this some more. It would be a neat problem to solve.
-Alan
On Jul 4, 2006, at 10:13 AM, Alan Schussman wrote:
diss.tex includes a separate file for each chapter, some of which are generated by Sweave. If I understand pdfsync correctly, it manages to identify all those files and then locate a line number according to mappings of coordinates in the PDF. It must do a little magic to concatenate the included input files and then find line numbers -- have I got that right? The problem is that the line number is likely to be erroneous in the case of Sweave, because the Snw files can have a great number of extra lines.
Actually the way I understood it to work was that pdfsync adds information into the pdf file, describing at each area in the file what line in the .pdfsync file it corresponds to. So the pdf viewer, when asked to sync back to the tex file, looks into that .pdfsync file to find where it should go. And of course when creating the pdfsync file, we are still at the latex compiling stage, so it is easy to determine what file things come from, and hence if you look at a pdfsync file you see different sections, one for each of the different files that were \include'd in the master. I believe this does not work with \input'ed files.
To be more precise, the .pdfsync file contains pairs of latex code line numbers and corresponding pdf locations for them.
So effectively the best way around it would be if we could somehow provide pdfsync with the appropriate information. Problem is of course that pdfsync only sees the latex files generated by sweave, not the sweave code.
One possibility might be to take the pdfsync line, find some text that corresponds to that line number, and then find the line that corresponds to some match of that text in the sweave file(s). There's any number of things that would prevent that from working (the line corresponds to a table that's generated by sweave code, for example). I'll think about this some more. It would be a neat problem to solve.
This has a better chance to succeed, though it will probably not be perfect (same things appearing in multiple places can't be distinguished easily).
Actually the best thing would be this: Create a mapping between sweave-code lines and latex-code lines, just like pdfsync is a mapping between latex-code lines and pdf-code lines. Then you could run a post processor that takes this file and alters the corresponding sections of the .pdfsync file, to make then link back to the sweave files instead of the tex files. pdfsync doesn't really care (at least I don't think it does) what files you link to, as long as their name appears in there. So it would be just a question of changing the line numbers and name of files linked to in the .pdfsync file, probably doable with a little trial and error.
Btw, here is some information on the pdfsync format, so that you can find what each number means: http://itexmac.sourceforge.net/pdfsync.html
-Alan
Haris
On Jul 4, 2006, at 8:57 AM, Charilaos Skiadas wrote:
And of course when creating the pdfsync file, we are still at the latex compiling stage, so it is easy to determine what file things come from, and hence if you look at a pdfsync file you see different sections, one for each of the different files that were \include'd in the master. I believe this does not work with \input'ed files.
Good call, that makes sense. I took a stab based on a quick reading of the documentation. Yours is better. :)
Actually the best thing would be this: Create a mapping between sweave-code lines and latex-code lines, just like pdfsync is a mapping between latex-code lines and pdf- code lines. Then you could run a post processor that takes this file and alters the corresponding sections of the .pdfsync file, to make then link back to the sweave files instead of the tex files. pdfsync doesn't really care (at least I don't think it does) what files you link to, as long as their name appears in there. So it would be just a question of changing the line numbers and name of files linked to in the .pdfsync file, probably doable with a little trial and error.
This is cool. Sweave code is easy to filter out of the source file, so it might even be not too difficult. I'll take a look in the next day or so and see if I can come up with something.
-Alan
On 4/7/2006, at 21:50, Alan Schussman wrote:
[...] Sweave code is easy to filter out of the source file, so it might even be not too difficult.
If it’s easy to filter out the sweave code, the wrapper could insert a mark (special character) in the sweave file, filter out the sweave code, and then check on what line the mark is.
I have been working a little bit on a replacement for Sweave that does not have the intermediate step (it embeds the r output directly into the latex file, rather like cog), and so doesn't have these problems.
If anyone is interested I could send them a copy of the package.
Hadley
On 7/4/06, xolela@mac.com xolela@mac.com wrote:
I am not sure if this is the correct place to post this request
I am using the combination of the Latex, Sweave & R Textmate bundles for my project.
My main project fie is a latex file which calls include files that are tex files created by Sweave. Essentially, I do almost all the work in the Sweave mode which compiles my main tex file when I CMB-B it. My problem is that when I CMD-click my synched TeXniscope file I end up being taken to the intermediate (tex) file that Sweave created. Since this looks so similar to my sweave file I at times end up editing that tex file rather than the sweave equivalent (snw) when in reality I should be in the Sweave as the true source to edit.
Is it possible for the TeXniscope sync to go to the Sweave (snw) source file rather than the tex equivalent in this case?
Thanks in advance.
Danstan
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Hi Hadley,
I would be interested in trying this out...
danstan
On Jul 6, 2006, at 6:38 AM, hadley wickham wrote:
I have been working a little bit on a replacement for Sweave that does not have the intermediate step (it embeds the r output directly into the latex file, rather like cog), and so doesn't have these problems.
If anyone is interested I could send them a copy of the package.
Hadley
On 7/4/06, xolela@mac.com xolela@mac.com wrote:
I am not sure if this is the correct place to post this request
I am using the combination of the Latex, Sweave & R Textmate bundles for my project.
My main project fie is a latex file which calls include files that are tex files created by Sweave. Essentially, I do almost all the work in the Sweave mode which compiles my main tex file when I CMB-B it. My problem is that when I CMD-click my synched TeXniscope file I end up being taken to the intermediate (tex) file that Sweave created. Since this looks so similar to my sweave file I at times end up editing that tex file rather than the sweave equivalent (snw) when in reality I should be in the Sweave as the true source to edit.
Is it possible for the TeXniscope sync to go to the Sweave (snw) source file rather than the tex equivalent in this case?
Thanks in advance.
Danstan
_ For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
Thanks Hadley...
I am hoping that a Sweave-based solution is also found...
It appears that a number of people on the list have some great ideas on possible Sweave-based approaches... This would enable portability of code..
danstan
On Jul 6, 2006, at 6:38 AM, hadley wickham wrote:
I have been working a little bit on a replacement for Sweave that does not have the intermediate step (it embeds the r output directly into the latex file, rather like cog), and so doesn't have these problems.
If anyone is interested I could send them a copy of the package.
Hadley
On 7/4/06, xolela@mac.com xolela@mac.com wrote:
I am not sure if this is the correct place to post this request
I am using the combination of the Latex, Sweave & R Textmate bundles for my project.
My main project fie is a latex file which calls include files that are tex files created by Sweave. Essentially, I do almost all the work in the Sweave mode which compiles my main tex file when I CMB-B it. My problem is that when I CMD-click my synched TeXniscope file I end up being taken to the intermediate (tex) file that Sweave created. Since this looks so similar to my sweave file I at times end up editing that tex file rather than the sweave equivalent (snw) when in reality I should be in the Sweave as the true source to edit.
Is it possible for the TeXniscope sync to go to the Sweave (snw) source file rather than the tex equivalent in this case?
Thanks in advance.
Danstan
_ For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate