I asked this question How to do recursive program with latex and got the following excellent answer by @JosephWright


% Set the first practice date

%... the number of days between lectures

\addholiday{3}{3}{2019}  % ter Carnaval
\addholiday{18}{4}{2019} % qui Atividade complementar
\addholiday{19}{4}{2019} % sex Santa
\addholiday{21}{4}{2019} % dom Tiradentes/Páscoa
\addholiday{1}{5}{2019}  % qua Trabalhador
\addholiday{19}{6}{2019} % qua Aniv. Rib. Preto

  \count0=1 %
      \@nameuse{holiday\number\count0 }%
      \ifnum 0%
        =111 %
    \advance\count0 by 1 %
      \section*{\groupA\space$\parallel$ \today}%


  Practice one

  Practice two

  Practice three

  Practice four

  Practice five

  Practice six

  Practice seven

  Practice eight

  Practice nine

  Practice ten


However, a few months latter, I realized that this code affects page numbering. But I cannot figure out how it is affected nor how to fix it.

The only thing I realized is that the page number becomes the exact number of holidays created by \addholiday command.

My question is: how to restore page numbering without leaving the presented code away?

  • 1
    \count0 refers to the page number. – egreg Mar 25 at 13:26
  • 1
    @JosephWright should stick to expl3 then he wouldn't using \count0 as loop variable ;-) (he probably wanted to use \count@) – Ulrike Fischer Mar 25 at 13:27

You're using \count0 in the wild, which contains the page number.

Change all occurrences of \count0 into \@tempcnta

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.