[texworks] Lua Extension - put into Sentance Case, Trim, Date Time, lowercase, uppercase

Jonathan Kew jfkthame at googlemail.com
Mon Sep 7 01:56:10 CEST 2009

Just a quick note for now: yes, once the TL'09 release is out,  
scripting is one of the first new features I want to include in the  
development trunk.

Don't assume, though, that the [first] scripting language will  
necessarily be Lua. Although Lua certainly seems to be on the rise in  
the TeX world, another very widely-known language is JavaScript, and  
it happens that Qt includes a lot of support for this right in the  
application frameworks. By using this, we can get a huge amount of  
functionality "for free", without the need to write (and maintain)  
extra code to interface the scripting language to the application's  
built-in objects and functions. So I think it makes sense to try this  
first, and then consider whether any additional language(s) may be  

I have an experimental version with JavaScript support (based on  
Stefan's Lua patch, but much simpler because it doesn't have to  
provide the Lua interpreter or the "glue" code) that I will make  
available after we branch the stable TL release (shortly).

And yes, the ability to have sub-menus (and shortcuts) for scripts,  
and easily modify them, is certainly desirable.


On 7 Sep 2009, at 00:46, Paul A Norman wrote:

> Dear Steffan,
> Thanks for that.
> I come from more a Delphi (Turbo Pascal) background so please excuse  
> anything I say as not working from a purely C workspace.
> The incorporation of a scripting language is a stroke of genius, so  
> many distributed editors do not do that or in Win32/64 were in the  
> past just plugging VBA in.
> In Delphi we can extend an application's functionality using a PHP  
> extension which opens up all the libraries and code of PHP (http://users.telenet.be/ws36637/php4delphi.html 
> ) this plugs into the PHP Zend C API - you can think what I am going  
> to ask here, can TW being a C written application better do this as  
> well as LUA? Or could LUA be asked to handle this for TW - its just  
> that there is such a wealth of string libraries and other  platform  
> independant libaries already available under PHP.
> Dynamic Menu / Sub-Menu Items
> I think I suggested privately to Alain (again form my Delphi  
> background) that the Scripts (LUA) names be utilised to show where  
> they should go on the Scripts menu.
> I was thinking that the Scripts will be more important than many  
> realise at first, in that they will provide a lot of stringhandling  
> utilities and placement of custom tags (custom LaTeX commands), so  
> they will probably increase in number for many users very quickly.
> This made me think from previous experiences that the Script menu  
> would become cumbersome and over full,  very quickly.
> As (in Delphi) I am used to being able to make new sub-menus and  
> menu items dynamiacally at run time, I wondered whether this was  
> possible in TW as well?
> Thinking perhaps that the LUA script name could place it on the menu  
> tree and call for the making of new sub-menu(s) as needed.
> I.e. lua script name:  Insert-LaTeX_Pictures_Righthand-Logos.lua
> - for space
>  _ for new Sub menu
> Would go on Menu     Scripts/Insert LateX/Pictures/Righthand Logos
> Or perhaps it could be a property of the script  in the Script  
> Management tool, plcaement on which (sub)(sub)Menu?
> It would be a great help to us users!
> Paul
> 2009/9/6 Stefan Löffler <st.loeffler at gmail.com>
> Hi,
> On 2009-09-02 11:44, GMAIL wrote:
> >
> > message from TeXworks user
> >
> > I am very new to Lua as no doubt the following will confirm, but I
> > have been able to hobble this together from the Tutorials and chm  
> help
> > and other Lua Wiki resources.
> >
> > Share it in case it inspires any one else...
> >
> Thanks for putting the time into this and for sharing. I haven't  
> tested
> it intensively, but the first impression is great. It's good to see
> people testing the new (experimental) features of TeXworks.
> > (Also wondering, does TW object expose any more properties or  
> methods
> > please?
> >
> Yes, that's definitely planned. So far, the Lua implementation is very
> experimental and basically just a prove of concept. After the first
> official release, we'll brainstorm new development plans for Tw, and  
> Lua
> will certainly be in there. Then we'll probably also be drafting a
> reasonable API with more properties, methods, etc. so that it gets
> really usable. The methods provided so far are only quick hacks to  
> show
> that it can be done (as you proved with your scripts ;)).
> Stefan
> <user_Lua_Menu.png>

More information about the texworks mailing list