Tag Info

New answers tagged

5

You can use the package totcount: \documentclass{article} \usepackage{totcount} \newtotcounter{compilation} \AtBeginDocument{% \setcounter{compilation}{\value{compilation@totc}}% % when the aux file doesn't yet exist the value is -1 % so we fix it \ifnum\value{compilation}=-1 \setcounter{compilation}{0}\fi \stepcounter{compilation}% } ...


8

\documentclass{minimal} \makeatletter \AtBeginDocument{% \ifx\mynum\@undefined\def\mynum{0}\fi \edef\mynum{\the\numexpr\mynum + 1\relax}% \immediate\write\@auxout{\gdef\string\mynum{\mynum}}} \makeatother \begin{document} [\mynum] \end{document}



Top 50 recent answers are included