[texworks] Feature/enhancement request

Paul A Norman paul.a.norman at gmail.com
Mon May 2 10:06:24 CEST 2022

Hi Phillip,

I won't be at a computer for quite some days, but here's one description of
what you could do for any complier executable outside of *TeX typesetting
normalacies :-)

If you need to do this regularly, you could write a JavaScript script to
run from within TeXworks.

You could make this a redundant step probably... If you need to remove your
top line, read in and "split" your saved file into an array using "\n" as
you delimiter.

Concat your array, (if still necessary) from the second element forward,
into a string using "\n" as your joiner. (Looses your top line.)

Save your string out to file with a name and extension your compiler

(If you don't need to disappear your top line, then just jump to here ...)

Then use a shellexecute to run your complier passing your script name even
with a full path if necessary.

Depending upon your TeXworks install environment, you may need to provide a
full path to your compiler executable as well in your execute command.
Depending upon your environment if on Windows, you may even need to get
TeXworks scripting to write a .bat to disk and thenexecute that from within
TeXworks scripting.

Remember with TeXworks Scripting, you are not limited to JavaScript, but
can use Python, and Lua as well.

You'd need to check your TeXworks settings to see whether shellexecutes and
writing to disk et al are switched on in your own setup.

As I say I'm not at a computer for some time, but hope this helps or points
you in a useful direction :-)

Kindest regards,

On Monday, 2 May 2022, Philip Taylor (Hellenic Institute) <
P.Taylor at hellenic-institute.uk> wrote:
> On 01/05/2022 17:28, Philip Taylor (Hellenic Institute) wrote
> Oops — I should have tested this before posting.  The compiler interprets
such pragmats according to its own rules,so in practice the delimiters
would have to be COMMENT delimiters, as in :
> COMMENT % !TeX Program=Algol-68 COMMENT
> As before, is there any possibility to make the syntax of the line-1
typesetting engine programat more flexible, perhaps defining it in terms of
a regular expression to allow other compiler syntaces to be supported ?
> Alternatively, could TeXworks infer the correct "typesetting engine" from
the filename extension for files with extensions other than ".tex" ?  This
would eliminate the need for line-1 typesetting engine pragmats for files
with non-standard extensions and use instead a user-editable look-up table
given the correct "typesetting engine" for each non-standard extension
(e.g., ".a68").
> --
> Philip Taylor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://tug.org/pipermail/texworks/attachments/20220502/85236e2c/attachment.html>

More information about the texworks mailing list.