Geoff are you by any chance setting the TM_LATEX_MASTER variable under TextMate -> Preferences -> Advanced? Then TM will always use that. But perhaps I've missed some part of this conversation.
I don't use xdvi for the very simple reason that by this point in time I don't feel the need to look at the output, simply looking at the code tells me all I need to know about how the output is going to be like, for the most part. And usually I don't have X11 running.
I'm a bit confused though. Do you still go through texMate.py, calling the existing compile command, or do you use your own command (command \equiv bundle item)? If it's the latter, then I don't see how the %!TEX directive will work, unless you do something special in your command. TextMate by itself does not do anything with the file, it just calls your command directly. In texMate,py, we have a lot of code whose job is exactly to locate the root file, if any, and use that, and that's what the built in compilation command uses.
Haris Skiadas Department of Mathematics and Computer Science Hanover College
On Feb 7, 2008, at 8:17 PM, Brad Miller wrote:
It sounds to me like you must have TM_LATEX_MASTER set in a project file or in .textmate_init in a project or something. The latex bundle does not set TM_LATEX_MASTER, it only uses the variable if its set. Are you sure it is always the previous master file?
Try typing this into a latex file and then pressing ctrl-r This will tell you what the environment variable is set to without running any latex commands. If it does not return a blank line then you need to hunt through your environment and see where it is set.
echo $TM_LATEX_MASTER
Brad
On Feb 7, 2008, at 7:06 PM, Geoff Vallis wrote:
You should add a line something like this:
DVIFILE=${TM_LATEX_MASTER:-$TM_FILEPATH}
Then use ${DVIFILE%.tex}.dvi on the /path/dvisync...... command
That will depend on how and where you are setting TM_LATEX_MASTER. This variable is around only for backward compatibility with previous versions of the latex bundle. The preferred method for setting the master file is to put
%!TEX root = /path/to/root in your tex file. BUT that will not help you in your situation. I thought you said you were working with one giant file.
In fact I have files that are stand-alone, and others that sit under a root file. And I do use the %!TEX root method of setting the master file, not any other - it seems similar to what texshop and bbedit use.
I've tried using DVIFILE=${TM_LATEX_MASTER:-$TM_FILEPATH} in my bundle, and it kind of works. But if I go from editing and latexing a collection of files which has a master file, to editing a stand-alone file, then textmate still tries to use the previous master file when dvi-syncing the stand-alone file, which obviously doesn't work. I can work around it with two bundles, or restarting textmate, but that seems very clunky.
But thanks for your input. I realize that there's not a whole lot of folk using xdvi with textmate.
Geoff