summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/handin
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2018-05-03 16:47:20 +0000
committerKarl Berry <karl@freefriends.org>2018-05-03 16:47:20 +0000
commit0ab50bc3d1ddb30ac5f4a9ba8d147e8c2f834d65 (patch)
tree3fba2ca7b46f75c3ace92ddd44f28fe2ea86bae6 /Master/texmf-dist/tex/latex/handin
parent1eca258393711ac5b590d4b47e3f1b3af566b4af (diff)
handin (11apr18)
git-svn-id: svn://tug.org/texlive/trunk@47590 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/handin')
-rw-r--r--Master/texmf-dist/tex/latex/handin/handin.sty239
1 files changed, 185 insertions, 54 deletions
diff --git a/Master/texmf-dist/tex/latex/handin/handin.sty b/Master/texmf-dist/tex/latex/handin/handin.sty
index 61edfdf8625..0fca58285bd 100644
--- a/Master/texmf-dist/tex/latex/handin/handin.sty
+++ b/Master/texmf-dist/tex/latex/handin/handin.sty
@@ -1,5 +1,5 @@
-%% handin v0.0.3b41 - 2018/04/04
-%% The LaTeX package handin - version v0.0.3 (2018/04/04) build 41
+%% handin v0.1.0 - 2018/04/10
+%% The LaTeX package handin - version v0.1.0 (2018/04/10) build 47
%% handin.sty
%% -------------------------------------------------------------------------------------------
%% Copyright (c) 2018 by Andreas Storvik Strauman
@@ -13,27 +13,94 @@
%% 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
-\ProvidesPackage{handin}[2018/04/04 v0.0.3 Creates a setup that is ideal for handing in hard-science school papers that are divided in exercises.]
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{handin}[2018/04/10 v0.1.0 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.0}{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!}
\usepackage[utf8]{inputenc}
+\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{lastpage}
\usepackage{scrextend}
-\def\exerciseNr{0}
-\gdef\problem{\@ifnextchar*{\expandafter\@problem\@secondoftwo}{\@problemTOC}}
-\gdef\@problemTOC#1{ \addcontentsline{toc}{section}{\@tr{Problem} #1}
- \@problem{#1}
+\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
+}%
}
-\newcommand{\@problem}[1]{ \def\exerciseNr{#1}
- \begin{addmargin}{-1.5em}
- {\normalfont\Large\bfseries \@tr{Problem} #1}
- \end{addmargin}
}
-\gdef\pproblem{\@ifnextchar*{\expandafter\@pproblem\@secondoftwo}{\@pproblemTOC}}
-\gdef\@pproblemTOC#1{ \addcontentsline{toc}{subsection}{\exerciseNr #1}
- \@pproblem{#1}
+\gdef\isFirstProblem{1}
+\def\AtFirstProblem{\begin{addmargin}{\probleminset}
+\preto\@enddocumenthook{\end{addmargin}}
}
-\newcommand{\@pproblem}[1]{ \vspace*{1em}
- \hspace*{-0.5em}{\normalfont\Large\bfseries\exerciseNr #1)}
+\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{\@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{\@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%
}
\usepackage{fancyhdr}
\usepackage{geometry}
@@ -42,6 +109,50 @@
\usepackage{bm}
\usepackage{esint}
\usepackage{iflang}
+\usepackage{etoolbox}
+\usepackage{pgfkeys}
+\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}
+\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%
@@ -101,52 +212,72 @@
}
\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{containspages}
-\settable{pagetext}
-\setlength\parindent{0pt}
-\geometry{paper=a4paper, bottom=3cm, top=3cm, footnotesep=3cm}
-\fancyhf{}
-\addtolength\headwidth{4em}
-\fancyheadoffset{2em}
-\pagestyle{fancy}
+\settable[\@tr{containspages}]{containspages}
+\settable[\@tr{pagetext}]{pagetext}
\let\old@maketitle = \maketitle
-\def\maketitle{ \old@maketitle
+\gdef\@maketitle{\handin@opt@titlestyle}
+\gdef\handin@title@wholepage{%
\thispagestyle{empty}
- \clearpage
+ \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]
}
-\def\@maketitle{%
-\begin{center}
- \ifshowoff
- \Huge{\textbackslash logo}\\
- \Large{\@title} \\[1.5cm]
- \else
- \ifset@logo{ \includegraphics[scale=1]{\@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
}
- \fi
-\end{center}
-\begin{center}
- \textbf{\@coursename - \@coursetitle}\\[1cm]
- \textbf{\@author} \\[1cm]
- \textbf{\today} \\[3cm]
-\end{center}
-\begin{center}
- \vfill
- \ifset@containspages{ \@containspages
-}{ \@tr{containspages}
-}\\[0.5cm]
- \textsc{\@institute}
-\end{center}
- \rhead{\@author}
- \lhead{\@coursename - \@coursetitle}
- \ifset@pagetext{ \rfoot{\@pagetext}
-}{ \rfoot{\@tr{pagetext}}
+\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}
+\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}