How to customize the exercise package?












2














documentclass[a4paper,11pt]{book}
usepackage{hyperref}
usepackage[lastexercise,answerdelayed,exercisedelayed]{exercise}
renewcommand{AnswerName}{Exercise}


begin{document}
{


tableofcontents
mainmatter

chapter{Classical physics}
section*{The good old days}
For every $epsilon>0$
begin{Exercise}[label={afaff}, name={Exercice}, difficulty={1}]
sfsf
end{Exercise}
begin{Answer}
aggsg f
end{Answer}


chapter{Modern physics}
section*{Departure from classical physics}
There exists a $delta>0$
begin{Exercise}[label={dghd}, name={Exercice}, difficulty={2}]
b7dyfas789
end{Exercise}
begin{Answer}
hjsdgfkihsk
end{Answer}


chapter{Neoclassical physics}
section{Guess who's back}
begin{Exercise}[label={NQCD}, name={Exercice}, difficulty={3}]
skjhfkshf
end{Exercise}
begin{Answer}
b78asghfkighkia
end{Answer}


part{Exercises}
shipoutExercise

part{Solutions}
shipoutAnswer


end{document}


In the last two parts, the exercises are shown without any reference to the chapters. How can I make them like this:




Chaptername



its exercises



chaptername



its exercises



etc











share|improve this question




















  • 1




    Welcome to TeX.SX. Another package you could try out is xsim.
    – Johannes_B
    Dec 22 '18 at 12:51










  • @Johannes_B It seems good I never used it but I already wrote hundreds of exercises using the exercise package.
    – Trump
    Dec 22 '18 at 12:56






  • 1




    Do you mean "customize"? I hope you mean "costumize".
    – Benjamin McKay
    Dec 22 '18 at 13:41










  • You can use this answer to get the number of exercises.
    – BPP
    Dec 25 '18 at 12:41






  • 1




    @BPP Thanks. It worked.
    – Trump
    Dec 27 '18 at 16:16
















2














documentclass[a4paper,11pt]{book}
usepackage{hyperref}
usepackage[lastexercise,answerdelayed,exercisedelayed]{exercise}
renewcommand{AnswerName}{Exercise}


begin{document}
{


tableofcontents
mainmatter

chapter{Classical physics}
section*{The good old days}
For every $epsilon>0$
begin{Exercise}[label={afaff}, name={Exercice}, difficulty={1}]
sfsf
end{Exercise}
begin{Answer}
aggsg f
end{Answer}


chapter{Modern physics}
section*{Departure from classical physics}
There exists a $delta>0$
begin{Exercise}[label={dghd}, name={Exercice}, difficulty={2}]
b7dyfas789
end{Exercise}
begin{Answer}
hjsdgfkihsk
end{Answer}


chapter{Neoclassical physics}
section{Guess who's back}
begin{Exercise}[label={NQCD}, name={Exercice}, difficulty={3}]
skjhfkshf
end{Exercise}
begin{Answer}
b78asghfkighkia
end{Answer}


part{Exercises}
shipoutExercise

part{Solutions}
shipoutAnswer


end{document}


In the last two parts, the exercises are shown without any reference to the chapters. How can I make them like this:




Chaptername



its exercises



chaptername



its exercises



etc











share|improve this question




















  • 1




    Welcome to TeX.SX. Another package you could try out is xsim.
    – Johannes_B
    Dec 22 '18 at 12:51










  • @Johannes_B It seems good I never used it but I already wrote hundreds of exercises using the exercise package.
    – Trump
    Dec 22 '18 at 12:56






  • 1




    Do you mean "customize"? I hope you mean "costumize".
    – Benjamin McKay
    Dec 22 '18 at 13:41










  • You can use this answer to get the number of exercises.
    – BPP
    Dec 25 '18 at 12:41






  • 1




    @BPP Thanks. It worked.
    – Trump
    Dec 27 '18 at 16:16














2












2








2


0





documentclass[a4paper,11pt]{book}
usepackage{hyperref}
usepackage[lastexercise,answerdelayed,exercisedelayed]{exercise}
renewcommand{AnswerName}{Exercise}


begin{document}
{


tableofcontents
mainmatter

chapter{Classical physics}
section*{The good old days}
For every $epsilon>0$
begin{Exercise}[label={afaff}, name={Exercice}, difficulty={1}]
sfsf
end{Exercise}
begin{Answer}
aggsg f
end{Answer}


chapter{Modern physics}
section*{Departure from classical physics}
There exists a $delta>0$
begin{Exercise}[label={dghd}, name={Exercice}, difficulty={2}]
b7dyfas789
end{Exercise}
begin{Answer}
hjsdgfkihsk
end{Answer}


chapter{Neoclassical physics}
section{Guess who's back}
begin{Exercise}[label={NQCD}, name={Exercice}, difficulty={3}]
skjhfkshf
end{Exercise}
begin{Answer}
b78asghfkighkia
end{Answer}


part{Exercises}
shipoutExercise

part{Solutions}
shipoutAnswer


end{document}


In the last two parts, the exercises are shown without any reference to the chapters. How can I make them like this:




Chaptername



its exercises



chaptername



its exercises



etc











share|improve this question















documentclass[a4paper,11pt]{book}
usepackage{hyperref}
usepackage[lastexercise,answerdelayed,exercisedelayed]{exercise}
renewcommand{AnswerName}{Exercise}


begin{document}
{


tableofcontents
mainmatter

chapter{Classical physics}
section*{The good old days}
For every $epsilon>0$
begin{Exercise}[label={afaff}, name={Exercice}, difficulty={1}]
sfsf
end{Exercise}
begin{Answer}
aggsg f
end{Answer}


chapter{Modern physics}
section*{Departure from classical physics}
There exists a $delta>0$
begin{Exercise}[label={dghd}, name={Exercice}, difficulty={2}]
b7dyfas789
end{Exercise}
begin{Answer}
hjsdgfkihsk
end{Answer}


chapter{Neoclassical physics}
section{Guess who's back}
begin{Exercise}[label={NQCD}, name={Exercice}, difficulty={3}]
skjhfkshf
end{Exercise}
begin{Answer}
b78asghfkighkia
end{Answer}


part{Exercises}
shipoutExercise

part{Solutions}
shipoutAnswer


end{document}


In the last two parts, the exercises are shown without any reference to the chapters. How can I make them like this:




Chaptername



its exercises



chaptername



its exercises



etc








exercises






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 29 '18 at 15:22

























asked Dec 22 '18 at 12:27









Trump

133




133








  • 1




    Welcome to TeX.SX. Another package you could try out is xsim.
    – Johannes_B
    Dec 22 '18 at 12:51










  • @Johannes_B It seems good I never used it but I already wrote hundreds of exercises using the exercise package.
    – Trump
    Dec 22 '18 at 12:56






  • 1




    Do you mean "customize"? I hope you mean "costumize".
    – Benjamin McKay
    Dec 22 '18 at 13:41










  • You can use this answer to get the number of exercises.
    – BPP
    Dec 25 '18 at 12:41






  • 1




    @BPP Thanks. It worked.
    – Trump
    Dec 27 '18 at 16:16














  • 1




    Welcome to TeX.SX. Another package you could try out is xsim.
    – Johannes_B
    Dec 22 '18 at 12:51










  • @Johannes_B It seems good I never used it but I already wrote hundreds of exercises using the exercise package.
    – Trump
    Dec 22 '18 at 12:56






  • 1




    Do you mean "customize"? I hope you mean "costumize".
    – Benjamin McKay
    Dec 22 '18 at 13:41










  • You can use this answer to get the number of exercises.
    – BPP
    Dec 25 '18 at 12:41






  • 1




    @BPP Thanks. It worked.
    – Trump
    Dec 27 '18 at 16:16








1




1




Welcome to TeX.SX. Another package you could try out is xsim.
– Johannes_B
Dec 22 '18 at 12:51




Welcome to TeX.SX. Another package you could try out is xsim.
– Johannes_B
Dec 22 '18 at 12:51












@Johannes_B It seems good I never used it but I already wrote hundreds of exercises using the exercise package.
– Trump
Dec 22 '18 at 12:56




@Johannes_B It seems good I never used it but I already wrote hundreds of exercises using the exercise package.
– Trump
Dec 22 '18 at 12:56




1




1




Do you mean "customize"? I hope you mean "costumize".
– Benjamin McKay
Dec 22 '18 at 13:41




Do you mean "customize"? I hope you mean "costumize".
– Benjamin McKay
Dec 22 '18 at 13:41












You can use this answer to get the number of exercises.
– BPP
Dec 25 '18 at 12:41




You can use this answer to get the number of exercises.
– BPP
Dec 25 '18 at 12:41




1




1




@BPP Thanks. It worked.
– Trump
Dec 27 '18 at 16:16




@BPP Thanks. It worked.
– Trump
Dec 27 '18 at 16:16










1 Answer
1






active

oldest

votes


















0














Maybe you would like to number to exercises within chapters.



I've used xassoccnt to print the total number of exercises.



I've modified ExerciseHeader and AnswerHeader to print the Chapter number and name before its exercises when you ship out them.



documentclass[a4paper,11pt]{book}
usepackage[lastexercise,answerdelayed,exercisedelayed]{exercise}
renewcommand{ExerciseName}{Exercice}
renewcommand{AnswerName}{Exercice}
usepackage{totcount}
regtotcounter{Exercise} % register the counter for getting the total
usepackage{chngcntr}
counterwithin{Exercise}{chapter}
counterwithin{Answer}{chapter}
usepackage{xassoccnt}
NewTotalDocumentCounter{totalex}
usepackage{titleref}
usepackage{etoolbox}
renewcommand{ExerciseHeader}{ stepcounter{totalex}ifnumcomp{value{Exercise}}{=}{1}{ifnumcomp{thechapter}{=}{1}{}{vspace{10pt}}noindentLargetextbf{Chapter thechapter currenttitle}parvspace{10pt}}{}noindentnormalsizebfseriesExerciseName ExerciseHeaderNB ExerciseHeaderDifficultyparmedskip}
renewcommand{AnswerHeader}{ifnumcomp{value{Exercise}}{=}{1}{ifnumcomp{thechapter}{=}{1}{}{vspace{10pt}}noindentLargetextbf{Chapter thechapter currenttitle}parvspace{10pt}}{}noindentnormalsizebfseriesAnswerName ExerciseHeaderNB ExerciseHeaderDifficultyparmedskip}

usepackage{hyperref}

begin{document}
This document contains TotalValue{totalex} solved exercises.

tableofcontents
mainmatter

chapter{Classical physics}
makeatletter

makeatother
section*{The good old days}
For every $epsilon>0$
begin{Exercise}[label={afaff}, difficulty={1}]
sfsf
end{Exercise}
begin{Answer}
aggsg f
end{Answer}
begin{Exercise}[difficulty={2}]
another exercise
end{Exercise}
begin{Answer}
another answer
end{Answer}
begin{Exercise}[difficulty={1}]
one more exercise
end{Exercise}
begin{Answer}
one more answer
end{Answer}
chapter{Modern physics}
section*{Departure from classical physics}
There exists a $delta>0$
begin{Exercise}[label={dghd}, difficulty={2}]
b7dyfas789
end{Exercise}
begin{Answer}
hjsdgfkihsk
end{Answer}

chapter{Neoclassical physics}
section{Guess who's back}
begin{Exercise}[label={NQCD}, difficulty={3}]
skjhfkshf
end{Exercise}
begin{Answer}
b78asghfkighkia
end{Answer}

part{Exercises}
shipoutExercise

part{Solutions}
shipoutAnswer

end{document}


enter image description here



enter image description here






share|improve this answer





















  • Thank you. Just one more thing. The exercises are numbered continuously without the chap number. So in this example chap 3 begins with exercise 5.
    – Trump
    Dec 30 '18 at 19:08










  • @Trump Have you copied in your doc also these lines usepackage{chngcntr} counterwithin{Exercise}{chapter} counterwithin{Answer}{chapter}?
    – CarLaTeX
    Dec 30 '18 at 19:13










  • If I add them the exercises are numbered with chapter number. If I remove them the exercises are numbered continuously but only the name of the first chapter appears in the exercises part.
    – Trump
    Jan 1 at 17:45










  • @Trump Have you got this line renewcommand{ExerciseHeader}{ stepcounter{totalex}ifnumcomp{value{Exercise}}{=}{1}{ifnumcomp{thechapter}{=}{1}{}{vspace{10pt}}noindentLargetextbf{Chapter thechapter currenttitle}parvspace{10pt}}{}noindentnormalsizebfseriesExerciseName ExerciseHeaderNB ExerciseHeaderDifficultyparmedskip} in your actual document?
    – CarLaTeX
    Jan 1 at 17:48










  • Yes I get this.
    – Trump
    Jan 1 at 17:50











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%2f466972%2fhow-to-customize-the-exercise-package%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









0














Maybe you would like to number to exercises within chapters.



I've used xassoccnt to print the total number of exercises.



I've modified ExerciseHeader and AnswerHeader to print the Chapter number and name before its exercises when you ship out them.



documentclass[a4paper,11pt]{book}
usepackage[lastexercise,answerdelayed,exercisedelayed]{exercise}
renewcommand{ExerciseName}{Exercice}
renewcommand{AnswerName}{Exercice}
usepackage{totcount}
regtotcounter{Exercise} % register the counter for getting the total
usepackage{chngcntr}
counterwithin{Exercise}{chapter}
counterwithin{Answer}{chapter}
usepackage{xassoccnt}
NewTotalDocumentCounter{totalex}
usepackage{titleref}
usepackage{etoolbox}
renewcommand{ExerciseHeader}{ stepcounter{totalex}ifnumcomp{value{Exercise}}{=}{1}{ifnumcomp{thechapter}{=}{1}{}{vspace{10pt}}noindentLargetextbf{Chapter thechapter currenttitle}parvspace{10pt}}{}noindentnormalsizebfseriesExerciseName ExerciseHeaderNB ExerciseHeaderDifficultyparmedskip}
renewcommand{AnswerHeader}{ifnumcomp{value{Exercise}}{=}{1}{ifnumcomp{thechapter}{=}{1}{}{vspace{10pt}}noindentLargetextbf{Chapter thechapter currenttitle}parvspace{10pt}}{}noindentnormalsizebfseriesAnswerName ExerciseHeaderNB ExerciseHeaderDifficultyparmedskip}

usepackage{hyperref}

begin{document}
This document contains TotalValue{totalex} solved exercises.

tableofcontents
mainmatter

chapter{Classical physics}
makeatletter

makeatother
section*{The good old days}
For every $epsilon>0$
begin{Exercise}[label={afaff}, difficulty={1}]
sfsf
end{Exercise}
begin{Answer}
aggsg f
end{Answer}
begin{Exercise}[difficulty={2}]
another exercise
end{Exercise}
begin{Answer}
another answer
end{Answer}
begin{Exercise}[difficulty={1}]
one more exercise
end{Exercise}
begin{Answer}
one more answer
end{Answer}
chapter{Modern physics}
section*{Departure from classical physics}
There exists a $delta>0$
begin{Exercise}[label={dghd}, difficulty={2}]
b7dyfas789
end{Exercise}
begin{Answer}
hjsdgfkihsk
end{Answer}

chapter{Neoclassical physics}
section{Guess who's back}
begin{Exercise}[label={NQCD}, difficulty={3}]
skjhfkshf
end{Exercise}
begin{Answer}
b78asghfkighkia
end{Answer}

part{Exercises}
shipoutExercise

part{Solutions}
shipoutAnswer

end{document}


enter image description here



enter image description here






share|improve this answer





















  • Thank you. Just one more thing. The exercises are numbered continuously without the chap number. So in this example chap 3 begins with exercise 5.
    – Trump
    Dec 30 '18 at 19:08










  • @Trump Have you copied in your doc also these lines usepackage{chngcntr} counterwithin{Exercise}{chapter} counterwithin{Answer}{chapter}?
    – CarLaTeX
    Dec 30 '18 at 19:13










  • If I add them the exercises are numbered with chapter number. If I remove them the exercises are numbered continuously but only the name of the first chapter appears in the exercises part.
    – Trump
    Jan 1 at 17:45










  • @Trump Have you got this line renewcommand{ExerciseHeader}{ stepcounter{totalex}ifnumcomp{value{Exercise}}{=}{1}{ifnumcomp{thechapter}{=}{1}{}{vspace{10pt}}noindentLargetextbf{Chapter thechapter currenttitle}parvspace{10pt}}{}noindentnormalsizebfseriesExerciseName ExerciseHeaderNB ExerciseHeaderDifficultyparmedskip} in your actual document?
    – CarLaTeX
    Jan 1 at 17:48










  • Yes I get this.
    – Trump
    Jan 1 at 17:50
















0














Maybe you would like to number to exercises within chapters.



I've used xassoccnt to print the total number of exercises.



I've modified ExerciseHeader and AnswerHeader to print the Chapter number and name before its exercises when you ship out them.



documentclass[a4paper,11pt]{book}
usepackage[lastexercise,answerdelayed,exercisedelayed]{exercise}
renewcommand{ExerciseName}{Exercice}
renewcommand{AnswerName}{Exercice}
usepackage{totcount}
regtotcounter{Exercise} % register the counter for getting the total
usepackage{chngcntr}
counterwithin{Exercise}{chapter}
counterwithin{Answer}{chapter}
usepackage{xassoccnt}
NewTotalDocumentCounter{totalex}
usepackage{titleref}
usepackage{etoolbox}
renewcommand{ExerciseHeader}{ stepcounter{totalex}ifnumcomp{value{Exercise}}{=}{1}{ifnumcomp{thechapter}{=}{1}{}{vspace{10pt}}noindentLargetextbf{Chapter thechapter currenttitle}parvspace{10pt}}{}noindentnormalsizebfseriesExerciseName ExerciseHeaderNB ExerciseHeaderDifficultyparmedskip}
renewcommand{AnswerHeader}{ifnumcomp{value{Exercise}}{=}{1}{ifnumcomp{thechapter}{=}{1}{}{vspace{10pt}}noindentLargetextbf{Chapter thechapter currenttitle}parvspace{10pt}}{}noindentnormalsizebfseriesAnswerName ExerciseHeaderNB ExerciseHeaderDifficultyparmedskip}

usepackage{hyperref}

begin{document}
This document contains TotalValue{totalex} solved exercises.

tableofcontents
mainmatter

chapter{Classical physics}
makeatletter

makeatother
section*{The good old days}
For every $epsilon>0$
begin{Exercise}[label={afaff}, difficulty={1}]
sfsf
end{Exercise}
begin{Answer}
aggsg f
end{Answer}
begin{Exercise}[difficulty={2}]
another exercise
end{Exercise}
begin{Answer}
another answer
end{Answer}
begin{Exercise}[difficulty={1}]
one more exercise
end{Exercise}
begin{Answer}
one more answer
end{Answer}
chapter{Modern physics}
section*{Departure from classical physics}
There exists a $delta>0$
begin{Exercise}[label={dghd}, difficulty={2}]
b7dyfas789
end{Exercise}
begin{Answer}
hjsdgfkihsk
end{Answer}

chapter{Neoclassical physics}
section{Guess who's back}
begin{Exercise}[label={NQCD}, difficulty={3}]
skjhfkshf
end{Exercise}
begin{Answer}
b78asghfkighkia
end{Answer}

part{Exercises}
shipoutExercise

part{Solutions}
shipoutAnswer

end{document}


enter image description here



enter image description here






share|improve this answer





















  • Thank you. Just one more thing. The exercises are numbered continuously without the chap number. So in this example chap 3 begins with exercise 5.
    – Trump
    Dec 30 '18 at 19:08










  • @Trump Have you copied in your doc also these lines usepackage{chngcntr} counterwithin{Exercise}{chapter} counterwithin{Answer}{chapter}?
    – CarLaTeX
    Dec 30 '18 at 19:13










  • If I add them the exercises are numbered with chapter number. If I remove them the exercises are numbered continuously but only the name of the first chapter appears in the exercises part.
    – Trump
    Jan 1 at 17:45










  • @Trump Have you got this line renewcommand{ExerciseHeader}{ stepcounter{totalex}ifnumcomp{value{Exercise}}{=}{1}{ifnumcomp{thechapter}{=}{1}{}{vspace{10pt}}noindentLargetextbf{Chapter thechapter currenttitle}parvspace{10pt}}{}noindentnormalsizebfseriesExerciseName ExerciseHeaderNB ExerciseHeaderDifficultyparmedskip} in your actual document?
    – CarLaTeX
    Jan 1 at 17:48










  • Yes I get this.
    – Trump
    Jan 1 at 17:50














0












0








0






Maybe you would like to number to exercises within chapters.



I've used xassoccnt to print the total number of exercises.



I've modified ExerciseHeader and AnswerHeader to print the Chapter number and name before its exercises when you ship out them.



documentclass[a4paper,11pt]{book}
usepackage[lastexercise,answerdelayed,exercisedelayed]{exercise}
renewcommand{ExerciseName}{Exercice}
renewcommand{AnswerName}{Exercice}
usepackage{totcount}
regtotcounter{Exercise} % register the counter for getting the total
usepackage{chngcntr}
counterwithin{Exercise}{chapter}
counterwithin{Answer}{chapter}
usepackage{xassoccnt}
NewTotalDocumentCounter{totalex}
usepackage{titleref}
usepackage{etoolbox}
renewcommand{ExerciseHeader}{ stepcounter{totalex}ifnumcomp{value{Exercise}}{=}{1}{ifnumcomp{thechapter}{=}{1}{}{vspace{10pt}}noindentLargetextbf{Chapter thechapter currenttitle}parvspace{10pt}}{}noindentnormalsizebfseriesExerciseName ExerciseHeaderNB ExerciseHeaderDifficultyparmedskip}
renewcommand{AnswerHeader}{ifnumcomp{value{Exercise}}{=}{1}{ifnumcomp{thechapter}{=}{1}{}{vspace{10pt}}noindentLargetextbf{Chapter thechapter currenttitle}parvspace{10pt}}{}noindentnormalsizebfseriesAnswerName ExerciseHeaderNB ExerciseHeaderDifficultyparmedskip}

usepackage{hyperref}

begin{document}
This document contains TotalValue{totalex} solved exercises.

tableofcontents
mainmatter

chapter{Classical physics}
makeatletter

makeatother
section*{The good old days}
For every $epsilon>0$
begin{Exercise}[label={afaff}, difficulty={1}]
sfsf
end{Exercise}
begin{Answer}
aggsg f
end{Answer}
begin{Exercise}[difficulty={2}]
another exercise
end{Exercise}
begin{Answer}
another answer
end{Answer}
begin{Exercise}[difficulty={1}]
one more exercise
end{Exercise}
begin{Answer}
one more answer
end{Answer}
chapter{Modern physics}
section*{Departure from classical physics}
There exists a $delta>0$
begin{Exercise}[label={dghd}, difficulty={2}]
b7dyfas789
end{Exercise}
begin{Answer}
hjsdgfkihsk
end{Answer}

chapter{Neoclassical physics}
section{Guess who's back}
begin{Exercise}[label={NQCD}, difficulty={3}]
skjhfkshf
end{Exercise}
begin{Answer}
b78asghfkighkia
end{Answer}

part{Exercises}
shipoutExercise

part{Solutions}
shipoutAnswer

end{document}


enter image description here



enter image description here






share|improve this answer












Maybe you would like to number to exercises within chapters.



I've used xassoccnt to print the total number of exercises.



I've modified ExerciseHeader and AnswerHeader to print the Chapter number and name before its exercises when you ship out them.



documentclass[a4paper,11pt]{book}
usepackage[lastexercise,answerdelayed,exercisedelayed]{exercise}
renewcommand{ExerciseName}{Exercice}
renewcommand{AnswerName}{Exercice}
usepackage{totcount}
regtotcounter{Exercise} % register the counter for getting the total
usepackage{chngcntr}
counterwithin{Exercise}{chapter}
counterwithin{Answer}{chapter}
usepackage{xassoccnt}
NewTotalDocumentCounter{totalex}
usepackage{titleref}
usepackage{etoolbox}
renewcommand{ExerciseHeader}{ stepcounter{totalex}ifnumcomp{value{Exercise}}{=}{1}{ifnumcomp{thechapter}{=}{1}{}{vspace{10pt}}noindentLargetextbf{Chapter thechapter currenttitle}parvspace{10pt}}{}noindentnormalsizebfseriesExerciseName ExerciseHeaderNB ExerciseHeaderDifficultyparmedskip}
renewcommand{AnswerHeader}{ifnumcomp{value{Exercise}}{=}{1}{ifnumcomp{thechapter}{=}{1}{}{vspace{10pt}}noindentLargetextbf{Chapter thechapter currenttitle}parvspace{10pt}}{}noindentnormalsizebfseriesAnswerName ExerciseHeaderNB ExerciseHeaderDifficultyparmedskip}

usepackage{hyperref}

begin{document}
This document contains TotalValue{totalex} solved exercises.

tableofcontents
mainmatter

chapter{Classical physics}
makeatletter

makeatother
section*{The good old days}
For every $epsilon>0$
begin{Exercise}[label={afaff}, difficulty={1}]
sfsf
end{Exercise}
begin{Answer}
aggsg f
end{Answer}
begin{Exercise}[difficulty={2}]
another exercise
end{Exercise}
begin{Answer}
another answer
end{Answer}
begin{Exercise}[difficulty={1}]
one more exercise
end{Exercise}
begin{Answer}
one more answer
end{Answer}
chapter{Modern physics}
section*{Departure from classical physics}
There exists a $delta>0$
begin{Exercise}[label={dghd}, difficulty={2}]
b7dyfas789
end{Exercise}
begin{Answer}
hjsdgfkihsk
end{Answer}

chapter{Neoclassical physics}
section{Guess who's back}
begin{Exercise}[label={NQCD}, difficulty={3}]
skjhfkshf
end{Exercise}
begin{Answer}
b78asghfkighkia
end{Answer}

part{Exercises}
shipoutExercise

part{Solutions}
shipoutAnswer

end{document}


enter image description here



enter image description here







share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 30 '18 at 18:28









CarLaTeX

30k447127




30k447127












  • Thank you. Just one more thing. The exercises are numbered continuously without the chap number. So in this example chap 3 begins with exercise 5.
    – Trump
    Dec 30 '18 at 19:08










  • @Trump Have you copied in your doc also these lines usepackage{chngcntr} counterwithin{Exercise}{chapter} counterwithin{Answer}{chapter}?
    – CarLaTeX
    Dec 30 '18 at 19:13










  • If I add them the exercises are numbered with chapter number. If I remove them the exercises are numbered continuously but only the name of the first chapter appears in the exercises part.
    – Trump
    Jan 1 at 17:45










  • @Trump Have you got this line renewcommand{ExerciseHeader}{ stepcounter{totalex}ifnumcomp{value{Exercise}}{=}{1}{ifnumcomp{thechapter}{=}{1}{}{vspace{10pt}}noindentLargetextbf{Chapter thechapter currenttitle}parvspace{10pt}}{}noindentnormalsizebfseriesExerciseName ExerciseHeaderNB ExerciseHeaderDifficultyparmedskip} in your actual document?
    – CarLaTeX
    Jan 1 at 17:48










  • Yes I get this.
    – Trump
    Jan 1 at 17:50


















  • Thank you. Just one more thing. The exercises are numbered continuously without the chap number. So in this example chap 3 begins with exercise 5.
    – Trump
    Dec 30 '18 at 19:08










  • @Trump Have you copied in your doc also these lines usepackage{chngcntr} counterwithin{Exercise}{chapter} counterwithin{Answer}{chapter}?
    – CarLaTeX
    Dec 30 '18 at 19:13










  • If I add them the exercises are numbered with chapter number. If I remove them the exercises are numbered continuously but only the name of the first chapter appears in the exercises part.
    – Trump
    Jan 1 at 17:45










  • @Trump Have you got this line renewcommand{ExerciseHeader}{ stepcounter{totalex}ifnumcomp{value{Exercise}}{=}{1}{ifnumcomp{thechapter}{=}{1}{}{vspace{10pt}}noindentLargetextbf{Chapter thechapter currenttitle}parvspace{10pt}}{}noindentnormalsizebfseriesExerciseName ExerciseHeaderNB ExerciseHeaderDifficultyparmedskip} in your actual document?
    – CarLaTeX
    Jan 1 at 17:48










  • Yes I get this.
    – Trump
    Jan 1 at 17:50
















Thank you. Just one more thing. The exercises are numbered continuously without the chap number. So in this example chap 3 begins with exercise 5.
– Trump
Dec 30 '18 at 19:08




Thank you. Just one more thing. The exercises are numbered continuously without the chap number. So in this example chap 3 begins with exercise 5.
– Trump
Dec 30 '18 at 19:08












@Trump Have you copied in your doc also these lines usepackage{chngcntr} counterwithin{Exercise}{chapter} counterwithin{Answer}{chapter}?
– CarLaTeX
Dec 30 '18 at 19:13




@Trump Have you copied in your doc also these lines usepackage{chngcntr} counterwithin{Exercise}{chapter} counterwithin{Answer}{chapter}?
– CarLaTeX
Dec 30 '18 at 19:13












If I add them the exercises are numbered with chapter number. If I remove them the exercises are numbered continuously but only the name of the first chapter appears in the exercises part.
– Trump
Jan 1 at 17:45




If I add them the exercises are numbered with chapter number. If I remove them the exercises are numbered continuously but only the name of the first chapter appears in the exercises part.
– Trump
Jan 1 at 17:45












@Trump Have you got this line renewcommand{ExerciseHeader}{ stepcounter{totalex}ifnumcomp{value{Exercise}}{=}{1}{ifnumcomp{thechapter}{=}{1}{}{vspace{10pt}}noindentLargetextbf{Chapter thechapter currenttitle}parvspace{10pt}}{}noindentnormalsizebfseriesExerciseName ExerciseHeaderNB ExerciseHeaderDifficultyparmedskip} in your actual document?
– CarLaTeX
Jan 1 at 17:48




@Trump Have you got this line renewcommand{ExerciseHeader}{ stepcounter{totalex}ifnumcomp{value{Exercise}}{=}{1}{ifnumcomp{thechapter}{=}{1}{}{vspace{10pt}}noindentLargetextbf{Chapter thechapter currenttitle}parvspace{10pt}}{}noindentnormalsizebfseriesExerciseName ExerciseHeaderNB ExerciseHeaderDifficultyparmedskip} in your actual document?
– CarLaTeX
Jan 1 at 17:48












Yes I get this.
– Trump
Jan 1 at 17:50




Yes I get this.
– Trump
Jan 1 at 17:50


















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.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • 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%2f466972%2fhow-to-customize-the-exercise-package%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?