Strange distancing when starting with a bulleted enviroment.
I noticed that the spacing is of if I start a (centered) exercise with an itemize or enumerate enviroment.
Minimal working example:
\documentclass[%
a4paper,
]{memoir}
\usepackage{cmbright}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[clear-aux]{xsim}
\xsimsetup{
load-style=layouts,
exercise/template=centered,
solution/print = false,
exercise/name = Aufgabe,
blank/filled-style=\textcolor{Red}{#1},
blank/line-minimum-length = 1cm,
blank/scale = 1.5,
}
\begin{document}
\begin{exercise}
Normal distance between header and text!
\end{exercise}
\begin{exercise}
\begin{enumerate}
\item Greater distance between header and text!
\end{enumerate}
\end{exercise}
\end{document}
produces
With the default setting exercise/template=default, exercise title is typeset by \subsection*{<title>}, which takes care of vertical spacing between following list (like enumerate) automatically, through \@afterheading.
With exercise/template=centered, the same exercise title is now typeset manually, by \hfil\textbf{<title>}...\hfil\par\noindent. This time the vertical space \topsep inserted by a list environment (between it and the previous text) is not ignored automatically any more.
Implementations of exercise templates default and centered
https://github.com/cgnieder/xsim/blob/06e3dba43b96ed493968ddd54add9fc8a1d9a264/code/xsim.sty#L5509-L5533 https://github.com/cgnieder/xsim/blob/06e3dba43b96ed493968ddd54add9fc8a1d9a264/code/xsim.style.layouts.code.tex#L95-L115
Adding back \@afterheading (manually or by patching the centered template) solves the problem, partially. Note with exercise/template=centered, if exercise property points is given for an exercise starting with a list environment, the value of points will be typeset in its own paragraph, as a marginal note. You may need to manually adjust the vertical spacing.
\documentclass{article}
\usepackage{lipsum}
% to show distances between baseline heights
\usepackage{lineno}
\renewcommand{\thelinenumber}{\arabic{linenumber}\rlap{\rule{.4pt}{11pt}}}
\linenumbers
%\usepackage{cmbright}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[clear-aux]{xsim}
\xsimsetup{
load-style=layouts,
exercise/template=centered,
}
\makeatletter
% cheat `xsim` as if `centered` template is undefined
\ExpandArgs{cc}\relax {cs_undefine:N} {l__xsim_template_begin_centered_setup_tl}
\ExpandArgs{cc}\relax {cs_undefine:N} {l__xsim_template_end_centered_setup_tl}
\DeclareExerciseEnvironmentTemplate{centered}
{%
\par\vspace{\baselineskip}
\Needspace*{2\baselineskip}
\noindent
\hfil\textbf{\XSIMmixedcase{\GetExerciseName}~\GetExerciseProperty{counter}}%
\GetExercisePropertyT{subtitle}{ \textit{#1}}\hfil
\par\noindent\@afterheading % <<< changed
\IfInsideSolutionF{%
\GetExercisePropertyT{points}{%
\marginpar{%
\printgoal{\PropertyValue}%
\GetExercisePropertyT{bonus-points}{+\printgoal{\PropertyValue}}%
\,\IfExerciseGoalSingularTF{points}
{\XSIMtranslate{point}}
{\XSIMtranslate{points}}%
}%
}%
}%
}
{}
\makeatother
\begin{document}
\begin{exercise}[subtitle={no points + plain text}]
Normal distance between header and text!
\end{exercise}
\begin{exercise}[subtitle={no points + list}]
\begin{enumerate}
\item Greater distance between header and text!
\end{enumerate}
\end{exercise}
\begin{exercise}[points=2, subtitle={points + plain text}]
Normal distance between header and text!
\end{exercise}
\begin{exercise}[points=3, subtitle={points + list}]
\begin{enumerate}
\item Greater distance between header and text!
\end{enumerate}
\end{exercise}
\begin{exercise}[points=4, subtitle={points + list + manual adjustment}]
\vspace{-\baselineskip}
\begin{enumerate}
\item Greater distance between header and text!
\end{enumerate}
\end{exercise}
\section*{Emulation}
\subsection*{EnvironmentTemplate=default}
\lipsum[2][1]
\subsection*{EnvironmentTemplate=default}
\begin{enumerate}
\item \lipsum[2][1]
\end{enumerate}
\hfil\textbf{EnvironmentTemplate=centered}\hfil \par
\lipsum[2][1]
\hfil\textbf{EnvironmentTemplate=centered}\hfil \par
\begin{enumerate}
\item \lipsum[2][1]
\end{enumerate}
\hfil\textbf{EnvironmentTemplate=centered, patched}\hfil \par
\UseName{@afterheading}%
\begin{enumerate}
\item \lipsum[2][1]
\end{enumerate}
\end{document}