texlive[47590] Master/texmf-dist: handin (11apr18)

commits+karl at tug.org commits+karl at tug.org
Thu May 3 18:47:20 CEST 2018


Revision: 47590
          http://tug.org/svn/texlive?view=revision&revision=47590
Author:   karl
Date:     2018-05-03 18:47:20 +0200 (Thu, 03 May 2018)
Log Message:
-----------
handin (11apr18)

Modified Paths:
--------------
    trunk/Master/texmf-dist/doc/latex/handin/README.txt
    trunk/Master/texmf-dist/doc/latex/handin/example.pdf
    trunk/Master/texmf-dist/doc/latex/handin/handin-doc.pdf
    trunk/Master/texmf-dist/doc/latex/handin/handin-doc.tex
    trunk/Master/texmf-dist/doc/latex/handin/layout.pdf
    trunk/Master/texmf-dist/tex/latex/handin/handin.sty

Modified: trunk/Master/texmf-dist/doc/latex/handin/README.txt
===================================================================
--- trunk/Master/texmf-dist/doc/latex/handin/README.txt	2018-05-03 16:47:05 UTC (rev 47589)
+++ trunk/Master/texmf-dist/doc/latex/handin/README.txt	2018-05-03 16:47:20 UTC (rev 47590)
@@ -17,7 +17,7 @@
 
 Licence:
 
-The LaTeX package handin - version v0.0.3 (2018/04/04) build 41
+The LaTeX package handin - version v0.1.0 (2018/04/10) build 47
 handin.sty
 -------------------------------------------------------------------------------------------
 Copyright (c) 2018 by Andreas Storvik Strauman

Modified: trunk/Master/texmf-dist/doc/latex/handin/example.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/handin/handin-doc.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/doc/latex/handin/handin-doc.tex
===================================================================
--- trunk/Master/texmf-dist/doc/latex/handin/handin-doc.tex	2018-05-03 16:47:05 UTC (rev 47589)
+++ trunk/Master/texmf-dist/doc/latex/handin/handin-doc.tex	2018-05-03 16:47:20 UTC (rev 47590)
@@ -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.0b47 - 2018/04/10
+%% The LaTeX package handin - version v0.1.0 (2018/04/10) build 47
 %% #PACKAGE.sty
 %% -------------------------------------------------------------------------------------------
 %% Copyright (c) 2018 by Andreas Storvik Strauman
@@ -24,7 +24,7 @@
   moretexcs={arrayrulecolor,draw,includegraphics,ifthenelse,isodd,lipsum,path,pgfkeysalso},
   classoffset=1,
   moretexcs={% core
-    problem,pproblem,title,author,logo,coursename,coursetitle,institute,containspages,pagetext,settable
+    problem,pproblem,title,author,logo,coursename,coursetitle,institute,containspages,pagetext,settable,handinsetup,currentProblem,currentPartProblem,currentProblemIfNewPage
   },
   texcsstyle=*\color{Definition}\bfseries,
   classoffset=0,% restore default
@@ -43,6 +43,7 @@
     drop fuzzy shadow,#1}
   \makeatother
 \let\dac\docAuxCommand
+\long\def\keyDef#1#2#3#4{\begin{docKey}{#1}{=\meta{#2}}{\meta{default}=#3}#4\end{docKey}}
 \tcbset{documentation listing style=mydocumentation}
 % Magenta HREF style
 \let\oldhref\href
@@ -55,7 +56,7 @@
 
 
 \setlength{\parindent}{0pt}
-\title{{Handin - manual\\ v0.0.3{\\[-0.5em]\footnotesize(build 41)}}}
+\title{{handin - manual\\ v0.1.0{\\[-0.5em]\footnotesize(build 47)}}}
 \author{Andreas Strauman}
 \begin{document}
 \maketitle
@@ -66,15 +67,69 @@
 
 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-template/}
