0

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.

enter image description here

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 .sty file and removed some .tex shortcut 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 .tex file 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.

Revise
  • 365
  • 1
    In your description nothing sticks out as a cause for what you experience. This does not seem to be a (La)TeX issue, but rather some problem related to the other tools that you use, and their interactions. TeX itself does not really slow down if you have a bunch of \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
  • did you try to flatten your file to make sure it is an \input problem ? https://tex.stackexchange.com/q/21838/119245 – gigiair Nov 22 '21 at 10:49
  • various things can slow down, including wrong search pathes and bugs in the tools, here e.g. it was a bug in latexmk https://tex.stackexchange.com/q/593741/2388. But without more concrete details it it quite impossible to help you. – Ulrike Fischer Nov 22 '21 at 10:50
  • Sure, I can send you a link to test files which had some trouble compiling. – Revise Nov 22 '21 at 10:53
  • \input itself 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
  • you can add -kpathsea-debug=-1 so 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
  • @DavidCarlisle That seems to be a valid reason. I think I've updated it (by running latexmk with -kpathsea-debug = -1 on a test file. It still bugs though. Let me know if that was the right error/log. – Revise Nov 22 '21 at 20:30
  • you haven't shown the tex log (which presumably shows an error) nor any kpathsea trace output. Your test is using some local package random.sty so no one can reproduce your issue. – David Carlisle Nov 22 '21 at 21:02
  • I think I know where to find the tex log; however, I don't know how to find the kpathsea trace output. I'll add the random.sty file in a moment. – Revise Nov 22 '21 at 21:13
  • I was able to resolve the issue and now it runs fine on Vim with WSL2. Still not exactly sure what the issue was but I think it had something to do with the .sty file - it was located in a local texmf directory. The test worked since I was testing on a file in the same directory as random.sty, so it was easily located. However, normally, it is tucked away in documents/current/texmf... which is accessible (through toggling settings) but not the default path. The .sty file 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

0 Answers0