summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/handin
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/handin
Initial commit
Diffstat (limited to 'macros/latex/contrib/handin')
-rw-r--r--macros/latex/contrib/handin/README.txt34
-rw-r--r--macros/latex/contrib/handin/example.pdfbin0 -> 149922 bytes
-rw-r--r--macros/latex/contrib/handin/example.tex21
-rw-r--r--macros/latex/contrib/handin/handin-doc.pdfbin0 -> 176554 bytes
-rw-r--r--macros/latex/contrib/handin/handin-doc.tex330
-rw-r--r--macros/latex/contrib/handin/handin.sty296
-rw-r--r--macros/latex/contrib/handin/layout.pdfbin0 -> 111850 bytes
7 files changed, 681 insertions, 0 deletions
diff --git a/macros/latex/contrib/handin/README.txt b/macros/latex/contrib/handin/README.txt
new file mode 100644
index 0000000000..143850a5b7
--- /dev/null
+++ b/macros/latex/contrib/handin/README.txt
@@ -0,0 +1,34 @@
+Handin:
+Light weight template for creating school submissions using LaTeX. Especially suitable for math, physics, statistics and the like.
+
+Files included in this package:
+
+├── README.txt
+├── example.pdf
+├── example.tex
+├── handin-doc.pdf
+├── handin-doc.tex
+├── handin.sty
+└── layout.pdf
+
+Author: Storvik Strauman, Andreas
+
+For bug report, inquires, contributed or anything else:
+https://github.com/Strauman/handin-LaTeX
+
+Licence:
+
+The LaTeX package handin - version v0.1.1 (2018/07/22) build 52
+handin.sty
+-------------------------------------------------------------------------------------------
+Copyright (c) 2018 by Andreas Storvik Strauman
+-------------------------------------------------------------------------------------------
+This work may be distributed and/or modified under the
+conditions of the LaTeX Project Public License, either version 1.3c
+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.3c or later is part of all distributions of LaTeX
+version 2008/05/04 or later.
+This work has the LPPL maintenance status `author-maintained'.
+This work consists of all files listed in README
diff --git a/macros/latex/contrib/handin/example.pdf b/macros/latex/contrib/handin/example.pdf
new file mode 100644
index 0000000000..4764670ec2
--- /dev/null
+++ b/macros/latex/contrib/handin/example.pdf
Binary files differ
diff --git a/macros/latex/contrib/handin/example.tex b/macros/latex/contrib/handin/example.tex
new file mode 100644
index 0000000000..4f4ba6ab3c
--- /dev/null
+++ b/macros/latex/contrib/handin/example.tex
@@ -0,0 +1,21 @@
+\documentclass{article}
+\usepackage[english]{babel}
+% ^ Supports [english], [german] and [norsk] (norwegian)
+\usepackage{handin}
+
+\title{Assignment 1}
+\author{The name}
+\coursename{TST-101}
+\coursetitle{Test course}
+\institute{Institute of Physics and Technology}
+%Values below are optional and defaults as given:
+\pagetext{Page \thepage~of \pageref{LastPage}}
+\containspages{Contains \pageref{LastPage} pages, front page included}
+
+\begin{document}
+ \maketitle
+ \problem{1}
+ \pproblem{a}
+ Gauss law tells us that
+ \[ \oiint\limits_{S}\vec E\cdot \mathrm{d}\vec{S}=\frac{Q_{\text{enc}}}{\varepsilon_0} \]
+\end{document}
diff --git a/macros/latex/contrib/handin/handin-doc.pdf b/macros/latex/contrib/handin/handin-doc.pdf
new file mode 100644
index 0000000000..a4398a9260
--- /dev/null
+++ b/macros/latex/contrib/handin/handin-doc.pdf
Binary files differ
diff --git a/macros/latex/contrib/handin/handin-doc.tex b/macros/latex/contrib/handin/handin-doc.tex
new file mode 100644
index 0000000000..d369189ecc
--- /dev/null
+++ b/macros/latex/contrib/handin/handin-doc.tex
@@ -0,0 +1,330 @@
+%% handin v0.1.1b52 - 2018/07/22
+%% The LaTeX package handin - version v0.1.1 (2018/07/22) build 52
+%% Manual/Documentation for handin.sty
+%% -------------------------------------------------------------------------------------------
+%% Copyright (c) 2018 by Andreas Storvik Strauman
+%% -------------------------------------------------------------------------------------------
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3c
+%% 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.3c or later is part of all distributions of LaTeX
+%% version 2008/05/04 or later.
+%% This work has the LPPL maintenance status `author-maintained'.
+%% This work consists of all files listed in README.txt
+\documentclass[a4paper]{article}
+\usepackage[all]{tcolorbox}
+\usepackage{needspace}
+\usepackage{tabularx}
+\usepackage{geometry}
+\makeatletter
+\def\input@path{{../../docs/}}
+\lstdefinestyle{mydocumentation}{style=tcbdocumentation,
+ classoffset=0,
+ texcsstyle=*\color{blue},
+ moretexcs={arrayrulecolor,draw,includegraphics,ifthenelse,isodd,lipsum,path,pgfkeysalso},
+ classoffset=1,
+ moretexcs={% core
+ problem,pproblem,handinsetup,title,author,logo,coursename,coursetitle,institute,containspages,pagetext,currentProblem,currentPartProblem,currentProblemIfNewPage,settable
+ },
+ texcsstyle=*\color{Definition}\bfseries,
+ classoffset=0,% restore default
+ }
+\newtcolorbox{marker}[1][]{enhanced,
+ before skip=2mm,after skip=3mm,
+ boxrule=0.4pt,left=5mm,right=2mm,top=1mm,bottom=1mm,
+ colback=yellow!50,
+ colframe=yellow!20!black,
+ sharp corners,rounded corners=southeast,arc is angular,arc=3mm,
+ underlay={%
+ \path[fill=tcbcol@back!80!black] ([yshift=3mm]interior.south east)--++(-0.4,-0.1)--++(0.1,-0.2);
+ \path[draw=tcbcol@frame,shorten <=-0.05mm,shorten >=-0.05mm] ([yshift=3mm]interior.south east)--++(-0.4,-0.1)--++(0.1,-0.2);
+ \path[fill=yellow!50!black,draw=none] (interior.south west) rectangle node[white]{\Huge\bfseries !} ([xshift=4mm]interior.north west);
+ },
+ drop fuzzy shadow,#1}
+ \def\l@macro#1#2{#1\hfill\newline}
+\newcommand\macrotable{\hypersetup{linkcolor=black}\@starttoc{mac}\hypersetup{linkcolor=Definition}}
+\newcommand\gh[1]{\href{#1}{https://github.com/#1}}
+% --- CHANGELOG TABLE --- %
+\newcommand*\l@version[2]{%
+ \ifnum \c@tocdepth >\z@
+ \addpenalty\@secpenalty
+ \addvspace{1.0em \@plus\p@}%
+ \setlength\@tempdima{1.5em}%
+ \begingroup
+ \parindent \z@ \rightskip \@pnumwidth
+ \parfillskip -\@pnumwidth
+ \leavevmode \bfseries
+ \advance\leftskip\@tempdima
+ \hskip -\leftskip
+ #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{}\par
+ \endgroup
+ \fi}
+ \newcommand*\l@change[2]{%
+ \addvspace{0.5em \@plus\p@}%
+ \leftskip1em--\hspace{0.5em}\begin{minipage}{0.5\textwidth}#1\end{minipage}\hfill%
+ \begin{minipage}{0.3\textwidth}#2\end{minipage}\par%
+ }
+
+\newcommand\chlogtable{\begin{NoHyper}\@starttoc{chlog}\hypersetup{final}\end{NoHyper}}
+\def\newversion#1{\addcontentsline{chlog}{version}{#1}}
+\newcommand\change[2][]{\addtocontents{chlog}{\protect\contentsline{change}{#2}{#1}{section.\thepage}}}
+% --- /CHANGELOG TABLE --- %
+
+\let\oldTOC\tableofcontents
+\renewcommand\tableofcontents{\hypersetup{linkcolor=black}\oldTOC\hypersetup{linkcolor=Definition}}
+\reversemarginpar
+\def\updated#1{\tcbdocmarginnote{\bfseries{\color{blue}U}#1}}
+\def\defnew#1{\tcbdocmarginnote{\bfseries{\color{green}N}#1}}
+
+\let\dac\docAuxCommand
+\def\mdac#1{\docAuxCommand{\expandafter\@gobble\string#1}}
+
+\makeatother
+
+\long\def\keyDef#1#2#3#4{\begin{docKey}{#1}{=\meta{#2}}{\meta{default}=#3}#4\end{docKey}}
+\long\def\optDef#1#2{\begin{docKey*}{#1}{}{}#2\end{docKey*}}
+\tcbset{documentation listing style=mydocumentation}
+% Magenta HREF style
+\let\oldhref\href
+\gdef\href#1#2{{\color{magenta}\oldhref{#1}{#2}}}
+\tcbset{documentation listing style=mydocumentation,/tcb/color hyperlink=Definition}
+\hypersetup{colorlinks=true}
+% Give section some space
+\let\oldsection\section
+\gdef\section{\needspace{0.3\paperheight}\oldsection}
+\let\oldsubsection\subsection
+\gdef\subsection{\needspace{0.2\paperheight}\oldsubsection}
+
+
+\setlength{\parindent}{0pt}
+\title{{handin - manual\\ v0.1.1{\\[-0.5em]\footnotesize(build 52)}}}
+\author{Andreas Strauman}
+\begin{document}
+\maketitle
+\section*{2 Problem}
+I remember when I first started out with LaTeX, as a student, it was very new and challenging just to make a simple nicely typeset document. We've all seen documents that has problem numbering using sections, like I did here. (The header says \textbf{2 Problem}.)\\
+
+This is a package that makes it easy for student to hand in a formatted document in LaTeX. It just creates a couple of commands that typesets the document with nice headers (problem numbers and part problem numbers e.g. \textbf{(1a)} ).\\
+
+If you are a teacher, this package works just as well for creating exercises!\\
+
+If you found any bugs or want new functionality, to contribute, view the commented source, get latest version of this package or get in touch with me, you can do all of that at\\\url{https://github.com/Strauman/handin-LaTeX}. If you have questions of functionality, kindly direct them to the community\\ \url{http://tex.stackexchange.com}. The author is active on this site regularly.
+
+\tableofcontents
+\clearpage
+ \section{Reference}
+\filbreak\subsection{Making exercises}
+Here are commands related to creating exercises
+\begin{docCommand}{problem}{\marg{text}}\addcontentsline{toc}{subsubsection}{\refCom{problem}}
+
+ This command will print out a problem header. For example \dac{problem}\{1\}
+ prints a nice big header \textbf{Problem 1} You can do a star (*) after \dac{problem} to
+ prevent it from showing in the table of contents
+\end{docCommand}
+\begin{docCommand}{problem*}{\marg{text}}
+ Does the same as \dac{problem}, but does not add the problem to the table of contents
+\end{docCommand}
+\begin{docCommand}{pproblem}{\marg{text}}\addcontentsline{toc}{subsubsection}{\refCom{pproblem}}
+\updated{v0.1.1\\2018/07/22 }
+ This command will print out a part problem header based on what problem you are on.
+ For example if you already have done \dac{problem}\{1\}, then \dac{pproblem}\{a\}
+ prints a nice big header \textbf{(1a)}. Note that the default behaviour is such that if you are on a
+ new page, then the part problems are shown with the exercise number in front of it. If not
+ it is omitted. If you want to change this behaviour, see \dac{keyRef}\{part problem header\}
+\end{docCommand}
+\begin{docCommand}{pproblem*}{\marg{text}}
+ Does the same as \dac{pproblem}, but does not add the part problem to the table of contents
+\end{docCommand}
+\filbreak\subsection{Package options}
+\keyDef{light}{true/false}{false}{
+Pass this option if you don't want to define a different \dac{maketitle} and include
+basic math packages.
+}
+\filbreak\subsection{Package options (\dac{handinsetup})}
+ You can do configurations on this package, and probably
+ even more to come in later versions!
+\begin{docCommand}{handinsetup}{\marg{[key/values]}}\addcontentsline{toc}{subsubsection}{\refCom{handinsetup}}
+
+ Here is a list of the different keys and their meaning
+\end{docCommand}
+\keyDef{problem header}{macro}{\dac{@tr}\{Problem\}~\dac{currentProblem}}{
+This options contains the formatting of the problem header. Use \dac{currentProblem} to access the number of the current exercise, and \dac{@tr}\{Problem\} to access the translation of Problem.\\
+Defaults to \dac{@tr}\{Problem\}~\dac{currentProblem}
+}
+\keyDef{part problem header}{macro}{See below}{
+ This defaults to: \dac{currentProblemIfNewPage}\dac{currentPartProblem}).
+ See \refCom{currentProblemIfNewPage} and \refCom{currentPartProblem}
+}
+\keyDef{problem TOC}{macro}{\meta{contents of problem header}}{
+ This key decides what is written to the table of contents. It defaults to extract the content in \refKey{problem header}
+}
+\keyDef{part problem TOC}{macro}{\meta{contents of part problem header}}{
+ This key decides what is written to the table of contents. It defaults to \dac{currentPartProblem}
+ (which is what the user last sent to \dac{pproblem}).
+}
+\keyDef{logo width}{number}{0.4}{
+ Give as factor (between 0 and 1) of total text width.
+ This is a temporary fix for logo not being customisable, and is scheduled to be updated in a later version.
+}
+\keyDef{title style}{wholepage or small}{wholepage}{
+If "wholepage", \dac{maketitle} will produce a full front-page. If "small", \dac{maketitle} will produce a smaller title containing the course name, course title, title, and author.
+}
+ \subsubsection*{Example} If you don't want to have the exercise number ever in front of the letter, then you'd do
+\begin{dispListing}
+ \handinsetup{part problem header=\currentPartProblem}
+\end{dispListing}
+\filbreak\subsection{Page formatting commands}
+This package redefines \dac{maketitle}.
+Here are some front-page commands. See layout.pdf for where they will appear.
+These commands all have to be executed in the preamble (that is after \dac{documentclass} and before \dac{begin}\{document\})\\
+The \dac{title} and \dac{author} commands are as per usual,
+but are made lasting (not cleared by \dac{maketitle}) with \dac{thetitle} and \dac{theauthor} for use in headers and footers
+\begin{docCommand}{title}{\marg{title}}
+\end{docCommand}
+\begin{docCommand}{author}{\marg{your name}}
+\end{docCommand}
+\begin{docCommand}{logo}{\marg{path/to/image}}\addcontentsline{toc}{subsubsection}{\refCom{logo}}
+
+ If you want an image below the title, you provide the path to the image here
+\end{docCommand}
+\begin{docCommand}{coursename}{\marg{text}}\addcontentsline{toc}{subsubsection}{\refCom{coursename}}
+
+\end{docCommand}
+\begin{docCommand}{coursetitle}{\marg{text}}\addcontentsline{toc}{subsubsection}{\refCom{coursetitle}}
+
+The front page will show coursename - coursetitle on a "subtitle" format
+\end{docCommand}
+\begin{docCommand}{institute}{\marg{text}}\addcontentsline{toc}{subsubsection}{\refCom{institute}}
+
+ Shows as text on bottom
+\end{docCommand}
+\begin{docCommand}{containspages}{\marg{text}}\addcontentsline{toc}{subsubsection}{\refCom{containspages}}
+
+ Here you can set a string that shows on bottom. Default is\\
+ \dac{containspages}\{Contains \dac{pageref}\brackets{LastPage\} pages, front page included}
+\end{docCommand}
+\begin{docCommand}{pagetext}{\marg{string}}\addcontentsline{toc}{subsubsection}{\refCom{pagetext}}
+
+ This is the text that is on the bottom right corner reading "Page x of y". Default is
+ \dac{pagetext}\{Page \dac{thepage}~of \dac{pageref}{LastPage\}}
+\end{docCommand}
+\filbreak\subsection{Languages}
+This package supports.
+\begin{itemize}
+\item English
+\item Norwegian
+\item German (by \href{https://github.com/africola}{africola})
+
+
+\end{itemize}
+Translations are welcome at \url{https://github.com/Strauman/Handin-LaTeX-template/tree/master/src/languages}.
+The current language is set by the \texttt{iflang} package, so you can use e.g. babel:
+\begin{dispListing}
+\usepackage[german]{babel}
+\end{dispListing}
+\filbreak\subsection{General reference}
+\begin{docCommand}{currentProblem}{}\addcontentsline{toc}{subsubsection}{\refCom{currentProblem}}
+
+Contains the argument of the last call to \dac{problem}
+\begin{dispListing}
+\pproblem{hello}
+\pproblem{world}
+\currentPartProblem %<- contains world
+\end{dispListing}
+\end{docCommand}
+\begin{docCommand}{currentPartProblem}{}\addcontentsline{toc}{subsubsection}{\refCom{currentPartProblem}}
+
+ Just as \refCom{currentProblem}, but contains the argument of the last call to \dac{pproblem}
+\end{docCommand}
+\begin{docCommand}{currentProblemIfNewPage}{}\addcontentsline{toc}{subsubsection}{\refCom{currentProblemIfNewPage}}
+
+If the problem is not defined on the current page, then
+The first time \dac{currentProblemIfNewPage} is called on a page,
+it expands to the current problem number. If not, it expands to empty.
+If the problem is defined on the current page, it also expands to empty.
+ This is used in the default key for the \dac{keyRef}\{part problem header\}.
+ Here are some examples
+\begin{dispListing}
+\problem{1}
+\currentProblemIfNewPage % <- empty
+\end{dispListing}
+
+
+\begin{dispListing}
+\problem{4}
+\clearpage
+\currentProblemIfNewPage % <- expands to 4
+\currentProblemIfNewPage % <- expands to empty
+\end{dispListing}
+\end{docCommand}
+\begin{docCommand}{settable}{\marg{text}}
+\begin{dispListing}
+ \settable{hello}
+\end{dispListing}
+ if now \dac{@hello} is called,
+ a warning is displayed with
+ the text "\dac{hello} not set"
+\begin{dispListing}
+ \hello{world}
+\end{dispListing}
+ if now \dac{@hello} is called, it prints "world"
+ \dac{@hello@noerror} gives the returning
+ content and empty without error if no content set.
+\begin{dispListing}
+ \ifset@hello{true}{false}
+\end{dispListing}
+\end{docCommand}
+\filbreak\subsection{Macro index reference}
+
+ \addcontentsline{mac}{macro}{\refCom{author}}{}
+\addcontentsline{mac}{macro}{\refCom{containspages}}{}
+\addcontentsline{mac}{macro}{\refCom{coursename}}{}
+\addcontentsline{mac}{macro}{\refCom{coursetitle}}{}
+\addcontentsline{mac}{macro}{\refCom{currentPartProblem}}{}
+\addcontentsline{mac}{macro}{\refCom{currentProblem}}{}
+\addcontentsline{mac}{macro}{\refCom{currentProblemIfNewPage}}{}
+\addcontentsline{mac}{macro}{\refCom{handinsetup}}{}
+\addcontentsline{mac}{macro}{\refCom{institute}}{}
+\addcontentsline{mac}{macro}{\refCom{logo}}{}
+\addcontentsline{mac}{macro}{\refCom{pagetext}}{}
+\addcontentsline{mac}{macro}{\refCom{pproblem}}{}
+\addcontentsline{mac}{macro}{\refCom{pproblem*}}{}
+\addcontentsline{mac}{macro}{\refCom{problem}}{}
+\addcontentsline{mac}{macro}{\refCom{problem*}}{}
+\addcontentsline{mac}{macro}{\refCom{settable}}{}
+\addcontentsline{mac}{macro}{\refCom{title}}{}
+
+ \macrotable
+
+
+% \newgeometry{lmargin=0.7cm}
+\section{Changelog}
+% Use , 2018/04/01
+\newversion{v0.0.2 2018/04/01}
+ \change{Problems are now added to the table of contents by default}
+\newversion{v0.0.2b34 2018/04/02}
+ \change{Updated documentation syntax}
+\newversion{v0.0.3b41 2018/04/04}
+ \change[\gh{africola}]{German language translation}
+
+\newversion{v0.0.4 2018/04/06}
+ \change{Made proper margins for problem headers and part problem headers}
+ \change[\gh{koppor}]{Added \texttt{microtype} and Latin Modern font (\texttt{cfr-lm})}
+
+
+\newversion{v0.1.0 2018/04/10}
+ \change{Introduced package options}
+ \change[\gh{DanielTrosten}]{New slick, minimalistic, front page}
+ \change[\gh{MadsAdrian}]{Added support for \dac{thetitle} and \dac{theauthor}}
+ \change[\gh{MadsAdrian}]{Footer bar by default}
+ \change{New part problem counting features}
+ \change{Misc fixes of margin bugs}
+ \change[\gh{MadsAdrian}]{Better file structuring on page style}
+\newversion{v0.1.1 2018/07/22}
+ \change{Fixed bug where first page after title did not have header and footer.}
+ \change{Makes sure \refCom{pproblem} is in horizontal mode, so that the \dac{pproblem} header is placed correctly.}
+ \change{Added package option \refKey{light}}
+\chlogtable
+ \end{document}
diff --git a/macros/latex/contrib/handin/handin.sty b/macros/latex/contrib/handin/handin.sty
new file mode 100644
index 0000000000..4e99355cbe
--- /dev/null
+++ b/macros/latex/contrib/handin/handin.sty
@@ -0,0 +1,296 @@
+%% handin v0.1.1 - 2018/07/22
+%% The LaTeX package handin - version v0.1.1 (2018/07/22) build 52
+%% handin.sty
+%% -------------------------------------------------------------------------------------------
+%% Copyright (c) 2018 by Andreas Storvik Strauman
+%% -------------------------------------------------------------------------------------------
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either version 1.3c
+%% 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.3c or later is part of all distributions of LaTeX
+%% version 2008/05/04 or later.
+%% This work has the LPPL maintenance status `author-maintained'.
+%% This work consists of all files listed in README.txt
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{handin}[2018/07/22 v0.1.1 Creates a setup that is ideal for handing in hard-science school papers that are divided in exercises.]
+\newlength{\extramargins}
+\setlength{\extramargins}{4em}
+\PackageWarningNoLine{handin-v0.1.1}{This package is in the alpha stage, and if something unexpected happens please, oh pretty please, report it to https://github.com/Strauman/Handin-LaTeX-template. Thank you!}
+\RequirePackage{pgfopts}
+\newif\ifhandin@islight
+\pgfkeys{/handin/.is family, /handin/.cd,
+light/.is if={handin@islight}
+}
+\ProcessPgfOptions{/handin}
+\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
+\usepackage{graphicx}
+\usepackage{lastpage}
+\usepackage{scrextend}
+\newcommand{\epage@everypage@hook}{}
+\newcommand{\epage@thispage@hook}{}
+\newcommand*{\AddEverypageHook}[1]{%
+ \g@addto@macro\epage@everypage@hook{#1}}
+\newcommand*{\AddThispageHook}[1]{%
+ \g@addto@macro\epage@thispage@hook{#1}}
+\newcommand*{\epage@ep@init}{%
+ \let\epage@op@saved\@outputpage
+ \def\@outputpage{%
+ \epage@op@preamble
+ \epage@op@saved
+ \epage@op@postamble}}
+\newcommand*{\epage@op@preamble}{%
+ \let\epage@begindvi\@begindvi
+ \def\@begindvi{%
+ \epage@everypage@hook
+ \epage@thispage@hook
+ \gdef\epage@thispage@hook{}
+ \epage@begindvi}}
+\newcommand*{\epage@op@postamble}{%
+ \let\@begindvi\epage@begindvi}
+\AtBeginDocument{\epage@ep@init}
+\newlength{\partproblemheadermargin}
+\newlength{\problemheadermargin}
+\newlength{\probleminset}
+\setlength{\problemheadermargin}{0em}
+\setlength{\probleminset}{3em}
+\setlength{\partproblemheadermargin}{2em}
+\def\fullproblemmargin{\dimexpr -\extramargins/2+\problemheadermargin\relax}
+\def\fullpartproblemmargin{\dimexpr\partproblemheadermargin\relax}
+\newcommand{\@atMargin}[2]{\strut\vadjust{\@domark{#1}{#2}}}
+\newcommand{\@domark}[2]{%
+ \hbox to #2{ \vbox to 0pt{ \kern-\dp\strutbox
+ \smash{\llap{#1}}
+ \vss
+}%
+}
+}
+\gdef\isFirstProblem{1}
+\def\AtFirstProblem{\begin{addmargin}{\probleminset}
+\preto\@enddocumenthook{\end{addmargin}}
+}
+\gdef\currentProblem{0}
+\gdef\currentPartProblem{0}
+\def\exerciseNr{\currentProblem}
+\global\let\@ProblemOnThisPage\@isTrue%
+\AddEverypageHook{%
+\global\let\@ProblemOnThisPage\@isFalse%
+}
+\gdef\currentProblemIfNewPage{\if\@ProblemOnThisPage\@isFalse%
+\global\let\@ProblemOnThisPage\@isTrue%
+\currentProblem\fi}%
+\gdef\problem{\par\@ifstar{\@problem}{\@problemTOC}}
+\gdef\@problemTOC#1{%
+ \gdef\currentProblem{#1}%
+ \addcontentsline{toc}{section}{\handin@opt@problemheaderTOC}%
+ \@problem{#1}%
+}
+\def\@problem#1{%
+\global\let\@ProblemOnThisPage\@isTrue
+\def\isTrue{1}%
+\if\isFirstProblem\isTrue%
+\AtFirstProblem%
+\gdef\isFirstProblem{0}%
+\fi%
+ \gdef\currentProblem{#1}%
+ \vbox to 0pt{%
+ \hspace*{\fullproblemmargin}{\normalfont\Large\bfseries\handin@opt@problemheader}%
+}\vspace*{1.5\baselineskip}%
+}
+\gdef\pproblem{\par\@ifstar{\@pproblem}{\@pproblemTOC}}
+\gdef\@pproblemTOC#1{%
+ \gdef\currentPartProblem{#1}
+ \addcontentsline{toc}{subsection}{\handin@opt@partproblemheaderTOC}%
+ \@pproblem{\currentPartProblem}%
+}
+\def\@pproblem#1{%
+\@atMargin{{\normalfont\Large\bfseries\handin@opt@partproblemheader}}{\fullpartproblemmargin}\ignorespaces%
+}
+ \ifhandin@islight\else
+\usepackage{fancyhdr}
+\usepackage{geometry}
+\usepackage{amsmath}
+\usepackage{mathtools}
+\usepackage{bm}
+\usepackage{esint}
+\fi
+\usepackage{iflang}
+\usepackage{etoolbox}
+\usepackage{pgfkeys}
+\ifhandin@islight\else
+\usepackage[
+ babel=true, %
+ expansion=alltext,
+ protrusion=alltext-nott, %
+ final %
+]{microtype}
+\usepackage[%
+ rm={oldstyle=false,proportional=true},%
+ sf={oldstyle=false,proportional=true},%
+ tt={oldstyle=false,proportional=true,variable=true},%
+ qt=false%
+]{cfr-lm}
+\fi
+\edef\@isTrue{1}
+\edef\@isFalse{0}
+\pgfkeys{/handinsetup/.is family, /handinsetup,
+default/.style = {problem header={\@tr{Problem}~\currentProblem},
+part problem header={\currentProblemIfNewPage\currentPartProblem)},
+problem TOC={\handin@opt@problemheader},
+part problem TOC={\currentPartProblem},
+logo width={0.4},
+title style=wholepage,
+},
+problem header/.store in = \handin@opt@problemheader,
+part problem header/.store in = \handin@opt@partproblemheader,
+problem TOC/.store in = \handin@opt@problemheaderTOC,
+part problem TOC/.store in = \handin@opt@partproblemheaderTOC,
+logo width/.estore in = \handin@opt@logowidth,
+title style/.style = {titles/#1/.get = \handin@opt@titlestyle},
+titles/.cd,
+ wholepage/.initial = \handin@title@wholepage,
+ small/.initial = \handin@title@small,
+switches/.cd,
+ On/.initial = \@isTrue,
+ on/.initial = \@isTrue,
+ T/.initial = \@isTrue
+ Off/.initial = \@isFalse,
+ off/.initial = \@isFalse,
+ F/.initial = \@isFalse,
+}
+\newcommand\handinsetup[1]{ \pgfkeys{/handinsetup, #1}%
+}
+\handinsetup{default}
+\def\@tr#1{ \ifcsname tr@#1\endcsname%
+ \csname tr@#1\endcsname%
+ \else%
+ #1%
+ \fi%
+}
+\newcommand{\set@tr}[2]{ \expandafter\def\csname tr@#1\endcsname{#2}
+}
+\set@tr{Problem}{Problem}
+\set@tr{problem}{problem}
+\set@tr{containspages}{Contains \pageref{LastPage} pages, front page included}
+\set@tr{pagetext}{Page \thepage~of \pageref{LastPage}}
+ \IfLanguageName{norsk}{%
+\set@tr{Problem}{Oppgave}
+\set@tr{problem}{oppgave}
+\set@tr{pagetext}{Side \thepage~av \pageref{LastPage}}
+\set@tr{containspages}{Inneholder \pageref{LastPage} sider, inkludert forside.}
+}{}
+\IfLanguageName{german}{%
+\set@tr{Problem}{Aufgabe}
+\set@tr{problem}{Aufgabe}
+\set@tr{containspages}{Enthält \pageref{LastPage} Seiten, inklusive Titelseite}
+\set@tr{pagetext}{Seite \thepage~von \pageref{LastPage}}
+}{}
+ \newif\ifshowoff
+\showofffalse
+\let\ea = \expandafter
+\newcommand{\settable}[2][\@nil]{ \ea\def\csname #2\ea\endcsname##1{ \ea\def\csname @#2\endcsname{##1}
+ \ea\def\csname @#2@noerror\endcsname{##1}
+ \ea\def\csname isset@#2\endcsname{1}
+}
+ \ea\def\csname ifset@#2\endcsname##1##2{ \ifcsname isset@#2\endcsname%
+ ##1
+ \else
+ ##2
+ \fi
+}
+ \ea\def\csname default@#2\endcsname{#1}%
+ \ea\def\csname @#2@noerror\endcsname{#1}%
+ \ea\ifx\csname default@#2\endcsname\@nnil
+ \ea\def\csname default@#2\endcsname{ \textbackslash #2%
+ {\ea\@latex@warning{\ #2 not given}}
+}
+ \fi
+ \ea\def\csname @#2\endcsname{ \csname default@#2\endcsname
+}
+}
+\ifshowoff
+\@latex@warning{Settable: showing off, no settable is actually set!}
+\renewcommand{\settable}[2][\@nil]{ \ea\def\csname #2\endcsname##1{\relax}%
+ \ea\def\csname @#2\endcsname{}%
+ \ea\def\csname @#2@noerror\endcsname{}%
+ \ea\def\csname ifset@#2\endcsname##1##2{##2}
+ \ea\def\csname default@#2\endcsname{#1}%
+ \ea\def\csname @#2@noerror\endcsname{#1}%
+ \ea\def\csname @#2\endcsname{\textbackslash #2}
+}
+\fi
+\settable{title}
+\let\@tmp@title\title
+\gdef\title#1{ \@tmp@title{#1}
+ \gdef\thetitle{#1}
+}
+\settable{author}
+\let\@tmp@author\author
+\gdef\author#1{ \@tmp@author{#1}
+ \gdef\theauthor{#1}
+}
+\settable{logo}
+\settable{coursename}
+\settable{coursetitle}
+\settable{institute}
+\settable[\@tr{containspages}]{containspages}
+\settable[\@tr{pagetext}]{pagetext}
+ \ifhandin@islight\else
+\let\old@maketitle = \maketitle
+\gdef\@maketitle{\handin@opt@titlestyle}
+\gdef\handin@title@wholepage{%
+ \thispagestyle{empty}
+ \begin{center}
+ \ifshowoff
+ \Huge{\textbackslash logo}\\
+ \Large{\@title} \\[1.5cm]
+ \else
+ \ifset@logo{ \includegraphics[width=\handin@opt@logowidth\textwidth]{\@logo}\\[0.5cm]
+ \Large{\@title} \\[1.5cm]
+}{ \ea\@latex@warning{Use \noexpand\logo{path/to/image} to set a logo on the front page}
+ \Huge{\@title} \\[1.0cm]
+}
+ \fi
+ \end{center}
+ \begin{center}
+ \textbf{\@coursename~--~\@coursetitle}\\[1cm]
+ \textbf{\@author} \\[1cm]
+ \textbf{\today} \\[3cm]
+ \end{center}
+ \begin{center}
+ \vfill
+ \@containspages\\[0.5cm]
+ \textsc{\@institute}
+ \end{center}
+ \clearpage
+}
+\gdef\handin@title@small{%
+ \begin{center}
+ \ifshowoff
+ \Huge{\textbackslash logo}\\[0.5cm]
+ \else
+ \ifset@logo{ \includegraphics[width=\handin@opt@logowidth\textwidth]{\@logo} \\[0.5cm]
+}{ \ea\@latex@warning{Use \noexpand\logo{path/to/image} to set a logo on the front page}
+}
+ \fi
+ {\huge{\textbf{\@coursename~--~\@coursetitle \\[0.3cm] \@title}}}\\[0.3cm]
+ {\large \@author}
+ \end{center}
+}
+\geometry{paper=a4paper, bottom=3cm, top=3cm, footnotesep=3cm}
+\pagestyle{fancy}
+\g@addto@macro\maketitle{\thispagestyle{fancy}}
+\setlength\parindent{0pt}
+\addtolength\headwidth{\extramargins}
+\fancyheadoffset{\dimexpr\extramargins/2\relax}
+ \renewcommand{\headrulewidth}{.3pt} %
+ \lhead{\@coursename~--~\thetitle}
+ \cfoot{}
+ \rhead{\today}
+ \renewcommand{\footrulewidth}{.3pt} %
+ \lfoot{\theauthor}
+ \cfoot{}
+ \rfoot{\@pagetext}
+ \fi
diff --git a/macros/latex/contrib/handin/layout.pdf b/macros/latex/contrib/handin/layout.pdf
new file mode 100644
index 0000000000..2f175422e8
--- /dev/null
+++ b/macros/latex/contrib/handin/layout.pdf
Binary files differ