[TxMt] Re: question: mouse or not?

Piero D'Ancona pierodancona at gmail.com
Wed Dec 20 15:06:59 UTC 2006


Charilaos Skiadas <skiadas at ...> writes:
> It's not a question of an ideological stance, I just don't think this  
> labels thing is best accomplished via a mouse-only interface, at  
> least not without an alternative. When writing math, the last thing  
> on my mind is using the mouse.

You speak words of wisdom. I guess having both alternatives
would the best thing for everybody. I'm not polishing it
since I'm waiting to see how much better the click-on-pdf
might be.

> As far as the HTML view is concerned, I actually think that you  
> should make the entire text, instead of just the \label{..} parts,  
> clickable. The user should be able to just hover over the correct  
> block of text and click, instead of having to track down the small  
> region where the \label part is. That would make it more usable imo.

The whole test underlined? wouldn't it be too ugly?

> Another idea would be to have the text, or perhaps more of the text,  
> show up as a tool tip when you hover over an item in the HTML view.

That's a very nice idea: to have only the list of labels
to appear in the HTML window, and when I hover with the
mouse the formula appears as a tooltip. Advantages: many
more labels fit into the window, and cleaner interface. 
A disadvantage: more difficult to locate the right one without 
seeing the corresponding formula.

> That is an interesting idea indeed. Though this might be a bit more  
> editor-specific than the plain pdfsync. It would probably require  
> some javascript calls. I would actually prefer it if somehow the \ref  
> is passed to the clipboard, instead of being inserted directly into  
> TM. It is probably also easier to implement, though I'm not sure the  
> pdf file has this information at all.

Actually 6 line of code are sufficient to do the trick!
If you prefer to have the reference in the clipboard, 
the lines drop down to 4 :) and it's not even editor
specific, and requires no modification to pdfsync.
The idea is that when you opt-click the pdf window,
a script is executed; the script is accessible by the
user anc can be modified (and has access to the
internal variables of PDFView). A prototype script
is the following (first three lines are just initialization
and could be handled by PDFVIEW)

#!/bin/bash
linenumber=1442
texeditor="TextMate"
texfilepath="$TM_FILEPATH"

reference=$(sed -n "1,$linenumber p" "$texfilepath" |
grep -o label{[^}]*} | tail -1 |
sed 's/label/\\\\ref/' | sed 's/ref{\(eq\)/eqref{\1/')

exec osascript <<END
tell app "$texeditor" to insert "$reference"
END


Piero












More information about the textmate mailing list