Skip to content

MiKTeX cannot be configured to use a sub-folder for all processing #1746

Description

@aendie

I discovered that having two Command Prompts in Windows 11 (fully updated) confuses MiKTeX (fully updated) - my guess is that it holds some information in a cache and never expects to be called from a second "terminal session".

[CPW = Command Prompt Window]
I use two CPWs to run a large Python program - one for diagnosing test runs and another for regression testing and updating the master files for regression test comparison. The problematic behavior is seen when I use a command line switch in the left CPW to disable a block of code, i.e. exclude a few statements in the generated TeX file. The command line in the righthand CPW does not have this switch, and the generated TeX file correctly includes these lines. So although the TeX file is correct, MiKTeX creates an incorrect PDF file. The problem disappears if I run it once in the left CPW without the switch.

The failing command line (executed from Python) is:
pdflatex -output-directory=./_rt/ -interaction=batchmode -halt-on-error Mars(A4)_66.0N_2013.tex

I verified that the TeX file (1126 lines or 80118 characters) is correct.

All I see In the MiKTeX log file for today is:

2026-06-16 21:13:57,326+0200 INFO  miktex - this is One MiKTeX Utility 1.12 (MiKTeX 26.5)
2026-06-16 21:13:57,326+0200 INFO  miktex - this process (21476) started by pdflatex in directory D:\_DEVelopment\Astronomical coding\CODE - SFplanetary charts\_debug_code\PC.a-py3 with command line: miktex formats build pdflatex --engine pdftex
2026-06-16 21:13:57,327+0200 INFO  miktex - Building format 'pdflatex' with engine 'pdftex'...
2026-06-16 21:13:57,328+0200 INFO  miktex.core - start process: miktex-makefmt.exe --engine=pdftex --dest-name=pdflatex --no-dump pdflatex.ini --engine-option=-tcx=cp227.tcx --miktex-disable-maintenance --miktex-disable-diagnose
2026-06-16 21:14:01,860+0200 INFO  miktex - this process (21476) finishes with exit code 0

This issue would be laborious to replicate in full, so I am hoping that someone can confirm that issues can arise if MiKTeX is run from two separate open Command Prompt windows alternately. And if so, is there any way to include a check this doesn't happen? Note also that everything works after a reboot (until a second CPW is employed).

UPDATE: how to reproduce this error

I discovered a way to reproduce this error without using any Python code. Two .tex files are required:

  • Mars(A4)_66.0N_2013x.tex has the correct diagram
  • Mars(A4)_66.0N_2013y.tex has a vertical yellow stripe missing in the diagram (from June29 to August 2 inclusive)

Correction: One Command Prompt window in Windows 11 is sufficient.
Go to a disk that contains your working directory - here 'cwd'.
Create a folder within it named '_rt'.

MiKTeX has current status (though I think this does not matter - it failed with older versions too):

ReportDate: 2026-06-17 13:57:31
CurrentVersion: 26.5
SetupDate: 2024-11-24 23:07:00
SetupVersion: 24.1
Configuration: Regular
GitInfo: 77333fa / 2026-05-13 12:29:06
OS: Windows 10.0.26200
SharedSetup: no
LinkTargetDirectory: C:\Users\Andrew\AppData\Local\Programs\MiKTeX\miktex\bin\x64
PathOkay: yes
LastUpdateCheck: 2026-06-16 21:08:28
LastUpdate: 2026-06-13 22:05:36
LastUpdateDb: 2026-06-16 21:08:27
SystemAdmin: yes
RootPrivileges: no
AdminMode: no
Root0: C:\Users\Andrew\AppData\Roaming\MiKTeX
Root1: C:\Users\Andrew\AppData\Local\MiKTeX
Root2: C:\Users\Andrew\AppData\Local\Programs\MiKTeX
UserInstall: C:\Users\Andrew\AppData\Local\Programs\MiKTeX
UserConfig: C:\Users\Andrew\AppData\Roaming\MiKTeX
UserData: C:\Users\Andrew\AppData\Local\MiKTeX

First verify correct compilation within the first window CPWa:

  • place Mars(A4)_66.0N_2013x.tex in this directory and rename it to Mars(A4)_66.0N_2013.tex
  • compile it with pdflatex -interaction=batchmode -halt-on-error Mars(A4)_66.0N_2013.tex
Image

The correct PDF diagram is produced:

Image
  • delete the .tex file used above and replace it as follows...
  • copy Mars(A4)_66.0N_2013y.tex in this directory and rename it to Mars(A4)_66.0N_2013.tex
  • as before, compile it with pdflatex -interaction=batchmode -halt-on-error Mars(A4)_66.0N_2013.tex

The PDF diagram generated now has a yellow strip missing between June29 to August 2 inclusive.
This is intentional (for debugging reasons)
Again the correct diagram (based on the .tex. file) is produced:

Image

So far MiKTeX is working perfectly. We now want to compile the original full diagram in a sub-folder (from which the good versions are moved after compilation into folders that are used as a reference during regression testing).

  • copy Mars(A4)_66.0N_2013x.tex into the sub-folder _rt and rename it to Mars(A4)_66.0N_2013.tex
  • compile it with pdflatex -include-directory=./_rt/ -output-directory=./_rt/ -interaction=batchmode -halt-on-error Mars(A4)_66.0N_2013.tex
Image

Of course we expect to see the original file, but instead it produces this:

Image

Only when Mars(A4)_66.0N_2013.tex is deleted from the parent folder will it take the source from the sub-folder.
Perhaps this is the intended behavior, but it confused me that one cannot specify a sub-folder for all processing - that INPUT and OUTPUT files should use a sub-folder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions