1

The points in exercise environment seem to align right under the line of the exercise name and label as shown here

enter image description here

How do I left it upwards as follows

enter image description here

This alignment is the typical behavior of exsheets. I also want the points brackets and text to be formated as shown above.

One more thing, exsheets provides explicit options to customize points by using \SetupExSheets[points]{<options>} where <options> include format, number-format, bonus-format, separate-bonus, pre-bonus, and post-bonus as well as points-pre-code and points-post-code (in heading template). What are the equivalent of these in xsim?

\documentclass{book}

\usepackage{xsim}

\begin{document}

\begin{exercise}[subtitle=\rule{1.07\textwidth}{0.3pt}, points=5, bonus-points=1]
    Something written here
\end{exercise}

\end{document}
0

I contrast to exsheets the default layout in xsim simply uses a \subsection* followed by a \marginpar for the points. In order to change this you will have to define your own layout template. The manual has a few examples to help you get started. Below I show another example. I also added in the rule although I guess you only had that in the question to demonstrate the vertical alignment…

\documentclass{article}
\usepackage{xsim}
\usepackage{needspace,lipsum}

\makeatletter
\DeclareExerciseEnvironmentTemplate{custom}{%
  \par\vspace{3.25ex plus 1ex minus .2ex}
  \Needspace*{3\baselineskip}%
  \noindent\normalfont\large
  \textbf{\XSIMmixedcase{\GetExerciseName}\nobreakspace\GetExerciseProperty{counter}}%
  \IfInsideSolutionF{%
    \GetExercisePropertyT{subtitle}{ {\normalfont\itshape\PropertyValue}}%
  }%
  \normalsize
  \GetExercisePropertyT{points}{%
    \marginpar{%
      (%
        \printgoal{\PropertyValue}%
        \GetExercisePropertyT{bonus-points}{~[+\printgoal{\PropertyValue}]}%
      )%
    }%
  }%
  \hrulefill % << delete this line if you don't want the rule
  \par\vspace{1.5ex plus .2ex}
  \@afterindentfalse\@afterheading
}
{}
\makeatother

\xsimsetup{
  exercise/template = custom ,
  solution/template = custom
}

\begin{document}

\begin{exercise}[points=5, bonus-points=1]
  \lipsum[4]
\end{exercise}

\end{document}

enter image description here


From The example above it shouldn't be too hard to get the solution aa in the picture – assuming that the numbering follows the sectioning of the document:

\documentclass{article}
\usepackage{xsim,xcolor,needspace}
% filler text:
\usepackage{lipsum}

\makeatletter
\DeclareExerciseEnvironmentTemplate{custom}{%
  \par\vspace{3.25ex plus 1ex minus .2ex}
  \Needspace*{3\baselineskip}%
  \noindent\normalfont\normalsize
  \textcolor{blue}{%
    \textbf{\XSIMmixedcase{\GetExerciseName}\nobreakspace\GetExerciseProperty{counter}}%
  }%
  \IfInsideSolutionF{%
    \GetExercisePropertyT{subtitle}{ {\normalfont\itshape\PropertyValue}}%
  }%
  \normalsize
  \GetExercisePropertyT{points}{%
    \marginpar{%
      (%
        \printgoal{\PropertyValue}%
        \GetExercisePropertyT{bonus-points}{~[+\printgoal{\PropertyValue}]}%
      )%
    }%
  }%
  \par\vspace{1.5ex plus .2ex}
  \@afterindentfalse\@afterheading
}
{}
\makeatother

\xsimsetup{
  exercise/the-counter = \thesubsection.(\Alph{exercise}) ,
  exercise/template = custom ,
  exercise/name = Question ,
  solution/template = custom
}

\begin{document}

\section{Foo}
\subsection{Bar}

\begin{exercise}[points=5, bonus-points=1]
  \lipsum[4]
\end{exercise}
\begin{exercise}[points=2, bonus-points=3]
  \lipsum[4]
\end{exercise}

\end{document}

enter image description here

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.