# How to make the next compilation longer?

My question is an extension of How to prolong compilation time while engaging in leisure activities?.

I would like to make consequtive compilations longer, for example:

\newif\ifpaid
\everypar{\ifpaid{}\else {slowing down action dependent on a value written into external file} \fi}
\ifpaidfalse
\ifpaid{}\else{increase the value making the code slow}\fi


Certainly this part of a code should be rather hidden to novices.

The purpose of such a code should be obvious from the name of \if-conditional.

Edit: I have suggested a standard TeX/LaTeX solution, but any other tricks are also welcome.

• Should we assume that the aux file is deleted after each run? – StrongBad Sep 29 '17 at 17:20
• @StrongBad No. My idea was an *.aux file with changes. But certainly they can be written somewhere else. – Przemysław Scherwentke Sep 29 '17 at 18:38

You must, as in the method of computer viruses, get the user to initially participate willingly in the plot. In the case of a virus, that is done by getting the user to click on something, in the hopes that it is something beneficial. In the case of LaTeX, it will mean getting the user to include a file (or style) that he has been told is beneficial

To be quite honest, even though I wrote the code based on a prior answer of mine, Extracting the structure of a LaTex document, including comments, I don't quite understand here how the Delay counter is working (it increases by 5 with each compilation, probably a result of multiple passes in \@starttoc??). But it works.

Here is innocuous.tex which ties into the \@starttoc logic (EDITED to reduce non-essential code and to longer requires an invocation of \tableofcontents to operate)

\usepackage{pgffor}
\newcounter{Delay}
\newcommand\delay[1]{%
\setcounter{Delay}{#1}%
\foreach\i in{1,...,#1}{%
\i, % REPLACE THIS LINE WITH SOMETHING THAT SQUANDERS A SHORT AMOUNT OF TIME
}%
\stepcounter{Delay}%
}
\makeatletter
\AtBeginDocument{\@starttoc{xyz}}
\makeatother


Then, as long as you get your user to \input the file:

\documentclass{article}
\input{innocuous}
\begin{document}
Testing
\end{document}


every time it is compiled it increases the number times it goes through the loop invoked by \delay. Here, I just print out the loop index to demonstrate, but you would want to replace that one line with something [non-printing] that eats up a small (but not infinitesimal) amount of time.

The \delay loop count for each successive compilation is 5i-2 where i is the number of compilations. The method operates by creating a .xyz file containing the line

\delay{69}


where, upon each compilation, the index is grown. When the code is compiled, it will execute 69 delay loops and then grow the index by 5.

• "a small but finite amount of time." *muttermutter* Anything that is small is certainly finite: finite means "not infinite" (i.e., not indescribably large), not "not zero". – David Richerby Sep 29 '17 at 18:23
• @DavidRicherby By "small but finite," I mean "not infinitesimal." I have edited accordingly. – Steven B. Segletes Sep 29 '17 at 18:24

Document:

\documentclass{article}

\usepackage{infinitywait}

\begin{document}

Hello world

\end{document}


Package infinitywait.sty:

\ProvidesPackage{infinitywait}
[2017/09/29 v0.9 how to occupy the wait for Infinity War release (JFB)]
\def\infinitywait@N{1000000}
\AtEndDocument{%
\immediate\write\@mainaux{%
\gdef\string\infinitywait@N{\the\numexpr2*\infinitywait@N}}%
\count@ \infinitywait@N\relax
\loop
\ifnum\count@>\z@
\repeat
}
\endinput


Better infinitywait.sty. Better clean out aux file of previous one before switch to this one...

\ProvidesPackage{infinitywait}
[2017/09/29 v0.99 how to occupy the wait for Infinity War release (JFB)]
\def\infinitywait@N{1000}
\AtEndDocument{%
\immediate\write\@mainaux{%
\gdef\string\infinitywait@N{\the\numexpr1000+\infinitywait@N}%
}%
\count@ \infinitywait@N\relax
\loop
{\count@\infinitywait@N\relax
\loop

• I had forgotten that 2**31` is rather quickly reached... so quadratic growth of updated answer is better, and due to nested loops, one will never live long enough to see a number too large TeX error ... – user4686 Sep 29 '17 at 17:04