3

I'm trying to do some testing to add some features to the latex-mode (not AucTex) in Emacs. I would need an MWE that takes a relatively long time (more or less 5 seconds) for compilation, because I need to test whether some functions are actually triggered at the end of compilation (of the generation of the PDF or DVI file, I need the code to work with both the latex command and pdflatex). How can I modify the following MWE to achieve a compilation time around (more or less) 5 seconds?"

\documentclass[11pt]{article}
\begin{document}

Text

\end{document}
4
  • \usepackage{lipsum} and then add a sufficient number of \lipsums to increase the compilation. By the way, 5 seconds is not that long.
    – Werner
    Apr 11 at 16:14
  • 3
  • @UlrikeFischer Nice!
    – Gabriele
    Apr 11 at 16:28
  • 1
    Compile the any example from the prooftrees documentation.
    – cfr
    Apr 11 at 16:31

2 Answers 2

4

I thought there might be some package that defines commands like wait or sleep... but this is more than sufficient for my purpose (@Werner, thanks!):

\documentclass[11pt]{article}
\usepackage{lipsum}

\newcommand{\recursiveCall}[2]{%
    \ifnum#1>0
        #2% Calling the macro
        \recursiveCall{\numexpr#1-1}{#2}% Recursive call with the count decremented by 1
    \fi
}

\begin{document}
\recursiveCall{1000}{\lipsum}

\end{document}
3

Run the following with LuaLaTeX. Adjust the cycles to suit your requirements. This example is instructive, especially if you generating pdfs. You will discover also where bottlenecks are. The pdf generation and synctex at the end are bottlenecks. Ensure if you print page numbers you do not overflow TeX's register. If you search the site some months back I posted a Lua timer function. You can also use this to just run it for 5 seconds, without generating any pdf. But I think is more fun to actually print something. Add an everypar somewhere to test the l3 hook :).

\documentclass{article}
\begin{document}
\pagestyle{empty}
\directlua{
function wait(cycles)
for i=1,cycles do
  local x=i+1
  tex.print(1, x, " \\par")
end  
end
}
\directlua{wait(1000000)}
\newpage
\thispagestyle{plain}
test
\thepage
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .