TeXworks / texworks

Main codebase for TeXworks, a simple interface for working with TeX documents
https://tug.org/texworks/
GNU General Public License v2.0
697 stars 127 forks source link

[Feature request] Using Texworks to edit metapost file #646

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
On Mac OS X, TexShop includes a wonderful metapost engine by Nicola Vitacolonna 
(the latest version of which is available on 
https://sole.dimi.uniud.it/~nicola.vitacolonna/software/metapost-texshop/). 
Nicola Vitacolonna has written two perl scripts : nv-metafun.engine and 
nv-metapost.engine; who are of invaluable help to use TexShop as metapost (or 
metafun) editor. One just needs to compile a .mp file and get a preview of the 
pdf files generated. For example, a foo.mp file generating 3 figures foo.1, 
foo.2 and foo.3, converted to foo-1.pdf to foo-3.pdf and previewed as foo.pdf 
containing 3 pages, one for each figure.

The perl script works as is with Texworks on mac OS X : I changed the extension 
.engine to .pl, and created a new typesetting tool metapost-nv, as explained in 
http://code.google.com/p/texworks/wiki/AdvancedTypesettingTools with the 
following configuration :

Name : nv-metapost
Program : <path to the script nv-metapost.pl>
Argument = $fullname

x view pdf after running

The same settings should work on linux or any unix based system.

On windows, I created a nv-metapost.bat file, containing a single line :

perl -S nv-metapost %1

and the script runs fine with the following configuration :

Name : nv-metapost
Program : <path to the script nv-metapost.bat>
Argument = $fullname

x view pdf after running

if the file nv-metapost.pl is in a folder included in the search paths declared 
in texworks. There is however a problem with two lines in the script using the 
"mv" command (renaming a log file or appending .mps suffix to files whiteout 
.number or .mps extension); which proved harmless for the examples I compiled.

Thus, the feature request :
1.  can this script be included in the next version of Texworks (correcting, 
for windows, the lines using "mv" with the appropriate syntax) ? For the 
windows, one may add a comment about perl in the .bat files, like latexmk does. 
The nv-metapost.bat should read :

Rem Execute nv-metapost.pl, searching for it in the PATH
Rem Assume perl is in the PATH.  If not, you should replace 'perl' by 
Rem the full pathname of the perl executable, e.g., 'C:\perl\bin\perl.exe'

perl -S nv-metapost %1

2. Texworks does not propose (in its default config) to open .mp or .mf files : 
could these extension be included in the extensions opened by texworks in 
future version ? One can always switch to "open all files (*.*)", but it would 
be nicer if .mp or .mf files where associated with texworks by default.

Original issue reported on code.google.com by benoit.r...@gmail.com on 12 Feb 2014 at 8:51

GoogleCodeExporter commented 9 years ago
This sounds really nice!
However, it probably won't be included in Tw by default as it requires an 
additional program (perl) that is most likely not installed on every computer. 
As we want Tw to work out of the box on (almost) all "standard" systems, the 
requirement for perl is a show-stopper. This is also the reason why latexmk is 
not included in the list of engines by default.

That said, there should be no problem in adding it to the 
AdvancedTypesettingTools wiki page. Maybe you could suggest to the original 
author to use File::Copy instead of the mv command, then it would be 
cross-platform compatible without any changes to the source code (which I'd be 
kind of reluctant to document on the wiki page as the original code might 
change without notice).

Regarding the support for additional extensions: You can easily configure the 
extensions shown in the open file dialog in 
<resources>/configuration/texworks-config.txt.

Original comment by st.loeffler on 22 Feb 2014 at 8:59