%%
%% This is file `exfsamp.tex',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% exframe.dtx  (with options: `samplesingle')
%% 
%% Copyright (C) 2011-2020 Niklas Beisert
%% 
%% This work may be distributed and/or modified under the
%% conditions of the LaTeX Project Public License, either version 1.3
%% of this license or (at your option) any later version.
%% The latest version of this license is in
%%   http://www.latex-project.org/lppl.txt
%% and version 1.3 or later is part of all distributions of LaTeX
%% version 2005/12/01 or later.
%% 
\NeedsTeXFormat{LaTeX2e}[1996/12/01]
\ProvidesFile{exfsamp.tex}[2020/02/24 v3.4 standalone sample for exframe]
\documentclass[12pt]{article}

\usepackage{geometry}
\geometry{layout=a4paper}
\geometry{paper=a4paper}
\geometry{margin=2.5cm}
\parindent0pt
\parskip0.5ex

\usepackage{amsmath}
\usepackage{hyperref}

\PassOptionsToPackage{loadlang=en|de}{metastr}
\PassOptionsToPackage{course=true}{metastr}
%%\usepackage{metastr}
%%\metasetlang{de}

\usepackage[extstyle]{exframe}

%%\exercisesetup{solutions=true}
\exercisesetup{solutions=false}

\exercisesetup{autolabelproblem=true}

\exercisestyle{plainheader}
\exerciseconfig{composeheaderbelowright}{\getsheetdata{points}}%

\exerciseconfig{countersheet}{\Roman{sheet}}
\exerciseconfig{countersubproblem}{\roman{subproblem})}
\exerciseconfig{countersubproblemmax}{vii)}

\exerciseconfig{insertsubprobleminfo}{%
 \switchpoints{}{\addprobleminfo*{%
   \hspace{-\getexerciseconfig{skipsubprobleminfo}}*}}%
  {}{}{\getsubproblempoints{}}}

