Hopefully on-topic as about "(La)TeX related software and tools"
I just learned about the rmligs script. Since it isn't available through MiKTeX (and neither through TeX Live), I downloaded the archive manually and unpacked it. Using Windows command prompt, rmligs runs successfully when I'm in the directory where the file rmligs
(without a file extension) is, typing perl rmligs testfile.tex
.
Now I tried to make the script available globally, just like e.g. latexmk is, but didn't succeed. How do I make rmligs globally available, so that I can use it no matter in which directory I am?
I tried putting all the rmligs files in a directory in different places, seeking to follow the texmf tree order:
C:\Program Files (x86)\MiKTeX 2.9\scripts\rmligs\perl\
C:\Program Files (x86)\MiKTeX 2.9\scripts\rmligs\
C:\mtpak\scripts\rmligs\perl\
(C:\mtpak\
is my local/personal/custom root, which works for other additions.)C:\mtpak\scripts\rmligs\
After each of these attempts, I refreshed the file name database, but calling perl rmligs foo.tex
or rmligs foo.tex
didn't work.
I'm using ActivePerl 5.12.4 Build 1205 (64-bit) on Windows 7 (64-bit). I'm not an advanced command line user nor a Perl programmer or anything, I installed Perl in the first place to use latexmk.
Best Answer
My answer has nothing to do with TeX at all, but I hope to answer your question.
In order to run commands on an arbitrary folder, they need to be "known" by the operating system. How do the system know if a command is available? A search in the path. So, first things first:
Extract the content of
rmligs-0.84.tar.gz
to a folder. I suggest to avoid spaces in directory names. In my case, I extracted toC:\paulo\softwares\rmligs
.If I
dir
my directory, I have:Now, lets add that directory to the Windows path. As Canageek mentioned, go to
Control Panel -> System and Security\System -> Advanced system settings -> Environment settings
. For God's sake, take care.:)
I usually prefer to change myuser variables
instead of thesystem variables
, so double-click thePATH
variable underuser variables
, go to the end of the line, type;
and add the full path we set in the previous step:(Sorry, my Windows is in Portuguese, but I hope you get the idea)
Then click
OK
a bunch of times.:)
Now let's go to the command prompt:
It didn't work
you bastard! I'll explain why. There's a system variable calledPATHEXT
, if I echo it (it might be different on your computer):Those are the files which can be executed in the command prompt and their order. As you can see, if you have
bla.exe
andbla.bat
in the path, the first one will be executed because it has a higher priority. Now lets add ourrmligs
Perl script.Go to the
rmligs
directory (in my case,C:\paulo\softwares\rmligs
) then create a file calledrmligs.cmd
(I'm a fan of.cmd
instead of.bat
) with the following content:Done! Lets break it:
perl
is the interpreter,%~dp0\rmligs
gives the the full path to the script, and%1
to%9
are the arguments provided to the.cmd
script. Great!Now lets open another command prompt:
Cool
take all my money! Now lets test it. I copiedtestfile.tex
to myDocuments
folder, lets see if it works:Yay! Hope it helps.
:)