[TxMt] LaTeX Bundle question

Brad Miller bonelake at gmail.com
Thu Feb 7 23:48:27 UTC 2008


On Feb 7, 2008, at 4:33 PM, Geoff Vallis wrote:

> Brad
>
> Following up with a slightly more explicit description. My bundle(s)  
> works, but not elegantly or well. I have a short script call  
> dvisync.sh that looks like the following:
>
>
> #!/bin/tcsh
> /usr/texbin/xdvi -sourceposition $1$2 $3
>
>
>
> and then I have two(!) bundles, called dvisync1 and dvisync2 that  
> look like:
>
> /pathto/dvisync.sh $TM_LINE_NUMBER $TM_FILEPATH ${TM_FILEPATH 
> %.tex}.dvi
>
> and
>
> /pathto/dvisync.sh $TM_LINE_NUMBER $TM_FILEPATH ${TM_LATEX_MASTER 
> %.tex}
>
>
You should add a line something like this:

DVIFILE=${TM_LATEX_MASTER:-$TM_FILEPATH}

Then use ${DVIFILE%.tex}.dvi  on the /path/dvisync......  command


> The first works if and only if there is no master file, and the  
> second works if and only if there is one. I can't seem to get a  
> single bundle to work in both cases, and also TextMate doesn't seem  
> to reset the master file correctly all the time when I change the  
> files I am editing.
>

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.


Brad


> Any suggestions would be appreciated.
>
> Geoff
>
>
>
>
>
>
>> On Feb 7, 2008, at 2:45 PM, Brad Miller wrote:
>>
>>>
>>> On Feb 7, 2008, at 7:38 AM, Geoff Vallis wrote:
>>>
>>>> Brad,
>>>>
>>>> On Feb 6, 2008, at 9:47 PM, Brad Miller wrote:
>>>>> How do you tell a running version of xdvi to change its position/ 
>>>>> page from the shell?  If it can be done from the shell I'll look  
>>>>> at adding it.
>>>>
>>>> The command to update xdvi is the same whether or not xdvi is  
>>>> already running. It is just:
>>>> xdvi -sourceposition Lineno[:Column]Filename Masterfile[.dvi]
>>>> with, I hope, obvious notation, and of course this command can be  
>>>> embedded in a shell script. The Column parameter is optional. If  
>>>> xdvi is already running, showing masterfile, this call will just  
>>>> bring the xdvi window to the front and switch positions  
>>>> accordingly. If not, the command will open an xdvi window with  
>>>> Masterfile showing.
>>>
>>> That is very easy.  I've just never found X to be very pleasant on  
>>> the mac so I've mostly forgotten everything I used to know.
>>>
>>>>
>>>>
>>>> There are a million other options that you can see with a 'man  
>>>> xdvi' or 'xdvi --help'.  Generally, you first open an xdvi window  
>>>> with the size and options you want, and then the syncing just  
>>>> uses that open window.
>>>>
>>>>
>>>>> If it is a short shell script then it really would be very easy  
>>>>> for you to add your own bundle command.
>>>>>
>>>>> type ctrl-opt-cmd-b to bring up the bundle editor
>>>>> You should see a bundle with your own name, or you can add the  
>>>>> command to the latex bundle.
>>>>> click add new command in the lower left corner.
>>>>> Give your new command a name:  dvisync
>>>>> Save: Nothing
>>>>> Command(s)  Whatever shell script tells xdvi to update itself.   
>>>>> The two variables you may want are:
>>>>> TM_LINE_NUMBER  and TM_FILEPATH  or TM_FILENAME
>>>>> Input:  None
>>>>> Output: discard
>>>>> key equivalent:  your choice
>>>>> Scope Selector:  text.tex.latex
>>>>>
>>>>> Brad
>>>>>
>>>>>
>>>>> Close the bundle editor, and you've made your first TextMate  
>>>>> command.
>>>>
>>>>
>>>> Thanks, I'll give this a shot, whether or not you decide to  
>>>> support xdvi. To be absolutely clear, can you say what the  
>>>> Textmate variables are that correspond to:
>>>>
>>>> linenumber of the file being edited where the cursor is at;
>>>> column of the cursor of the file being edited (if available;
>>>> filename of the file being edited;
>>>> masterfilename (which will be the name of the dvi file).
>>>>
>>>
>>> Geoff,
>>>
>>> You can see all of the environment variables exported by TM by  
>>> running the command  Bundles --> Bundle Development --> Show TM_*  
>>> variables.
>>>
>>> linenumber is TM_LINE_NUMBER
>>> columnnumber is TM_COLUMN_NUMBER
>>> filename of the file being edited:
>>> TM_FILENAME  -- is the filename without any path information
>>> TM_FILEPATH -- is the filename with full path
>>> ${TM_FILENAME%.tex}.dvi  will give you the name of the dvi file  
>>> without path
>>> ${TM_FILEPATH%.tex}.dvi  will give you the name of the dvi file  
>>> with the path
>>>
>>> Brad
>>>
>>>>
>>>> Regards
>>>> Geoff
>>>>
>>>>
>>>>
>>>>
>>>> ______________________________________________________________________
>>>> For new threads USE THIS: textmate at 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 at 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 at 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 at lists.macromates.com
> (threading gets destroyed and the universe will collapse if you don't)
> http://lists.macromates.com/mailman/listinfo/textmate




More information about the textmate mailing list