4

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

Skillmon
  • 60,462
Tom
  • 53

1 Answers1

9

.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.

Heiko Oberdiek
  • 271,626
  • Thanks for the answer. When trying to run latex babel.ins in the directory where babel is: "E:\MiKTeX 2.9\source\latex\babel", I get an error saying: 'latex is not recognized as een internal or external command'. My path in texmaker is set to: "E:\MiKTeX 2.9\miktex\bin" which should be correct – Tom Dec 15 '14 at 13:45
  • @Tom If latex should be executed without specifying the full path, the directory E:\MiKTeX 2.9\miktex\bin should be added to the environment variable PATH. The portable version of MiKTeX does this not automatically, but AFAIK it provides a command window, where the variable is set. – Heiko Oberdiek Dec 15 '14 at 14:02
  • The PATH is already set to E:\MiKTeX 2.9\miktex\bin as mentioned in my earlier comment via the texmaker configuration – Tom Dec 15 '14 at 14:12
  • @Tom echo %PATH% shows the setting in a command window. – Heiko Oberdiek Dec 15 '14 at 14:25
  • echo %PATH% gives a couple windows path's and path's from other programs and also E:\MiKTeX 2.9\aMiKTeX\miktex\bin. So I don't see why it shouldn't work – Tom Dec 15 '14 at 15:11
  • @Tom Perhaps you are using different command windows with different settings. Also there is a wild intermix of problems, (a) LaTeX, the command is not found, (b) LaTeX is run, but no .log file, (c) LaTeX is run, but with an error message, ... – Heiko Oberdiek Dec 15 '14 at 15:20
  • (a) The problem of 'command not found' is solved. I am using the correct command to compile the .ini (b) The problems of no log file is still the same. When I use a log file from an older version of babel, it just says 'no errors', but doesn't compile. (c) compiling via command window gives error 'latex not recognized when ran in "texmf/source/latex/babel/babel.ins" and '.ins not found' in E:\MiKTeX 2.9\miktex\bin. Should I open different questions for the problems a, b and c – Tom Dec 16 '14 at 08:39
  • Thanks for the further answer. When posting this question I used the command prompt via the editor, TeXmaker. Now I used the command prompt via the option 'command prompt' in MiKTeX. Now it can find latex.exe, but when trying to use the command in 'E:\MiKTeX 2.9\source\latex\babel', where I placed the babel.ins file, it still says that it can't find the file.

    So the command 'latex' is working, but can't find .ins file

    – Tom Dec 16 '14 at 10:53
  • @Tom You have to go into the directory with the .ins file. See the first part of my answer for more details. – Heiko Oberdiek Dec 16 '14 at 11:18
  • babel.ins is in E:\MiKTeX2.9\source\latex\babel; so I use cd E:\MiKTeX 2.9\source\latex\babel. Then I use command 'latex babel.ins'; then I get the error: This is pdfTeX, version (the version name) entering extended mode ! I can't find file 'babel.ins'. <*> babel.ins. BTW how do I get that grey background behind .ins? – Tom Dec 16 '14 at 11:31
  • @Tom AFAIK a security feature of MiKTeX, see Ulrike's answer. The code markup with back ticks also works in comments. – Heiko Oberdiek Dec 16 '14 at 12:04
  • Thanks for all the answers. I will mark this answer as accepted. I know placed the babel map outside the MiKTeX tree and now it also works via the command prompt. Maybe you can also revert to ulrike's answer in yours – Tom Dec 16 '14 at 12:43
  • @Tom I have already added a link to Ulrike's answer. Since the method would work with other TeX distributions (TeX Live), I keep it in the answer. – Heiko Oberdiek Dec 16 '14 at 15:55