[texworks] Using Lua Extension - to get LaTeX package help

Paul A Norman paul.a.norman at gmail.com
Sat Sep 19 11:44:09 CEST 2009


Dear Stefan,

Thank you for that, it sparked something in my memory, and yes texdoc works
under MiTeX on Windows as well.

My security fears are irrelevent I think unless "texdoc" is removed from the
os.execute command string.

I don't think package names are allowed to have spaces in them, is that
right does any one know?

At least on Windows if you duoble click anywhere between { } in a standard
editor like TeXWorks, you highlight/select any  word in there, so that makes
getting the word easier. befoer using the Menu.

It even works in the browser - try:

\usepackage{graphicx}

Using texdoc may work on all/most distributions perhaps?

--[[TeXworksScript
Title: Package Help
Description: Puts Date Time in
Author: Paul A Norman From gleanings in lUa chm help Lua 5.1 Reference
Manual, wiki, and tutorials
Version: 0.1
Date: 2009-09-19
Script-Type: standalone
]]
 package = "*texdoc* " .. TW.getSelectedText()
 os.execute(package)

Paul

2009/9/19 Stefan Löffler <st.loeffler at gmail.com>

> Hi Paul,
>
> On 2009-09-19 05:03, Paul A Norman wrote:
> > You can use a simple Lua script, if you are using MiTeX (and simply
> > alter it for other distributions),
> > to get LaTeX package help from within Stefan's experimental Lua
> > TeXWorks editor version.
> > (substitute "mthelp"  for your distribution's package help call.
>
> This really is exciting news, thanks for sharing. For TeXlive, the
> program you have to substitute for "mthelp" seems to be "texdoc", though
> I'm not an expert in this.
>
> > We should be careful to only highlight a non-system-destructive
> > package name! So far as I know no CTAN LaTeX package names are
> > synonymous with OS commnds that are dangerous are they?
>
> Still, I'd recommend to enclose the package name in quotation marks. I'm
> not sure if mthelp supports that, but it should. This should at least
> handle spaces in the name (which shouldn't happen in the first place,
> but you never know what gets accidentally selected ;)). In addition to
> that, special characters should probably be escaped (I know that $ is
> such a character on Linux, and quotation marks, too, of course, if the
> string is surrounded by them). But these are details that should not be
> too difficult to implement with simple string replace functions.
>
> Cheers
> Stefan
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://tug.org/pipermail/texworks/attachments/20090919/ec245312/attachment.html>


More information about the texworks mailing list