diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex/exercises')
-rw-r--r-- | Master/texmf-dist/tex/latex/exercises/exercises.sty | 200 |
1 files changed, 200 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/exercises/exercises.sty b/Master/texmf-dist/tex/latex/exercises/exercises.sty new file mode 100644 index 00000000000..aca3fede546 --- /dev/null +++ b/Master/texmf-dist/tex/latex/exercises/exercises.sty @@ -0,0 +1,200 @@ +%% +%% This is file `exercises.sty', +%% generated with the docstrip utility. +%% +%% The original source files were: +%% +%% exercises.dtx (with options: `package') +%% +%% This is a generated file. +%% +%% Copyright (C) 2015 by Roger Jud <rogerjud@outlook.com> +%% +%% This file may be distributed and/or modified under the conditions of +%% the LaTeX Project Public License, either version 1.2 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.2 or later is part of all distributions of LaTeX version +%% 1999/12/01 or later. +%% +\NeedsTeXFormat{LaTeX2e}[1999/12/01] +\ProvidesPackage{exercises}[2015/09/19 v1.0 .dtx exercises file] +\RequirePackage{verbatim} +\RequirePackage{ifthen} +\RequirePackage{kvoptions} +\RequirePackage{xparse} +\RequirePackage{marginnote} +\SetupKeyvalOptions{ + family=exercises, + prefix=exercises@} +\DeclareBoolOption{printsolution} +\DeclareStringOption[2.0ex plus 1.0ex minus 0.5ex]{exercisespaceabove} +\DeclareStringOption[1.5ex plus 1.0ex minus 0.5ex]{exercisespacebelow} +\DeclareStringOption[2.0ex plus 1.0ex minus 0.5ex]{solutionspaceabove} +\DeclareStringOption[1.5ex plus 1.0ex minus 0.5ex]{solutionspacebelow} +\DeclareStringOption[0.25ex]{blockspace} +\DeclareStringOption[0.5em]{inlinespace} +\DeclareStringOption[arabic]{exercisenumberformat} +\DeclareStringOption[aftername]{pointsposition} +\DeclareStringOption[normalsize]{pointsfontsize} +\DeclareStringOption[Pt.]{pointsname} +\DeclareStringOption[Exercise]{exercisename} +\DeclareStringOption[block]{exercisenameposition} +\DeclareStringOption[Solution]{solutionname} +\DeclareStringOption[block]{solutionnameposition} +\DeclareStringOption[Pt.]{totalpointsname} +\DeclareStringOption[round]{braces} +\DeclareBoolOption[false]{starpoints} +\ProcessKeyvalOptions{exercises} +\ifthenelse{\equal{\exercises@exercisenumberformat}{arabic}}% + {\newcommand{\exercises@formatnumbers}[1]{\arabic{#1}}}{}% +\ifthenelse{\equal{\exercises@exercisenumberformat}{roman}}% + {\newcommand{\exercises@formatnumbers}[1]{\roman{#1}}}{}% +\ifthenelse{\equal{\exercises@exercisenumberformat}{Roman}}% + {\newcommand{\exercises@formatnumbers}[1]{\Roman{#1}}}{}% +\ifthenelse{\equal{\exercises@exercisenumberformat}{alph}}% + {\newcommand{\exercises@formatnumbers}[1]{\alph{#1}}}{}% +\ifthenelse{\equal{\exercises@exercisenumberformat}{Alph}}% + {\newcommand{\exercises@formatnumbers}[1]{\Alph{#1}}}{}% +\ifthenelse{\not\equal{\exercises@exercisenumberformat}{arabic}% + \and \not\equal{\exercises@exercisenumberformat}{roman}% + \and \not\equal{\exercises@exercisenumberformat}{Roman}% + \and \not\equal{\exercises@exercisenumberformat}{alph}% + \and \not\equal{\exercises@exercisenumberformat}{Alph}}% + {\PackageError{exercises}% + {"\exercises@exercisenumberformat" ist als Option von "exercisenumberformat" nicht erlaubt. % + Stattdessen wurde "arabic" verwendet.}% + {"\exercises@exercisenumberformat" ist als Option von "exercisenumberformat" nicht erlaubt. % + Stattdessen wurde "arabic" verwendet.}% + \newcommand{\exercises@formatnumbers}[1]{\arabic{#1}}}{}% +\ifthenelse{\equal{\exercises@exercisenameposition}{block}}% + {\newcommand{\exercises@placeexercise}{\noindent\par\vspace{\exercises@blockspace}}}{}% +\ifthenelse{\equal{\exercises@exercisenameposition}{inline}}% + {\newcommand{\exercises@placeexercise}{\hspace{\exercises@inlinespace}}}{}% +\ifthenelse{\not\equal{\exercises@exercisenameposition}{block}% + \and \not\equal{\exercises@exercisenameposition}{inline}}% + {\PackageError{exercises}% + {"\exercises@exercisenameposition" ist als Option von "exercisenameposition" nicht erlaubt. % + Stattdessen wurde "block" verwendet.}% + {"\exercises@exercisenameposition" ist als Option von "exercisenameposition" nicht erlaubt. % + Stattdessen wurde "block" verwendet.} + \newcommand{\exercises@placeexercise}{\noindent\par\vspace{\exercises@blockspace}}}{}% +\ifthenelse{\equal{\exercises@solutionnameposition}{block}}% + {\newcommand{\exercises@placesolution}{\noindent\par\vspace{\exercises@blockspace}}}{}% +\ifthenelse{\equal{\exercises@solutionnameposition}{inline}}% + {\newcommand{\exercises@placesolution}{\hspace{\exercises@inlinespace}}}{}% +\ifthenelse{\not\equal{\exercises@solutionnameposition}{block}% + \and \not\equal{\exercises@solutionnameposition}{inline}}% + {\PackageError{exercises}% + {"\exercises@solutionnameposition" ist als Option von "solutionnameposition" nicht erlaubt. % + Stattdessen wurde "block" verwendet.}% + {"\exercises@solutionnameposition" ist als Option von "solutionnameposition" nicht erlaubt. % + Stattdessen wurde "block" verwendet.}% + \newcommand{\exercises@placesolution}{\noindent\par\vspace{\exercises@blockspace}}}{}% +\ifthenelse{\equal{\exercises@pointsposition}{aftername}}% + {\newcommand{\exercises@placepoints}[1]{ #1}}{}% +\ifthenelse{\equal{\exercises@pointsposition}{margin}}% + {\newcommand{\exercises@placepoints}[1]% + {\marginnote{#1}}}{}% +\ifthenelse{\not\equal{\exercises@pointsposition}{aftername}% + \and \not\equal{\exercises@pointsposition}{margin}}% + {\PackageError{exercises}% + {"\exercises@pointsposition" ist als Option von "pointsposition" nicht erlaubt. % + Stattdessen wurde "aftername" verwendet.}% + {"\exercises@pointsposition" ist als Option von "pointsposition" nicht erlaubt. % + Stattdessen wurde "aftername" verwendet.}% + \newcommand{\exercises@placepoints}[1]{ #1}}{}% + +\ifthenelse{\equal{\exercises@pointsfontsize}{normalsize}}% + {\newcommand{\exercises@formatpoints}[1]{\normalsize #1}}{}% +\ifthenelse{\equal{\exercises@pointsfontsize}{footnotesize}}% + {\newcommand{\exercises@formatpoints}[1]{\footnotesize #1 \normalsize}}{}% +%% +\ifthenelse{\not\equal{\exercises@pointsfontsize}{normalsize}% + \and \not\equal{\exercises@pointsfontsize}{footnotesize}}% + {\PackageError{exercises}% + {"\exercises@pointsfontsize" ist als Option von "pointsfontsize" nicht erlaubt. % + Stattdessen wurde "normalsize" verwendet.}% + {"\exercises@pointsfontsize" ist als Option von "pointsfontsize" nicht erlaubt. % + Stattdessen wurde "normalsize" verwendet.}% + \newcommand{\exercises@formatpoints}[1]{\normalsize #1}}{}% +\ifthenelse{\equal{\exercises@braces}{nobraces}}% + {\newcommand{\exercises@openbrace}{}% + \newcommand{\exercises@closebrace}{}}{}% +\ifthenelse{\equal{\exercises@braces}{round}}% + {\newcommand{\exercises@openbrace}{(}% + \newcommand{\exercises@closebrace}{)}}{}% +\ifthenelse{\equal{\exercises@braces}{square}}% + {\newcommand{\exercises@openbrace}{[}% + \newcommand{\exercises@closebrace}{]}}{}% +\ifthenelse{\not\equal{\exercises@braces}{nobraces}% + \and \not\equal{\exercises@braces}{round}% + \and \not\equal{\exercises@braces}{square}}% + {% + \PackageError{exercises}% + {"\exercises@braces" ist als Option von "braces" nicht erlaubt. % + Stattdessen wurde "round" verwendet.}% + {"\exercises@braces" ist als Option von "braces" nicht erlaubt. % + Stattdessen wurde "round" verwendet.}% + \newcommand{\exercises@openbrace}{(}% + \newcommand{\exercises@closebrace}{)}% + }{}% +\newcounter{exercises@totalpoints} +\setcounter{exercises@totalpoints}{0} +\newcounter{exercises@finaltotalpoints} +\newcounter{exercises@exercisenumber} +\setcounter{exercises@exercisenumber}{1} +\newcounter{exercises@solutionnumber} +\setcounter{exercises@solutionnumber}{1} +\newcounter{i} +\newlength{\exercises@parskipsave} +\DeclareDocumentEnvironment{exercise}{o}{% +\setlength{\exercises@parskipsave}{0cm} +\setlength{\exercises@parskipsave}{\parskip} +\setlength{\parskip}{0cm} + \vspace{\exercises@exercisespaceabove}% + \IfNoValueTF{#1}% + {\textbf{\exercises@exercisename\ \exercises@formatnumbers{exercises@exercisenumber}:}\exercises@placeexercise}% + {\addtocounter{exercises@totalpoints}{#1}% + \textbf{\exercises@exercisename\ \exercises@formatnumbers{exercises@exercisenumber}:}% + \ifthenelse{\boolean{exercises@starpoints}}% + {\exercises@placepoints{\exercises@openbrace% + \setcounter{i}{0}\whiledo{#1>\thei}{*\stepcounter{i}}% + \exercises@closebrace}}% + {\exercises@placepoints{\exercises@formatpoints{\exercises@openbrace#1 \exercises@pointsname\exercises@closebrace}}}\exercises@placeexercise% + }% +\setlength{\parskip}{\exercises@parskipsave}% +}{% +\setlength{\parskip}{0cm}% + \stepcounter{exercises@exercisenumber}% + \vspace{\exercises@exercisespacebelow}% +\setlength{\parskip}{\exercises@parskipsave}% +}% +\newcommand\totalpoints{\theexercises@finaltotalpoints\ \exercises@totalpointsname}% +\AtEndDocument{\immediate\write\@auxout% +{\string\setcounter{exercises@finaltotalpoints}{\theexercises@totalpoints}}}% +\DeclareDocumentEnvironment{solution}{o}{% +\setlength{\exercises@parskipsave}{0cm} +\setlength{\exercises@parskipsave}{\parskip} +\setlength{\parskip}{0cm} +\ifthenelse{\boolean{exercises@printsolution}}% +{\vspace{\exercises@solutionspaceabove}}{}% +\ifthenelse{\boolean{exercises@printsolution}}% + {\textbf{\exercises@solutionname\ \exercises@formatnumbers{exercises@solutionnumber}:\exercises@placesolution}}% + {\IfNoValueTF{#1}{}{\vspace{#1}}\comment}% +\setlength{\parskip}{\exercises@parskipsave}% +}% +{% +\setlength{\parskip}{0cm}% +\ifthenelse{\boolean{exercises@printsolution}}{\vspace{\exercises@solutionspacebelow}}% + {\endcomment}\stepcounter{exercises@solutionnumber}\setlength{\parskip}{\exercises@parskipsave}% +\setlength{\parskip}{\exercises@parskipsave}% +}% +\newcommand{\exercisenewpage}{\ifthenelse{\boolean{exercises@printsolution}}{}{\newpage}} +\newcommand{\solutionnewpage}{\ifthenelse{\boolean{exercises@printsolution}}{\newpage}{}} +\endinput +%% +%% End of file `exercises.sty'. |