Hi, this is a followup to the thread with a similar name, but I thought it deserved a new thread since I'm posting a complete solution (hehe - I'm trapped in a hotel room in Paris, it's raining here...)
So:
1) create a new command "Lable Table" with input= entire document output=Show as HTML
2) the command is the following. (I know, I should post a .tmCommand file, but I do not know how so bear with me). GMane requested me to split the commands, but we have here 6 commands (5 sed and 1 tr) which should be on one line each. When joining back the last sed command do not introduce spaces.
sed -n -e "/\label/{=;N;N;G;p;}" | sed '/^$/d' | sed 's/^([0-9]*)$/<p></p>\1/' | sed 's/(.)$/\1<br>/' | sed 's/\label{(.*)}/<a href="javascript:TextMate.system ("/usr/bin/osascript &>/dev/null -e %tell app \\ "TextMate\" to insert \"\1\"% & amp;", null);">\label{\1}</a>/' | tr "%" "'"
3) open a .tex file and experiment. When you click on a label the argument is inserted. The command and the text insertion is very fast, and as to usability it's already better than the standard Label completion (my taste).
Please, some real coder take this stuff and make it into some serious code, I think the result is pretty amazing compared with the simplicity. I am not able to extend the script for multiple files (i.e. one master file and the \includes), any help?
Ciao, Piero
PS I would like to know how to set the parameters (width and heigth) of the HTML window. It's very nice to set the lable table as a column at the side of the source; when you refresh it it keeps the same shape and position and it comes up if it is buried under other windows, so you can keep it always open.
On 24/9/2006, at 16:03, Piero D'Ancona wrote:
How come each letter you send has an extra level of escaping in your name?
PS I would like to know how to set the parameters (width and heigth) of the HTML window.
You can set these with JavaScript (e.g. <body onLoad="…">) -- however TextMate remembers the dimensions of the window for each command, so if you manually resize it once, it should stick. So best actually *not* to set the width/height on load.
On 9/24/06, Allan Odgaard throw-away-1@macromates.com wrote:
On 24/9/2006, at 16:03, Piero D'Ancona wrote:
How come each letter you send has an extra level of escaping in your name?
That's weird, 11 backslash for now! Piero if you continue, you will break the internets! ;)
Le Sun 24/09/2006, Fred B. disait
On 9/24/06, Allan Odgaard throw-away-1@macromates.com wrote:
On 24/9/2006, at 16:03, Piero D'Ancona wrote:
How come each letter you send has an extra level of escaping in your name?
That's weird, 11 backslash for now! Piero if you continue, you will break the internets! ;)
It seems that google does escaping, but not unescaping...
ok, last message: it would be even better to improve the command so that clicking inserts \eqref{...} or \ref{....} according to the type of label....