I've been noticing that some of my files take a really long time to compile. It'll often be sluggish to compile and then produce an "invalid or corrupted file" error for a long time before resetting and updating - sending me back to the top of the document. It's rather irritating and hard for me to typeset when the pdf resets its position back to page 1 and takes forever to compile even for a small change.
One of my guesses as to why this was happening was maybe the file size/inefficiency with compilation, so I made the following changes:
- Made a more minimal
.styfile and removed some.texshortcut configurations which could be buggy - Made the file as minimal as possible by keeping the current inputs to a minimum on a document that has a master
.texfile and multiple\inputs. - Removing unnecessary formatting changes, e.g. fancy page headers/footers This all made the document much more simple and theoretically have less instructions to compile, but still it is taking forever to compile.
Then I thought it could be up to the fact that I used \inputs as I was testing my .sty file in another folder with a minimal test file - which seems to compile just fine. However, I went and removed a small section of that file to another test file and readded it as input, and it also became unbelievably slow.
Right now, I use \input as a way to take small notes and compile them into a larger document, but it seems like it is the reason that compilation is being so troublesome. Has anyone else had a similar issue, and is there any way to fix it (besides just compiling all notes on a large TeX file)?
Run Example: I used the following files:
\documentclass{article}
\usepackage[lecture]{random}
\begin{document}
\title{Notes}
\author{Revise}
\date{Fall 2021}
\maketitle
% toc
\tableofcontents
\input{15_tail_calls.tex}
\end{document}
%% Tail Calls
\section{Tail Calls}
\begin{tcbexample}[name = Lexical/Dynamic Scope, minted language = scheme]{
Lexical Scope: Standard way how names are looked up in Python/Scheme - parent of a frame is the frame in which a procedure is defined.
Dynamic Scope: Alternate approach to scoping, parent of the frame is the frame in which a procedure is called. Known as \lstinline{mu} special form in Scheme.
}
(define f (lambda (x) (+ x y))) ; P: global
(define g (lambda (x y) (f (+ x x)))) ; G - P: global, F - P: F1 (when using dynamic scope)
(g 3 7)
\end{tcbexample}
Here is the link to random.sty, the preamble package I am using.
This is the resulting .log output.
Latexmk: fls file doesn't appear to have been made.
Latexmk: Examining 'master.log'
=== TeX engine is 'pdfTeX'
Latexmk: Errors, so I did not complete making targets
Collected error summary (may duplicate other messages):
pdflatex: Command for 'pdflatex' gave return code 1
Refer to 'master.log' for details
Latexmk: Use the -f option to force complete processing,
unless error was exceeding maximum runs, or warnings treated as errors.
Background: I use pdflatex as the compiler and latexmk on the side to help with compilation on VSCode.

\inputs, not even under Windows. (Or are we talking about thousands of files?) To help, we'd need a concrete document and a precise description of your working environment such that we can try to reproduce the problem. For testing, make sure that all files are on the same local drive (to exclude troubles caused by network drives). – gernot Nov 22 '21 at 10:39\inputitself doesn't take much time but if your input path is wrong such that each triggers a search of your entire file system to find the file then it can take a very long time. Hard to tell if that is your case with the provided information. – David Carlisle Nov 22 '21 at 11:04-kpathsea-debug=-1so the file search library logs what it is doing. You could show a small complete example and the log that you get – David Carlisle Nov 22 '21 at 12:50-kpathsea-debug = -1on a test file. It still bugs though. Let me know if that was the right error/log. – Revise Nov 22 '21 at 20:30random.styso no one can reproduce your issue. – David Carlisle Nov 22 '21 at 21:02.styfile - it was located in a localtexmfdirectory. The test worked since I was testing on a file in the same directory asrandom.sty, so it was easily located. However, normally, it is tucked away indocuments/current/texmf...which is accessible (through toggling settings) but not the default path. The.styfile was not found in WSL though, because it's not in the default path. Pretty sure that was what was causing it. – Revise Nov 25 '21 at 03:53