\ifdefined\metaset
\metasetterm[en]{sheet}{Exercise Sheet}
\metasetterm[en]{sheets}{Exercise Sheets}
\metasetterm[de]{sheet}{\"Ubungsblatt}
\metasetterm[de]{sheets}{\"Ubungsbl\"atter}
\else
\exerciseconfig{termsheet}{\"Ubungsblatt}
\exerciseconfig{termsheets}{\"Ubungsbl\"atter}
\fi

\exercisestyle{problempointsat=margin}
\reversemarginpar
\exerciseconfig{composepointsmargin}[1]{#1p.}
\exerciseconfig{composepointspairmargin}[2]{%
  \ifdim#2pt=0pt#1p.%
  \else\ifdim#1pt=0pt+#2p.%
  \else#1+#2p.%
  \fi\fi}

\exerciseconfig{styletitle}{\sffamily\bfseries}

\exerciseconfig{skipproblembelow}{1.5cm}

\exercisestyle{fracpoints}
\exercisestyle{solutionbelow=problem}
\exercisestyle{solutionsep}

\exercisesetup{pdfdata=sheet}

\ifdefined\metaset
\metaset[sep]{subtitle}{, }
\metaset{subtitle}{\ifsolutions\metatranslate[#1]{solutions} \fi%
  \metaif[use]{sheettitle}
   {\metapick[#1]{sheettitle}}
   {\metapick[#1]{material}}}
\metaset{author}{\exerciseifempty{\getsheetdata{author}}%
  {\metapick[#1]{instructor}}{\metapick[#1]{sheetauthor}},
  \metapick[#1]{institution}}
\else
\exerciseconfig{composemetasheet}[2]{\getexercisedata{course},
  \ifsolutions\getexerciseconfig{termsolutions} \fi%
  \exerciseifempty{#2}{\getexerciseconfig{termsheet} #1}{#2}}
\exercisedata{title=%
  {\getexercisedata{course},
  \ifsolutions\getexercisedata{solutions} \fi%
  \getexercisedata{material}}}
\exercisedata{author=%
  {\getexercisedata{instructor}, \getexercisedata{institution}}}
\fi

\ifdefined\metaset
\metaset{institution}{Katharinen-Volksschule}
\metaset[de]{course}{Mathematik}
\metaset[en]{course}{Mathematics}
\metaset{instructor}{J.\ G.\ B\"uttner}
\metaset{period}{ca.\ 1786}
\metaset[de]{material}{\"Ubungsaufgaben}
\metaset[en]{material}{Exercise Problems}
\else
\exercisedata{institution={Katharinen-Volksschule}}
\exercisedata{course={Mathematik}}
\exercisedata{instructor={J.\ G.\ B\"uttner}}
\exercisedata{period={ca.\ 1786}}
\exercisedata{material={\"Ubungsaufgaben}}
\fi

\begin{document}

\begin{sheet}[number=5,label={sheet5}]

\begin{problem}[title={Sums},points=99+4]

\exerciseloopstr{\getsubproblemlist{}}{c}%
\hfill\begin{tabular}{c|\exerciseloopret|c}
\exerciseloop{\getsubproblemlist{}}
 {&\ref{\getexerciseconfig{labelsubproblem}{#1}}}
&\ref{prob:\problemtag}\\\hline
\getexerciseconfig{termpoints}
\exerciseloop{\getsubproblemlist{}}{&\extractpoints{\getsubproblempoints{#1}}}
&\extractpoints{\getproblempoints{}}
\\
extra
\exerciseloop{\getsubproblemlist{}}{&\extractpoints*{\getsubproblempoints{#1}}}
&\extractpoints*{\getproblempoints{}}
\end{tabular}

This problem deals with sums and series.

\begin{subproblem}[points=2,difficulty=simple,label={\problemtag-simplesum}]
Compute the sum
\showpoints
\begin{equation}
1+2+3.
\end{equation}

\begin{solution}
The result is
\begin{equation}
1+2+3=6.
\end{equation}
\end{solution}

\end{subproblem}

\begin{subproblem}[points=97+0.5,difficulty=lengthy]
Compute the sum
\begin{equation}
1+2+3+\ldots+98+99+100.
\end{equation}
Keep calm and calculate!
%%That ought to keep him occupied for a while
\end{subproblem}

\begin{solution}[author={C.\ F.\ Gau\ss}]
We use the result $1+2+3=6$ from part \ref{\problemtag-simplesum}
to jumpstart the calculation. The remaining sums yield
\awardpoints*[1 for each remaining sum]{97}
\begin{equation}
6+4+5+\ldots+99+100=5050.
\end{equation}
Alternatively the summands can be grouped into pairs as follows:
\begin{align}
1+100&=101,\\
2+99&=101,\\
3+98&=101,\\
\ldots &\nonumber\\
50+51&=101.
\end{align}
These amount to 50 times the same number 101.
Therefore the sum equals
\begin{equation}
1+2+\ldots+99+100=50\cdot 101=5050.
\end{equation}
\textit{Ligget se!} \awardpoints{97+0.5}
\end{solution}

You may give the final part a try:

\begin{subproblem}[optional={optional},
  difficulty={requires inspiration},points={+3.5}]
Compute the series
\showpoints
\begin{equation}
1+2+3+\ldots
\end{equation}

\begin{solution}
The series is divergent, so the result is $\infty$ \awardpoints{+1}.
\par
However, after subtracting the divergent part,
the result clearly is
\begin{equation}
\zeta(-1)=-\frac{1}{12}\,,
\end{equation}
where the zeta-function $\zeta(s)$ is defined by
\begin{equation}
\zeta(s):=\sum_{k=1}^\infty \frac{1}{k^s}\,.
\end{equation}
This definition holds only for $s>1$ where the sum is convergent,
but one can continue the complex analytic function to $s<0$
\awardpoints{+1.5}.
\par
Another way of understanding the result
is to use the indefinite summation formula
for arbitrary exponent $s$ in the summand
(which also follows from the Euler--MacLaurin formula)
\begin{equation}
\sum_n n^s
= \frac{n^{s+1}}{s+1}
 -\sum_{j=0}^s  \frac{\zeta(j-s)\,s!}{(s-j)!\,j!}\,n^j
= \ldots - \zeta(-s)\,n^0.
\end{equation}
Curiously, the constant term with $j=0$ is just the desired result
but with the wrong sign
(in fact, the constant term of an indefinite sum is ambiguous;
for the claim we merely set $j=0$
in the expression which holds for others values of $j$)
\awardpoints{+0.5}.
In order to understand the sign,
we propose that the above formula describes the regularised result
for the sum with limits $+\infty$ and $n$
\begin{equation}
\sum_{k=+\infty}^n k^s
\simeq \frac{n^{s+1}}{s+1}
 -\sum_{j=0}^s  \frac{\zeta(j-s)\,s!}{(s-j)!\,j!}\,n^j.
\end{equation}
Then we flip the summation limits of the desired sum
to bring it into the above form
\awardpoints{+0.5}
\begin{equation}
\sum_{k=1}^\infty k^s
= -\sum_{k=\infty}^0 k^s
\simeq \zeta(-s).
\end{equation}
\end{solution}

\end{subproblem}

\end{problem}

\begin{problem}[points=1, difficulty=insane]
Show that the equation
\begin{equation}
a^3+b^3=c^3
\end{equation}
has no positive integer solutions.
\end{problem}

\begin{solution}
\normalmarginpar
This is beyond the scope of this example.
\marginpar{\footnotesize\raggedright does not fit here.\par}
\end{solution}

\ifsolutions\else
\textbf{Grading:}\par
\exerciseloopstr{\getproblemlist{}}{|c}
\begin{tabular}{|c|\exerciseloopret||c|}\hline
\getexerciseconfig{termsheet} \ref{sheet5}
\exerciseloop{\getproblemlist{*}}
 {&\ref{\getexerciseconfig{labelproblem}{#1}}}
&total
\\\hline
value
\exerciseloop{\getproblemlist{*}}
 {&\extractpoints{\getproblempoints{#1}}}%
&\extractpoints{\getsheetpoints{}}
\\\hline
\exerciseloop{\getproblemlist{*}}{&}
&\\\hline
\end{tabular}\qquad
\exerciseloop{\getproblemlist{*}}{
 \exerciseloopstr{\getsubproblemlist{#1}}{|c}
 \ifnum\value{exerciseloop}>0\relax
  \begin{tabular}{|c|\exerciseloopret||c|}\hline
  \getexerciseconfig{termproblem} \ref{\getexerciseconfig{labelproblem}{#1}}
  \exerciseloop{\getsubproblemlist{#1}}
   {&\ref{\getexerciseconfig{labelsubproblem}{##1}}}
  &total
  \\\hline
  value
  \exerciseloop{\getsubproblemlist{#1}}
   {&\extractpoints{\getsubproblempoints{##1}}}%
  &\extractpoints{\getproblempoints{#1}}
  \\\hline
  \exerciseloop{\getsubproblemlist{#1}}{&}
  &\\\hline
  \end{tabular}\quad
 \fi
}
\fi

\end{sheet}

\end{document}
\endinput
%%
%% End of file `exfsamp.tex'.
