-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Strange distancing when starting with a bulleted enviroment. #116
Comments
With the default setting With Implementations of exercise templates
|
\DeclareExerciseEnvironmentTemplate {default} | |
{ | |
\GetExerciseHeadingF { \subsection* } | |
{ | |
\XSIMmixedcase { \GetExerciseName } \nobreakspace | |
\GetExerciseProperty {counter} | |
\IfInsideSolutionF | |
{ | |
\IfExercisePropertySetT {subtitle} | |
{ ~ { \normalfont \itshape \GetExerciseProperty {subtitle} } } | |
} | |
} | |
\GetExercisePropertyT {points} | |
{ | |
\marginpar | |
{ | |
\IfInsideSolutionF { \rule {1.2cm} {1pt} \slash } | |
\printgoal {\PropertyValue} | |
\GetExercisePropertyT {bonus-points} | |
{ \nobreakspace ( + \printgoal {\PropertyValue} ) } | |
\nobreakspace\XSIMtranslate {point-abbr} | |
} | |
} | |
} | |
{ \par } |
xsim/code/xsim.style.layouts.code.tex
Lines 95 to 115 in 06e3dba
\DeclareExerciseEnvironmentTemplate{centered} | |
{% | |
\par\vspace{\baselineskip} | |
\Needspace*{2\baselineskip} | |
\noindent | |
\hfil\textbf{\XSIMmixedcase{\GetExerciseName}~\GetExerciseProperty{counter}}% | |
\GetExercisePropertyT{subtitle}{ \textit{#1}}\hfil | |
\par\noindent | |
\IfInsideSolutionF{% | |
\GetExercisePropertyT{points}{% | |
\marginpar{% | |
\printgoal{\PropertyValue}% | |
\GetExercisePropertyT{bonus-points}{+\printgoal{\PropertyValue}}% | |
\,\IfExerciseGoalSingularTF{points} | |
{\XSIMtranslate{point}} | |
{\XSIMtranslate{points}}% | |
}% | |
}% | |
}% | |
} | |
{} |
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}
I noticed that the spacing is of if I start a (centered) exercise with an itemize or enumerate enviroment.
Minimal working example:
produces

The text was updated successfully, but these errors were encountered: