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

Allan Odgaard allan at macromates.com
Thu Dec 2 21:53:05 UTC 2004


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/'`"

> [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.




More information about the textmate mailing list