As explained in this answer, for an Exercise, images can be put inside a center environment (not in a floating figure).
That works well in the exercise main body.
But inside a \Question, the image caption is not centered:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{caption}
\usepackage{exercise}
\begin{document}
\begin{Exercise}[title=MWE, label=ex:mwe]
In the main exercise text, the caption is correctly centered on the image.
\begin{center}
\captionsetup{type=figure}
\includegraphics[width=0.8\textwidth]{example-image} % example-image visible with mwe installed
\caption{Caption text, properly centered.}
\end{center}
\Question{
Why inside a ``Question'', the caption is not centered on the image ?
\begin{center}
\captionsetup{type=figure} % placed here for hyperref
\includegraphics[width=0.8\textwidth]{example-image}
\caption{Caption text, shifted.}
\end{center}
}
\end{Exercise}
\end{document}
The caption documentation is clear: for a single line, the caption should always be centered.
exercise is not listed in the "Supported packages" section, but that seems normal, since exercise does not deal with captions explicitly.
Is it an issue in caption or exercise, or something I should learn ?
What's going on ?
How to fix this properly ?
Advices welcome.


centerenvironment. – ederag May 15 '21 at 15:55