# Showing points and total points using exercise or any other suitable package

I want to prepare a book with many chapters (and sections), notes, exercises and linked solutions at the end of the book . I decided to adopt the example from on matching enumerated exercises with their answer. However, I want to display points per question part as shown here . The exam package

\documentclass{memoir}

\usepackage{amsmath}
\usepackage[inline]{enumitem}
\usepackage{xcolor}
\usepackage{ntheorem}
\theorembodyfont{\upshape}
\theoremseparator{.}

\Newassociation{sol}{Solution}{ans}
\renewcommand{\Solutionlabel}[1]{\small{#1.}}
\newtheorem{ex}{}[section]
\renewcommand{\theex}{\arabic{ex}}
\newenvironment{Ex}[1]{\begin{trivlist}\item \textsc{#1} %
\renewcommand{\Currentlabel}{#1}}{\end{trivlist}}

\usepackage{multicol}
\newenvironment{mtmulticols}[1]{%
\Writetofile{ans}{\string\begin{multicols}{#1}}
\begin{multicols}{#1}}{\end{multicols}%
\Writetofile{ans}{\string\end{multicols}}}

\Newassociation{solitem}{Solutionsubitem}{ans}
\renewcommand{\Solutionsubitemlabel}[1]{#1}
\newenvironment{Solutionsublist}{\Writetofile{ans}{\string\begin{Solution}  {\theex}}}{\Writetofile{ans}{\string\end{Solution}}}`

\begin{document}
\chapter{Polynomials}
\section{Partial fractions}
\label{sec:partial-fractions}
\tracingmacros=1
\Opensolutionfile{ans}[partial-fractions]
\section*{Exercises for Section \ref{sec:partial-fractions}}
\vspace{-0.6cm}
\hrulefill
\begin{Ex}{Warm-ups}
\end{Ex}
\begin{ex}
Who is the most famous mathematician of all time?
\begin{sol}
Euler
\end{sol}
\end{ex}
\begin{ex}
Resolve each of the following proper rational expressions (some filler here)  into partial fractions.
\begin{multicols}{3}
\begin{Solutionsublist}
\begin{enumerate}[label=(\alph*)]
\item $\displaystyle{\frac{1}{(x - 1)(x - 2)}}$
\begin{solitem}
$\displaystyle{\frac{1}{x - 2} - \frac{1}{x - 1}}$
\end{solitem}
\item $\displaystyle{\frac{5x + 4}{x^2 + x - 2}}$
\begin{solitem}
$\displaystyle{\frac{2}{x + 2} + \frac{3}{x - 1}}$
\end{solitem}
\item $\displaystyle{\frac{7x - 1}{2x^2 - x - 1}}$
\begin{solitem}
$\displaystyle{\frac{3}{2x + 1} + \frac{2}{x - 1}}$
\end{solitem}
\item $\displaystyle{\frac{25}{18x^3 - 9x^2 - 11x + 2}}$
\begin{solitem}
$\displaystyle{\frac{3}{3x + 2} - \frac{12}{6x - 1} + \frac{1}{x - 1}}$
\end{solitem}
\item $\displaystyle{\frac{x^2 + 15x - 4}{(x + 1)(x + 2)(x - 8)}}$
\begin{solitem}
$\displaystyle{\frac{2}{x - 8} + \frac{2}{x + 1} - \frac{3}{x + 2}}$
\end{solitem}
\item $\displaystyle{\frac{48}{(x^2 - 1)(x^2 - 9)}}$
\begin{solitem}
$\displaystyle{\frac{3}{x - 1} + \frac{3}{x + 1} - \frac{1}{x + 3} + \frac{1}{x - 3}}$
\end{solitem}
\end{enumerate}
\end{Solutionsublist}
\end{multicols}
\end{ex}

\Closesolutionfile{ans}
\input{partial-fractions}

\end{document}
• At a certain point, it becomes easier to start from scratch than modify a package. There are a number of ways to set this up, including tabular and \makebox. You will need a counter for the (a) (b)... and another if you want to automatically compute the total. Commented Feb 4, 2019 at 16:15

I am not familiar with the answer package but would propose a solution to add score points consisting of three parts:

1. Use of a displayed math environment with \tag to display the appropriate score (additional benefit: remove need for endless \displaystyle calls).
2. Redefine the \tag format to use brackets [] instead of parentheses () (possible with the mathtools package).
3. Tweak from this answer to get the displayed math to appear on the same line as the item number.

Further adjustment may be required to suit your tastes. For starters, I would personally suggest adding at least leftmargin=* in the enumerate environment options in order to give your equations a bit more space (you may also wish to experiment with the fleqn option of the amsmath package).

\usepackage{mathtools}
% Change tag form to brackets []
\newtagform{brackets}{[}{]}
\usetagform{brackets}
% Tweak to have displayed math appear on same line as \item. See https://tex.stackexchange.com/a/58145
\newcommand\Item[1][]{%
\ifx\relax#1\relax  \item \else \item[#1] \fi
\abovedisplayskip=0pt\abovedisplayshortskip=0pt~\vspace*{-\baselineskip}}

Example use:

\begin{ex}
\begin{multicols}{2} % Changed from 3
\begin{Solutionsublist}
\begin{enumerate}[label=(\alph*)]
% Optional - give equations a bit more room with leftmargin=*
%\begin{enumerate}[leftmargin=*,label=(\alph*)]
\Item
$$\frac{1}{(x - 1)(x - 2)}\tag{1}$$
\begin{solitem}
$\displaystyle{\frac{1}{x - 2} - \frac{1}{x - 1}}$
\end{solitem}
\end{enumerate}
\end{Solutionsublist}
\end{multicols}
\end{ex}

Note only 2 columns of equations sensibly fit (I've also left the solutions unchanged - you may want to change how you format these as well).

Example output:

This approach has the benefit that you can label each equation and retrieve the score at any time easily with \eqref.