+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-template/}. 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}
+\subsection{Making exercises}
+Here are commands related to creating exercises
+\begin{docCommand}{problem}{\marg{text}}
+ 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}}
+ 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}
+\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]}}
+ 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}
 \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:
+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}}
@@ -113,23 +168,37 @@
 \usepackage[german]{babel}
 \end{dispListing}
 \subsection{General reference}
-\begin{docCommand}{problem}{\marg{text}}
- 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
+\begin{docCommand}{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}{problem}{}
- Does the same as \dac{problem}, but does not add the problem to the table of contents
+\begin{docCommand}{currentPartProblem}{}
+ Just as \refCom{currentProblem}, but contains the argument of the last call to \dac{pproblem}
 \end{docCommand}
-\begin{docCommand}{pproblem}{\marg{text}}
- 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)}. You can do a star (*) after \dac{pproblem} to
- prevent it from showing in the table of contents
+\begin{docCommand}{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}{pproblem}{}
- Does the same as \dac{pproblem}, but does not add the part problem to the table of contents
-\end{docCommand}
 \begin{docCommand}{settable}{\marg{text}}
 \begin{dispListing}
  \settable{hello}
@@ -157,5 +226,20 @@
   v0.0.3b41&2018/04/04&\begin{itemize}
     \item German language added by africola \newline (\url{https://github.com/africola})
   \end{itemize}\\
+  v0.0.4&2018/04/06&\begin{itemize}
+    \item Made proper margins for problem headers and part problem headers
+    \item Added \texttt{microtype} and Latin Modern font (\texttt{cfr-lm})\newline
+    Contributed by:\newline
+    \href{https://github.com/koppor}{koppor} (\url{https://github.com/koppor})
+  \end{itemize}\\
+  v0.1.0&2018/04/10&\begin{itemize}
+    \item Introduced package options
+    \item New slick, minimalistic, front page by \href{https://github.com/DanielTrosten/}{DanielTrosten}
+    \item Added support for \dac{thetitle} and \dac{theauthor} by \href{https://github.com/MadsAdrian/}{MadsAdrian}
+    \item Footer bar by default by \href{https://github.com/MadsAdrian/}{MadsAdrian}
+    \item New part problem counting features
+    \item Misc fixes of margin bugs
+    \item Better file structuring on page style by \href{https://github.com/MadsAdrian/}{MadsAdrian}
+  \end{itemize}\\
 \end{tabularx}
  \end{document}

Modified: trunk/Master/texmf-dist/doc/latex/handin/layout.pdf
===================================================================
(Binary files differ)

Modified: trunk/Master/texmf-dist/tex/latex/handin/handin.sty
===================================================================
--- trunk/Master/texmf-dist/tex/latex/handin/handin.sty	2018-05-03 16:47:05 UTC (rev 47589)
+++ trunk/Master/texmf-dist/tex/latex/handin/handin.sty	2018-05-03 16:47:20 UTC (rev 47590)
@@ -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,28 +13,95 @@
 %% 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 at everypage@hook}{}
+\newcommand{\epage at thispage@hook}{}
+\newcommand*{\AddEverypageHook}[1]{%
+  \g at addto@macro\epage at everypage@hook{#1}}
+\newcommand*{\AddThispageHook}[1]{%
+  \g at addto@macro\epage at thispage@hook{#1}}
+\newcommand*{\epage at ep@init}{%
+  \let\epage at op@saved\@outputpage
+  \def\@outputpage{%
+    \epage at op@preamble
+    \epage at op@saved
+    \epage at op@postamble}}
+\newcommand*{\epage at op@preamble}{%
+  \let\epage at begindvi\@begindvi
+  \def\@begindvi{%
+    \epage at everypage@hook
+    \epage at thispage@hook
+    \gdef\epage at thispage@hook{}
+    \epage at begindvi}}
+\newcommand*{\epage at op@postamble}{%
+  \let\@begindvi\epage at begindvi}
+\AtBeginDocument{\epage at 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 at 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 at opt@problemheader}%
+}\vspace*{1.5\baselineskip}%
+}
+\gdef\pproblem{\@ifstar{\@pproblem}{\@pproblemTOC}}
+\gdef\@pproblemTOC#1{%
+  \gdef\currentPartProblem{#1}
+  \addcontentsline{toc}{subsection}{\handin at opt@partproblemheaderTOC}%
+  \@pproblem{\currentPartProblem}%
+}
+\def\@pproblem#1{%
+\@atMargin{{\normalfont\Large\bfseries\handin at opt@partproblemheader}}{\fullpartproblemmargin}\ignorespaces%
+}
  \usepackage{fancyhdr}
 \usepackage{geometry}
 \usepackage{amsmath}
@@ -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 at opt@problemheader},
+part problem TOC={\currentPartProblem},
+logo width={0.4},
+title style=wholepage,
+},
+problem header/.store in = \handin at opt@problemheader,
+part problem header/.store in = \handin at opt@partproblemheader,
+problem TOC/.store in = \handin at opt@problemheaderTOC,
+part problem TOC/.store in = \handin at opt@partproblemheaderTOC,
+logo width/.estore in = \handin at opt@logowidth,
+title style/.style = {titles/#1/.get = \handin at opt@titlestyle},
+titles/.cd,
+  wholepage/.initial = \handin at title@wholepage,
+  small/.initial = \handin at 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 at title\title
+\gdef\title#1{    \@tmp at title{#1}
+    \gdef\thetitle{#1}
+}
 \settable{author}
+\let\@tmp at author\author
+\gdef\author#1{    \@tmp at 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 at maketitle = \maketitle
-\def\maketitle{	\old at maketitle
+\gdef\@maketitle{\handin at opt@titlestyle}
+\gdef\handin at title@wholepage{%
 	\thispagestyle{empty}
+	\begin{center}
+		\ifshowoff
+			\Huge{\textbackslash logo}\\
+			\Large{\@title} \\[1.5cm]
+		\else
+		\ifset at logo{			\includegraphics[width=\handin at opt@logowidth\textwidth]{\@logo}\\[0.5cm]
+			\Large{\@title} \\[1.5cm]
+}{			\ea\@latex at 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
 }
-\def\@maketitle{%
-\begin{center}
-  \ifshowoff
-    \Huge{\textbackslash logo}\\
-    \Large{\@title} \\[1.5cm]
-  \else
-  \ifset at logo{    \includegraphics[scale=1]{\@logo}\\[0.5cm]
-    \Large{\@title} \\[1.5cm]
-}{    \ea\@latex at warning{Use \noexpand\logo{path/to/image} to set a logo on the front page}
-    \Huge{\@title} \\[1.0cm]
+\gdef\handin at title@small{%
+	\begin{center}
+		\ifshowoff
+			\Huge{\textbackslash logo}\\[0.5cm]
+		\else
+		\ifset at logo{			\includegraphics[width=\handin at opt@logowidth\textwidth]{\@logo} \\[0.5cm]
+}{			\ea\@latex at warning{Use \noexpand\logo{path/to/image} to set a logo on the front page}
 }
-  \fi
-\end{center}
-\begin{center}
-  \textbf{\@coursename - \@coursetitle}\\[1cm]
-  \textbf{\@author} \\[1cm]
-  \textbf{\today} \\[3cm]
-\end{center}
-\begin{center}
-  \vfill
-  \ifset at containspages{    \@containspages
-}{    \@tr{containspages}
-}\\[0.5cm]
-  \textsc{\@institute}
-\end{center}
- 	\rhead{\@author}
-	\lhead{\@coursename - \@coursetitle}
-	\ifset at pagetext{		\rfoot{\@pagetext}
-}{		\rfoot{\@tr{pagetext}}
+		\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}



More information about the tex-live-commits mailing list