2

With xsim, how can you adjust the space between the exercise and the number of points, using the default style?

If I change the horizontal margins manually for my document (using geometry), then the number of points is actually outside the printing area, how can I fix this?

MWE:

\documentclass{article}
\usepackage{xsim}
\usepackage{geometry}
\geometry{hmargin=1in}
\begin{document}
    \begin{exercise}[points = {10}]
        Write.
    \end{exercise}
\end{document}

gives:

enter image description here

  • Note that the number of points etc are typeset inside a \marginpar, so the \marginparsep has to be wide enough. – Jasper Habicht Feb 14 '18 at 23:42
3

The default style is defined like this:

\DeclareExerciseEnvironmentTemplate{default}{%
  \subsection*
    {%
      \XSIMmixedcase{\GetExerciseName}\nobreakspace
      \GetExerciseProperty{counter}%
      \IfInsideSolutionF
        {%
          \GetExercisePropertyT{subtitle}
            { {\normalfont\itshape\PropertyValue}}%
        }%
    }
  \GetExercisePropertyT{points}
    {%
      \marginpar
        {%
          \IfInsideSolutionF{\rule{1.2cm}{1pt}\slash}%
          \printgoal{\PropertyValue}
          \GetExercisePropertyT{bonus-points}{~(+\printgoal{\PropertyValue})}%
          ~\XSIMtranslate {point-abbr}%
        }%
    }%
}
{}

As you can see the exercise title is typeset as a \subsection*. If points are given they are typeset with a \marginpar. This means the position of the points is controlled by the dimensions of the document (textwidth, marginparsep, …). IMHO your problem rather is that \rule{1.2cm}{1pt} is too wide for your margin or that the points are written behind instead of below the rule.

One possibility:

\documentclass{article}

\usepackage{geometry}
\geometry{
  hmargin = 1in ,
  showframe
}

\usepackage{xsim}
\xsimsetup{
  exercise/template = custom
}


\DeclareExerciseEnvironmentTemplate{custom}{%
  \subsection*
    {%
      \XSIMmixedcase{\GetExerciseName}\nobreakspace
      \GetExerciseProperty{counter}%
      \IfInsideSolutionF
        {%
          \GetExercisePropertyT{subtitle}
            { {\normalfont\itshape\PropertyValue}}%
        }%
    }
  \GetExercisePropertyT{points}
    {%
      \marginpar
        {%
          \IfInsideSolutionF{\rule{1.2cm}{1pt}/\\}% <<<< NEW
          \printgoal{\PropertyValue}
          \GetExercisePropertyT{bonus-points}{~(+\printgoal{\PropertyValue})}%
          ~\XSIMtranslate {point-abbr}%
        }%
    }%
}
{}



\begin{document}

\begin{exercise}[points = 10]
  Write.
\end{exercise}

\end{document}

enter image description here

  • "that the points are written behind instead of below the rule": yes, that's excellent, thanks a lot, it's exactly what I was looking for. – Clément Feb 15 '18 at 14:48

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.