diff options
author | Karl Berry <karl@freefriends.org> | 2018-04-01 22:21:24 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2018-04-01 22:21:24 +0000 |
commit | fe9ffbe7cd9288728c5aa469cdb3ee173f90c69d (patch) | |
tree | 19cc85788e1008fe584d5e7e67cf73568cda9294 /Master/texmf-dist/tex/latex/handin/handin.sty | |
parent | f02c0d33eefe844fb67c5e438cfdcc26085c2223 (diff) |
handin (2apr18)
git-svn-id: svn://tug.org/texlive/trunk@47224 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/handin/handin.sty')
-rw-r--r-- | Master/texmf-dist/tex/latex/handin/handin.sty | 132 |
1 files changed, 132 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/handin/handin.sty b/Master/texmf-dist/tex/latex/handin/handin.sty new file mode 100644 index 00000000000..8b0a82833f7 --- /dev/null +++ b/Master/texmf-dist/tex/latex/handin/handin.sty @@ -0,0 +1,132 @@ +% handin v0.0.2b30 - 2018/04/01 +\ProvidesPackage{handin}[2018/04/01 v0.0.2 Creates a setup that is ideal for handing in hard-science school papers that are divided in exercises.] +\usepackage[utf8]{inputenc} +\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{\@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} +} +\newcommand{\@pproblem}[1]{ \vspace*{1em} + \hspace*{-0.5em}{\normalfont\Large\bfseries\exerciseNr #1)} +} + \usepackage{fancyhdr} +\usepackage{geometry} +\usepackage{amsmath} +\usepackage{mathtools} +\usepackage{bm} +\usepackage{esint} +\usepackage{iflang} +\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.} +}{} + \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} +\settable{author} +\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} +\let\old@maketitle = \maketitle +\def\maketitle{ \old@maketitle + \thispagestyle{empty} + \clearpage +} +\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 + \ifset@containspages{ \@containspages +}{ \@tr{containspages} +}\\[0.5cm] + \textsc{\@institute} +\end{center} + \rhead{\@author} + \lhead{\@coursename - \@coursetitle} + \ifset@pagetext{ \rfoot{\@pagetext} +}{ \rfoot{\@tr{pagetext}} +} +} |