[TxMt] Open .pdf partner of pdflatex file + results window question

David Wooten wooten at berkeley.edu
Thu Dec 2 22:05:52 UTC 2004


On Dec 2, 2004, at 1:53 PM, Allan Odgaard wrote:
> On Dec 2, 2004, at 21:18, David Wooten wrote:
>
>> Any way to make a Command which can work with the $TM_FILEPATH 
>> variable -- except with a .pdf extension? This is good really only 
>> for opening the .pdf file in e.g. TeXniscope for the first time. …or 
>> another method?
>
> If you know the extension of the existing file, e.g. .tex, you can use 
> bash's ability to substitute strings, e.g.:
>    open "${TM_FILEPATH/%.tex/.pdf}"
>
> This replaces a potential trailing '.tex' string with '.pdf' before 
> inserting the value of the variable.
>
> Otherwise you can do general substitutions with shell command 
> interpolation and e.g. perl:
>    open "`echo $TM_FILEPATH|perl -pe 's/\.[^.]+$/.pdf/'`"

Ah, that's excellent. The first one should do the trick exactly.

>> [tooltip] seems to appear with the top left corner at the cursor -- 
>> which often leaves the bulk of the window off the screen.
>
> I'll try to improve this. Also, I could make it so that the window 
> only opens if there is output, but then there probably need to be some 
> other feedback to when the command completes -- personally I like 
> audio feedback ;) but this can already be made w/o me having to do any 
> work. Another alternative is to allow commands to change the text in 
> the status bar.

It's a little tricky in the case of TeX, as there is output regardless 
of whether there is an error or not. It would be great (and probably 
not that tough) to simply not focus the result window -- which could be 
pulled forward in case of errors.

Thanks again,
DW




More information about the textmate mailing list