Page numbering affected by recursive programming












2















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



documentclass{article}
usepackage{advdate}

% Set the first practice date
ThisDay{7}
ThisMonth{2}
ThisYear{2019}

%... the number of days between lectures
newcommand*{lecturegap}{7}

makeatletter
newcounter{holiday}
newcommand*addholiday[3]{%
stepcounter{holiday}%
@namedef{holidayarabic{holiday}}{%
defholidayDay{#1}%
defholidayMonth{#2}%
defholidayYear{#3}%
}%
}
makeatother
newcommand*{holidayDay}{0}
newcommand*{holidayMonth}{0}
newcommand*{holidayYear}{0}
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

newififholiday
newcommand*{groupA}{}
makeatletter
newcommand*{nextprac}{%
holidayfalse
count0=1 %
loop
ifnumcount0>value{holiday}else
@nameuse{holidaynumbercount0 }%
ifnum 0%
ifnumholidayDay=day1else0fi
ifnumholidayMonth=month1else0fi
ifnumholidayYear=year1else0fi
=111 %
holidaytrue
count0=value{holiday}%
else
fi
advancecount0 by 1 %
repeat
ifholiday
AdvanceDate[lecturegap]%
expandafternextprac
else
ifxgroupAempty
edefgroupA{%
{day=thedaymonth=themonthyear=theyearrelaxnoexpandtoday}}%
expandafterexpandafterexpandafternextprac
else
AdvanceDate[lecturegap]%
section*{groupAspace$parallel$ today}%
defgroupA{}%
AdvanceDate[lecturegap]%
fi
fi
}

begin{document}

nextprac
Practice one

nextprac
Practice two

nextprac
Practice three

nextprac
Practice four

nextprac
Practice five

nextprac
Practice six

nextprac
Practice seven

nextprac
Practice eight

nextprac
Practice nine

nextprac
Practice ten

end{document}


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?










share|improve this question


















  • 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


















2















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



documentclass{article}
usepackage{advdate}

% Set the first practice date
ThisDay{7}
ThisMonth{2}
ThisYear{2019}

%... the number of days between lectures
newcommand*{lecturegap}{7}

makeatletter
newcounter{holiday}
newcommand*addholiday[3]{%
stepcounter{holiday}%
@namedef{holidayarabic{holiday}}{%
defholidayDay{#1}%
defholidayMonth{#2}%
defholidayYear{#3}%
}%
}
makeatother
newcommand*{holidayDay}{0}
newcommand*{holidayMonth}{0}
newcommand*{holidayYear}{0}
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

newififholiday
newcommand*{groupA}{}
makeatletter
newcommand*{nextprac}{%
holidayfalse
count0=1 %
loop
ifnumcount0>value{holiday}else
@nameuse{holidaynumbercount0 }%
ifnum 0%
ifnumholidayDay=day1else0fi
ifnumholidayMonth=month1else0fi
ifnumholidayYear=year1else0fi
=111 %
holidaytrue
count0=value{holiday}%
else
fi
advancecount0 by 1 %
repeat
ifholiday
AdvanceDate[lecturegap]%
expandafternextprac
else
ifxgroupAempty
edefgroupA{%
{day=thedaymonth=themonthyear=theyearrelaxnoexpandtoday}}%
expandafterexpandafterexpandafternextprac
else
AdvanceDate[lecturegap]%
section*{groupAspace$parallel$ today}%
defgroupA{}%
AdvanceDate[lecturegap]%
fi
fi
}

begin{document}

nextprac
Practice one

nextprac
Practice two

nextprac
Practice three

nextprac
Practice four

nextprac
Practice five

nextprac
Practice six

nextprac
Practice seven

nextprac
Practice eight

nextprac
Practice nine

nextprac
Practice ten

end{document}


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?










share|improve this question


















  • 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
















2












2








2








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



documentclass{article}
usepackage{advdate}

% Set the first practice date
ThisDay{7}
ThisMonth{2}
ThisYear{2019}

%... the number of days between lectures
newcommand*{lecturegap}{7}

makeatletter
newcounter{holiday}
newcommand*addholiday[3]{%
stepcounter{holiday}%
@namedef{holidayarabic{holiday}}{%
defholidayDay{#1}%
defholidayMonth{#2}%
defholidayYear{#3}%
}%
}
makeatother
newcommand*{holidayDay}{0}
newcommand*{holidayMonth}{0}
newcommand*{holidayYear}{0}
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

newififholiday
newcommand*{groupA}{}
makeatletter
newcommand*{nextprac}{%
holidayfalse
count0=1 %
loop
ifnumcount0>value{holiday}else
@nameuse{holidaynumbercount0 }%
ifnum 0%
ifnumholidayDay=day1else0fi
ifnumholidayMonth=month1else0fi
ifnumholidayYear=year1else0fi
=111 %
holidaytrue
count0=value{holiday}%
else
fi
advancecount0 by 1 %
repeat
ifholiday
AdvanceDate[lecturegap]%
expandafternextprac
else
ifxgroupAempty
edefgroupA{%
{day=thedaymonth=themonthyear=theyearrelaxnoexpandtoday}}%
expandafterexpandafterexpandafternextprac
else
AdvanceDate[lecturegap]%
section*{groupAspace$parallel$ today}%
defgroupA{}%
AdvanceDate[lecturegap]%
fi
fi
}

begin{document}

nextprac
Practice one

nextprac
Practice two

nextprac
Practice three

nextprac
Practice four

nextprac
Practice five

nextprac
Practice six

nextprac
Practice seven

nextprac
Practice eight

nextprac
Practice nine

nextprac
Practice ten

end{document}


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?










share|improve this question














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



documentclass{article}
usepackage{advdate}

% Set the first practice date
ThisDay{7}
ThisMonth{2}
ThisYear{2019}

%... the number of days between lectures
newcommand*{lecturegap}{7}

makeatletter
newcounter{holiday}
newcommand*addholiday[3]{%
stepcounter{holiday}%
@namedef{holidayarabic{holiday}}{%
defholidayDay{#1}%
defholidayMonth{#2}%
defholidayYear{#3}%
}%
}
makeatother
newcommand*{holidayDay}{0}
newcommand*{holidayMonth}{0}
newcommand*{holidayYear}{0}
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

newififholiday
newcommand*{groupA}{}
makeatletter
newcommand*{nextprac}{%
holidayfalse
count0=1 %
loop
ifnumcount0>value{holiday}else
@nameuse{holidaynumbercount0 }%
ifnum 0%
ifnumholidayDay=day1else0fi
ifnumholidayMonth=month1else0fi
ifnumholidayYear=year1else0fi
=111 %
holidaytrue
count0=value{holiday}%
else
fi
advancecount0 by 1 %
repeat
ifholiday
AdvanceDate[lecturegap]%
expandafternextprac
else
ifxgroupAempty
edefgroupA{%
{day=thedaymonth=themonthyear=theyearrelaxnoexpandtoday}}%
expandafterexpandafterexpandafternextprac
else
AdvanceDate[lecturegap]%
section*{groupAspace$parallel$ today}%
defgroupA{}%
AdvanceDate[lecturegap]%
fi
fi
}

begin{document}

nextprac
Practice one

nextprac
Practice two

nextprac
Practice three

nextprac
Practice four

nextprac
Practice five

nextprac
Practice six

nextprac
Practice seven

nextprac
Practice eight

nextprac
Practice nine

nextprac
Practice ten

end{document}


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?







page-numbering date recursion advdate compare






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 25 at 13:12









BrasilBrasil

4242412




4242412








  • 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
















  • 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










1




1





count0 refers to the page number.

– egreg
Mar 25 at 13:26





count0 refers to the page number.

– egreg
Mar 25 at 13:26




1




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







@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












1 Answer
1






active

oldest

votes


















1














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



Change all occurrences of count0 into @tempcnta






share|improve this answer
























  • It works. Thank you!

    – Brasil
    Mar 25 at 14:19












Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f481346%2fpage-numbering-affected-by-recursive-programming%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














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



Change all occurrences of count0 into @tempcnta






share|improve this answer
























  • It works. Thank you!

    – Brasil
    Mar 25 at 14:19
















1














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



Change all occurrences of count0 into @tempcnta






share|improve this answer
























  • It works. Thank you!

    – Brasil
    Mar 25 at 14:19














1












1








1







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



Change all occurrences of count0 into @tempcnta






share|improve this answer













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



Change all occurrences of count0 into @tempcnta







share|improve this answer












share|improve this answer



share|improve this answer










answered Mar 25 at 13:32









egregegreg

731k8919303252




731k8919303252













  • It works. Thank you!

    – Brasil
    Mar 25 at 14:19



















  • It works. Thank you!

    – Brasil
    Mar 25 at 14:19

















It works. Thank you!

– Brasil
Mar 25 at 14:19





It works. Thank you!

– Brasil
Mar 25 at 14:19


















draft saved

draft discarded




















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f481346%2fpage-numbering-affected-by-recursive-programming%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to change which sound is reproduced for terminal bell?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

Can I use Tabulator js library in my java Spring + Thymeleaf project?