Terminal Commands – Running .ins Files with Terminal and User Commands

installingpackagesterminal-output

I'm using a portable version of MiKTeX 2.9 on an external hard drive on a pc without admin rights.

I try running an .ins file with TeXmaker terminal using 'latex NameOfPackage.ins', but it says can't find file NameOfPackage.ins.
I first placed the file inside the MiKTeX tree and updated the FNDB, which didn't work.
I then tried placing it ouside the tree, with which it still couldn't find the file

I used a user command in texmaker to compile the .ins file, which gave the error:
no log file found

"E:/MiKTeX 2.9/miktex/bin/latex.exe" -interaction=nonstopmode %.ins

I used a user command before, with success, but after settings reset I don't know exactly what the command was, so I might have done this wrong

Edit:
While i tried running the same command again it gave an emergency stop for the line

\generate{\file{dutch.ldf}{\from{dutch.dtx}{code}}}

dutch.ldf was already in the folder, so I deleted the file and tried again.
It worked this time, so the problem seem to be solved.
I would guess it is best to delete the files that where generated when the problem occured, to avoid problems like this

The place where I found the command for .ins:
tex.stackexchange.com/questions/123129

I would still like to know why using the terminal doesn't work

Best Answer

.ins and .dtx are source files, they are usually sorted into the source subtree of a TDS tree (texmf/source/latex/babel/babel.ins).

The files in a TDS tree are organized in such a way, that source, documentation files are not searched, when TeX looks for its input/package/class files. This reduces the search space and makes file look-up faster.

But on the other side, it is not possible to call generate source files from somewhere else, because .ins or .dtx files are not found outside of the sub tree TDS:tex/. Either

  • these files can be compiled in the directory, where they are:

    cd source\latex\babel
    tex babel.ins
    

    However, this will not work in MiKTeX because of a security feature. See Ulrike's answer (MiKTeX does not find files in application directories).

  • Copy the files to a fresh scratch directory and compile there:

    md scratch
    copy source\latex\babel/* scratch
    cd scratch
    tex babel.ins
    

    (The path before source\... is omitted in both examples and needs to be added.)

Usually LaTeX installation files .ins can be run by plain TeX (tex), because the .ins files are based on docstrip, which does not need the LaTeX format. In some cases, LaTeX is needed nevertheless, sometimes only because of some silly \NeedsTeXFormat{LaTeX2e}.

Typically a LaTeX user do not need to run .ins files, because the TeX distribution provides the packages unpacked already. If the TeX distribution does not contains the package, then CTAN might have package.tds.zip files below CTAN:install/. They only need to be unpacked at the root of the TDS tree (plus refreshing the file name database).

Problem (c) "Command not found", discussed in the comment section

MiKTeX portable does not add its directory bin to the environment variable PATH. Therefore Windows is not able to find the binaries, if they are not qualified with a sufficient path component. This is the price of being portable. The host system remains untouched and the path of the bin folder can change (different USB drive letters, ...).

In order to use MiKTeX portable with a command window, miktex-portable in the installation directory of MiKTeX portable should be called first. It adds an icon to the task bar. A right click offers the option "Command Prompt", which opens a command window, where the environment variables for MiKTeX are set. See "How to use MiKTeX portable".

If you want to use MiKTeX on your system permanently, then the normal MiKTeX version is preferable. Otherwise, the environment variables can be configures manually in the Windows system, if the bin folder has a permanent location or the previously described way can be used.