I have a book (using the amsbook) package, where each chapter has exercises, and the final chapter contains the solutions. I am using the exercise package.
Some of the answers contain figures. I used the answer from the linked question below to avoid "Lost float" errors (briefly, I stopped using the figure environment and now use \captionof for the caption). Now the figures appear in the proper location in the solutions chapter, but the figure numbers still correspond to the original chapter. In other words, the figure in the solution for Exercise 2.1 is labeled Figure 2.1, even though it appears in chapter 22.
Is there a way to make the figure number correspond to the location of the solution?