## LaTeX forum ⇒ Theses, Books, Title pages ⇒ How to create a list of exercises and their solutions at the end of each section of a book class?

Classicthesis, Bachelor and Master thesis, PhD, Doctoral degree
CMP
Posts: 6
Joined: Thu Aug 22, 2019 8:33 pm

### How to create a list of exercises and their solutions at the end of each section of a book class?

In the LaTeX book class, I am trying to create a list of exercises at the end of each section and then their solutions later at the end of the entire chapter. For example, what I want is the following:

1.1 This is the first section of this chapter.

Exercises
1.1 First problem.
1.2
1.3
1.4

1.2 This is the second section of this chapter

Exercises
1.5
1.6
1.7

Solutions to selected exercises
1.3
1.7

I also want the hyper-reference of the problems and their solutions, too.

And, I do not want to supply the command every time, like:

\begin{exercise}
How old are you?
\end{exercise}

The following is the MWE.

1. \documentclass[12pt, openany]{book}
2. \usepackage[T1]{fontenc}
3. \usepackage{color}
4.
5. \setlength{\parindent}{0in}
6. \setlength{\parskip}{10pt}
7.
8. \begin{document}
9.
10. \chapter{First}
11.
12. \section{First}
13.
14. This is the first section of this chapter.
15.
16. {\bf\em Exercises} \\
17. 1.1 Solve the problem. \\
18. 1.2 What is the sum of 3 and 8? \\
19. {\textcolor{red}{1.4}} What is your name?
20.
21. \section{Second}
22.
23. This is the second section of this chapter.
24.
25. {\bf\em Exercises} \\
26. 1.5 Solve the problem. \\
27. 1.6 What is the sum of 3 and 8? \\
28. {\textcolor{red}{1.7}} What is your name?
29.
30. \section{Third}
31.
32. \section{Four}
33.
34. {\bf\em Solutions to selected Exercises} \\
35. 1.3 I solved it! \\
36. 1.6 I don't know.
37.
38. \end{document}