On Dec 20, 2006, at 5:06 PM, Piero D'Ancona wrote:
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?
It doesn't have to be underlined. In fact, it would look just normal, but when the mouse is over it the whole block would be highlighted, and clickable. All it takes is a couple of lines of CSS. It could actually be made to look quite nice. And you can still have the \label part highlighted in some way.
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.
Yeah the key advantage of the HTML view is that you can show a bit more of the context, so ideally that should be visible to some extend. Having just the labels would make it lose some of its advantages.
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)
I guess I don't really know exactly what happens with the linenumber information. What is that number, and how does PDFView get that information out? I guess the same way it does for the pdfsync. But what happens if you click on an equation with no label, or if you click somewhere not an equation? And of course it does depend on the editor supporting the applescript insert call. It does look very plausible though. Looking forward to it.
#!/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
Haris