From 88d74b00581ca8f9710996fe8e3e9effd748a880 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 16 Aug 2018 20:50:02 +0000 Subject: worksheet (16aug18) git-svn-id: svn://tug.org/texlive/trunk@48416 c570f23f-e606-0410-a88d-b1316a301751 --- Master/texmf-dist/doc/latex/worksheet/README.md | 9 + .../texmf-dist/doc/latex/worksheet/worksheet.pdf | Bin 0 -> 95476 bytes .../texmf-dist/doc/latex/worksheet/worksheet.tex | 380 ++++++++++++++++++++ .../texmf-dist/tex/latex/worksheet/worksheet.sty | 397 +++++++++++++++++++++ Master/tlpkg/bin/tlpkg-ctan-check | 2 +- Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc | 1 + Master/tlpkg/tlpsrc/worksheet.tlpsrc | 0 7 files changed, 788 insertions(+), 1 deletion(-) create mode 100644 Master/texmf-dist/doc/latex/worksheet/README.md create mode 100644 Master/texmf-dist/doc/latex/worksheet/worksheet.pdf create mode 100644 Master/texmf-dist/doc/latex/worksheet/worksheet.tex create mode 100644 Master/texmf-dist/tex/latex/worksheet/worksheet.sty create mode 100644 Master/tlpkg/tlpsrc/worksheet.tlpsrc (limited to 'Master') diff --git a/Master/texmf-dist/doc/latex/worksheet/README.md b/Master/texmf-dist/doc/latex/worksheet/README.md new file mode 100644 index 00000000000..63adc78c8d3 --- /dev/null +++ b/Master/texmf-dist/doc/latex/worksheet/README.md @@ -0,0 +1,9 @@ +This package provides functions and an environment for easy worksheet creation: + use the exercise environment for formating exercises in a simple, efficient design; + make custom, automatically numbered worksheet titles likewise \LaTeX\ title functions; + provide course and author information with a scrlayer-scrpage based automated header; + conforming to different Babel Languages (At this time only English and German are supported.). + +This package is guaranteed to work with pdflatex and xelatex, only depending on scrlayer-scrpage. It is recommended to use xelatex including fontspec package and setting sans font to "Helvetica Neue" or "Raleway". + +Package worksheet by Benjamin Zöllner (c)2018. This work may be distributed and/or modified under the conditions of the LaTeX Project Public License (latest version). diff --git a/Master/texmf-dist/doc/latex/worksheet/worksheet.pdf b/Master/texmf-dist/doc/latex/worksheet/worksheet.pdf new file mode 100644 index 00000000000..17941d65772 Binary files /dev/null and b/Master/texmf-dist/doc/latex/worksheet/worksheet.pdf differ diff --git a/Master/texmf-dist/doc/latex/worksheet/worksheet.tex b/Master/texmf-dist/doc/latex/worksheet/worksheet.tex new file mode 100644 index 00000000000..eea382dd53d --- /dev/null +++ b/Master/texmf-dist/doc/latex/worksheet/worksheet.tex @@ -0,0 +1,380 @@ +% DocumentClass +\documentclass[12pt, a4paper, listof=flat]{scrartcl} + +% Languages +\usepackage[ngerman, english]{babel} + +% Graphic Inclusion +\usepackage{graphicx} + +% Colors +\usepackage{xcolor} + +% define Apple Colors +\newcommand*{\maraschino}[1]{\textcolor[RGB]{255, 38, 0}{#1}} +\newcommand*{\tangerine}[1]{\textcolor[RGB]{255, 147, 0}{#1}} +\newcommand*{\lemon}[1]{\textcolor[RGB]{255, 251, 0}{#1}} +\newcommand*{\lime}[1]{\textcolor[RGB]{142, 250, 0}{#1}} +\newcommand*{\spring}[1]{\textcolor[RGB]{0, 249, 0}{#1}} +\newcommand*{\seafoam}[1]{\textcolor[RGB]{0, 250, 146}{#1}} +\newcommand*{\turquoise}[1]{\textcolor[RGB]{0, 253, 255}{#1}} +\newcommand*{\aqua}[1]{\textcolor[RGB]{0, 150, 255}{#1}} +\newcommand*{\blueberry}[1]{\textcolor[RGB]{4, 52, 155}{#1}} +\newcommand*{\grape}[1]{\textcolor[RGB]{148, 55, 155}{#1}} +\newcommand*{\magenta}[1]{\textcolor[RGB]{255, 64, 255}{#1}} +\newcommand*{\strawberry}[1]{\textcolor[RGB]{255, 47, 146}{#1}} +\newcommand*{\gray}[1]{\textcolor[RGB]{127, 127, 127}{#1}} + +% Fonts +\usepackage{fontspec} +\setsansfont{Helvetica Neue} + +% worksheet +\usepackage{worksheet} + +% Filler Texts +\def\lipsum{Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dapibus faucibus orci vel commodo. Quisque tristique molestie dolor, eu euismod ligula malesuada ut.} +\def\exerciseFillerText{Following this, a certain exercise is described in a sentence. Maybe there is another sentence which is not enough, though. This last sentence should do.} + +% make MiniPage for Source Code +\def\sourceCodeMinipage#1{ +\begin{center} + \begin{minipage}{0.9\textwidth} + \ttfamily\raggedright + #1 + \end{minipage} +\end{center} +} + +% define Macros for formatted Source Code +\def\sourceCodeBegin#1{\aqua{\textbackslash begin}\{#1\}} +\def\sourceCodeEnd#1{\aqua{\textbackslash end}\{#1\}} +\def\sourceCodeBeginExercise{\aqua{\textbackslash begin}\{\tangerine{exercise}\}} +\def\sourceCodeEndExercise{\aqua{\textbackslash end}\{\tangerine{exercise}\}} +\def\sourceCodeScore#1{{\ttfamily\tangerine{\textbackslash score}\{#1\}}} +\def\sourceCodeLearningTargets#1{{\ttfamily\tangerine{\textbackslash learningtargets}\{#1\}}} +\def\sourceCodeEasy{{\ttfamily\tangerine{\textbackslash easy}}} +\def\sourceCodeMedium{{\ttfamily\tangerine{\textbackslash medium}}} +\def\sourceCodeHard{{\ttfamily\tangerine{\textbackslash hard}}} +\def\sourceCodeOccurrence#1{{\ttfamily\tangerine{\textbackslash occurrence}\{#1\}}} +\def\sourceCodeWorksheetTitle#1{{\ttfamily\tangerine{\textbackslash worksheetTitle}\{#1\}}} +\def\sourceCodeWorksheetSubTitle#1{{\ttfamily\tangerine{\textbackslash worksheetSubTitle}\{#1\}}} +\def\sourceCodeWorksheetMakeTitle{{\ttfamily\tangerine{\textbackslash worksheetMakeTitle}}} +\def\sourceCodeWorksheetShowFileName{{\ttfamily\tangerine{\textbackslash worksheetShowFileName}}} +\def\sourceCodeWorksheetShowScore{{\ttfamily\tangerine{\textbackslash worksheetShowScore}}} +\def\sourceCodeWorksheetShowLearningTargets{{\ttfamily\tangerine{\textbackslash worksheetShowLearningTargets}}} +\def\sourceCodeWorksheetShowDifficulty{{\ttfamily\tangerine{\textbackslash worksheetShowDifficulty}}} +\def\sourceCodeWorksheetShowOccurrence{{\ttfamily\tangerine{\textbackslash worksheetShowOccurrence}}} +\def\sourceCodeWorksheetHideFileName{{\ttfamily\tangerine{\textbackslash worksheetHideFileName}}} +\def\sourceCodeWorksheetHideScore{{\ttfamily\tangerine{\textbackslash worksheetHideScore}}} +\def\sourceCodeWorksheetHideLearningTargets{{\ttfamily\tangerine{\textbackslash worksheetHideLearningTargets}}} +\def\sourceCodeWorksheetHideDifficulty{{\ttfamily\tangerine{\textbackslash worksheetHideDifficulty}}} +\def\sourceCodeWorksheetHideOccurrence{{\ttfamily\tangerine{\textbackslash worksheetHideOccurrence}}} +\def\sourceCodeWorksheetHideHeader{{\ttfamily\tangerine{\textbackslash worksheetHideHeader}}} +\def\sourceCodeWorksheetAuthors#1{{\ttfamily\tangerine{\textbackslash worksheetAuthors}\{#1\}}} +\def\sourceCodeWorksheetCourseName#1{{\ttfamily\tangerine{\textbackslash worksheetCourseName}\{#1\}}} +\def\sourceCodeWorksheetChangelvFile#1{{\ttfamily\tangerine{\textbackslash worksheetChangelvFile}\{#1\}}} +\def\sourceCodeWorksheetNoSFFamilyInHeader{{\ttfamily\tangerine{\textbackslash worksheetNoSFFamilyInHeader}}} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Document + +% Source Code copied from precompiled PDF - Header - Example +% Begin +\worksheetChangelvFile{./MySubDirectory/lv.tex} +\worksheetAuthors{Ignored Author} +\worksheetCourseName{Ignored Header} +% End + +\begin{document} + +% hide Header +\pagestyle{plain} + +% prevent overfull hboxes +\emergencystretch 2em + +% Title Page +\begin{titlepage} + \sffamily + \begin{figure}[t] + \centering + \includegraphics[width=0.8\textwidth]{./HS-Osna-Logo.png} + \end{figure} + + \begin{center} + ~\\[6ex] + \large{Faculty\\Engineering and Computer Science}\\[10ex] + {\Huge{\textbf{Package Documentation}}}\\[10ex] + \sffamily\huge{Worksheet}\rmfamily\\[10ex] + \end{center} + + \begin{center} + \begin{minipage}{0.4\textwidth} + \begin{tabbing} + \hspace*{5cm}\=\kill + Author:\>Benjamin Z\"{o}llner\\ + \>\footnotesize(Benjamin.Zoellner@posteo.de)\\[1ex]\normalsize + Professor:\>Prof. Dr. Markus Schmidt-Gröttrup\\[1ex] + Release:\>\today + \end{tabbing} + \end{minipage} + \end{center} +\end{titlepage} + +% Abstract +\newpage\section*{Abstract} +\input{README.md}\par\addvspace{\topsep}\noindent +Every ellipsis ({\ttfamily ...}) in the following examples can be replaced with a string or text of any length. + +\newpage\tableofcontents + +% Exercise Environment +\newpage\section{Exercise Environment} +An exercise containing minimal information is simply made with: + +\sourceCodeMinipage{ + \sourceCodeBeginExercise\\ + ...\\ + \sourceCodeEndExercise +} + +\noindent In the optional argument of exercise, information "Score", "Learning Targets", "Occurrence" and "Difficulty" can be set independently of each other with: + +\begin{center} + \sourceCodeScore{...}, \sourceCodeLearningTargets{...}, \sourceCodeOccurrence{...} and\newline + \sourceCodeEasy{}, \sourceCodeMedium{} or \sourceCodeHard{} +\end{center} + +% Exercise optional Argument Syntax +\subsection*{Syntax} +Placing a command to set specific exercise information outside of the optional argument of exercise will cause it \emph{to do nothing}. Replace ellipses ({\ttfamily ...}) at will, but even though whitespaces will be ignored, do not add any characters to the optional argument of exercise, \textbf{especially do not add any new-line characters or {\ttfamily\textbackslash par} macros at all costs}. + +\sourceCodeMinipage{ + \sourceCodeBeginExercise[\sourceCodeScore{...}\sourceCodeLearningTargets{...}\sourceCodeEasy]\\ + ...\\ + \sourceCodeEndExercise\\ + or\\ + \sourceCodeBeginExercise[\sourceCodeScore{...}\sourceCodeLearningTargets{...}\sourceCodeMedium]\\ + ...\\ + \sourceCodeEndExercise\\ + or\\ + \sourceCodeBeginExercise[\sourceCodeScore{...}\sourceCodeLearningTargets{...}\sourceCodeHard]\\ + ...\\ + \sourceCodeEndExercise +} +\par\addvspace{\topsep}\noindent + +\noindent Detailed information of an exercise is only shown, if \emph{detailed information is available} and \emph{specific flags are set}. The flags are by default not set. To set these flags use: + +\sourceCodeMinipage{ + \sourceCodeWorksheetShowFileName\\ + \sourceCodeWorksheetShowScore\\ + \sourceCodeWorksheetShowLearningTargets\\ + \sourceCodeWorksheetShowDifficulty +} + +\noindent Deleting these flags is achieved with: +\sourceCodeMinipage{ + \sourceCodeWorksheetHideFileName\\ + \sourceCodeWorksheetHideScore\\ + \sourceCodeWorksheetHideLearningTargets\\ + \sourceCodeWorksheetHideDifficulty +} + +% Exercise Example +\subsection*{Example:} +Including following source code in 4 different *.tex files using {\ttfamily\aqua{\textbackslash input}\{...\}}:\par + +% Show Source Code for both precompiled and finished PDF +\noindent "file1.tex" +\sourceCodeMinipage{ + \sourceCodeWorksheetShowScore\\[1ex] + \sourceCodeBeginExercise[\sourceCodeScore{10}\sourceCodeEasy]\\ + This exercise has a maximum score of 10 and easy difficulty level. \exerciseFillerText\\ + \sourceCodeEndExercise\\[1ex] + \sourceCodeWorksheetShowFileName\\ + \sourceCodeWorksheetShowLearningTargets\\ + \sourceCodeWorksheetShowDifficulty\\ + \sourceCodeWorksheetShowOccurrence +} + +\noindent "file2.tex" +\sourceCodeMinipage{ + \sourceCodeBeginExercise[\sourceCodeLearningTargets{1, 2, 3}\sourceCodeMedium]\\ + This exercise satisfies learning targets one, two, three and has medium difficulty level. \exerciseFillerText\\ + \sourceCodeEndExercise +} + +\noindent "file3.tex" +\sourceCodeMinipage{ + \sourceCodeBeginExercise[\sourceCodeOccurrence{Exam WS 2018}\sourceCodeScore{20}]\\ + This exercise was in an exam in winter semester in 2018, satisfies learning targets 4,5 and has a maximum score of 10 and hard difficulty level. \exerciseFillerText\\ + \sourceCodeEndExercise\\[1ex] + \sourceCodeWorksheetHideFileName +} + +\noindent "file4.tex" +\sourceCodeMinipage{ + \sourceCodeBeginExercise[\sourceCodeScore{30}]\\ + This exercise has a maximum score of 30. \exerciseFillerText\\ + \sourceCodeEndExercise +} + +\pagebreak + +\noindent lead to: + +% Source Code copied from precompiled PDF into 4 Files: +% Begin +\input{file1.tex} +\input{file2.tex} +\input{file3.tex} +\input{file4.tex} +% End + +% Worksheet Title +\newpage\section{Worksheet Title} +Both, title and subtitle, can be set with: +\begin{center} + \sourceCodeWorksheetTitle{...} and \sourceCodeWorksheetSubTitle{...} +\end{center} +The title itself is then displayed with \sourceCodeWorksheetMakeTitle. + +% Worksheet Title Example +\subsection*{Example:} +Assuming this document's file name would be "\jobname.tex", using this source code +\sourceCodeMinipage{ + \sourceCodeWorksheetTitle{My Title}\\ + \sourceCodeWorksheetSubTitle{My Subtitle}\\[2ex] + \sourceCodeWorksheetMakeTitle\\[2ex] + \aqua{\textbackslash noindent} \lipsum% +} +lead to following title: + +% Source Code copied from precompiled PDF: +% Begin +\worksheetTitle{My Title} +\worksheetSubTitle{My Subtitle} + +\worksheetMakeTitle +% End + +\noindent Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam dapibus faucibus orci vel commodo. Quisque tristique molestie dolor, eu euismod ligula malesuada ut. + +% Header +\newpage\thispagestyle{headings}\section{Header} +Header information can be set with: +\begin{center} +\sourceCodeWorksheetAuthors{...} and \sourceCodeWorksheetCourseName{...} +\end{center} +The authors are always placed on the inner side, while the course name is always placed on the outer side. In one-sided documents this would result in placing course name on the page's left side and authors on the page's right side. The default header of "scrlayer-scrpage" package is redefined (plus the default pagestyle is set to "headings") only, if at least authors or at least course name was set before.\par +The package worksheet automatically tries to include "./lv.tex" which should define {\ttfamily\textbackslash coursename} and {\ttfamily\textbackslash authors} which are automatically associated as header information. Change the try-to-include file with: \sourceCodeWorksheetChangelvFile{...}.\par +If a KOMA document class is selected, worksheet automatically sets the header font family to "Sans Serif". Suppress this behaviour with: \sourceCodeWorksheetNoSFFamilyInHeader.\par +See \emph{\ref{cap:dependencies:scrlayerscrpage} Dependencies - scrlayer-scrpage} for further information about controlling presence of the header. + +% Header Examples +\subsection*{Examples:} +Results of following examples are shown in this page's header. All examples lead to the exact same header. + +% First Header Example +\subsubsection*{1. Example} +Setting header information manually ("lv.tex" does not exist): +\sourceCodeMinipage{ + \sourceCodeWorksheetAuthors{Example Author}\\ + \sourceCodeWorksheetCourseName{Example Header}\\[2ex] + \sourceCodeBegin{document}... +} + +% Second Header Example +\subsubsection*{2. Example} +Changing the directory path of "lv.tex" ("lv.tex" does exist in "./MySubDirectory/"): +\sourceCodeMinipage{ + \sourceCodeWorksheetChangelvFile{./MySubDirectory/lv.tex}\\[2ex] + \sourceCodeWorksheetAuthors{Ignored Author}\\ + \sourceCodeWorksheetCourseName{Ignored Header}\\[2ex] + \sourceCodeBegin{document}... +} + +\noindent Content of "MySubDirectory/lv.tex": +\sourceCodeMinipage{ + \aqua{\textbackslash def}\textbackslash coursename\{Example Header\}\\ + \aqua{\textbackslash def}\textbackslash authors\{Example Author\} +} + +Also a german version of "MYSubDirectory/lv.tex" is possible: +\sourceCodeMinipage{ + \aqua{\textbackslash def}\textbackslash lvname\{Example Header\}\\ + \aqua{\textbackslash def}\textbackslash autoren\{Example Author\} +} + +% play it safe to display Example Header on both Pages, if this Section is 2 Pages long +\thispagestyle{headings} + +% Babel Languages +\newpage\section{Conforming to Babel Languages} +This package automatically changes its appearance to a specific language, after a specific language is selected with {\ttfamily\textbackslash selectlanguage\{...\}}. Supported languages are: +\begin{center} +\textbf{english, german and ngerman} +\end{center} + +% Babel Languages Example +\subsection*{Example:} +Defining two different exercises in two different languages: + +% Show Source Code for both precompiled and finished PDF +\sourceCodeMinipage{ + \sourceCodeWorksheetShowScore\\ + \sourceCodeWorksheetShowLearningTargets\\ + \sourceCodeWorksheetShowDifficulty\\[1ex] + \sourceCodeBeginExercise\spring{\%}\\{} + {\small[\sourceCodeScore{10}\sourceCodeEasy\sourceCodeLearningTargets{1, 2, 3}\sourceCodeOccurrence{Exam WS 2018}]}\\ + This is an exercise written in english and described in a sentence. Maybe there is another sentence which is not enough though. This last sentence should do.\\ + \sourceCodeEndExercise\\[1ex] + \aqua{\textbackslash selectlanguage}\{ngerman\}\\[1ex] + \sourceCodeBeginExercise\spring{\%}\\{} + {\small[\sourceCodeScore{10}\sourceCodeEasy\sourceCodeLearningTargets{1, 2, 3}\sourceCodeOccurrence{Klausur WS 2018}]}\\ + Dies ist eine in deutsch verfasste Aufgabe, die mit einem Satz beschrieben wird. Vermutlich reicht dieser eine Satz jedoch nicht aus. Dieser letzte Satz sollte ausreichen.\\ + \sourceCodeEndExercise\\[1ex] +} + +\noindent lead to: + +% Source Code copied from precompiled PDF: +% Begin +\worksheetShowScore +\worksheetShowLearningTargets +\worksheetShowDifficulty +\begin{exercise}% +[\score{10}\easy\learningtargets{1, 2, 3}\occurrence{Exam WS 2018}] This is an exercise written in english and described in a sentence. Maybe there is another sentence which is not enough though. This last sentence should do. +\end{exercise} +\selectlanguage{ngerman} +\begin{exercise}% +[\score{10}\easy\learningtargets{1, 2, 3}\occurrence{Klausur WS 2018}] Dies ist eine in deutsch verfasste Aufgabe, die mit einem Satz beschrieben wird. Vermutlich reicht dieser eine Satz jedoch nicht aus. Dieser letzte Satz sollte ausreichen. +\end{exercise} +% End + +% setting Language back to English +\selectlanguage{english} + +% Dependencies +\newpage\section{Dependencies} +All dependencies are listed in this Section. Compiling this package with \emph{pdflatex} and \emph{xelatex} is guaranteed. + +% Dependencies +\subsection*{scrlayer-scrpage}\label{cap:dependencies:scrlayerscrpage} +The Package worksheet uses \emph{scrlayer-scrpage} to control header. Use +\begin{center} + {\ttfamily\textbackslash pagestyle\{plain\}} or {\ttfamily\textbackslash thispagestyle\{plain\}} +\end{center} +to hide and +\begin{center} + {\ttfamily\textbackslash pagestyle\{headings\}} or {\ttfamily\textbackslash thispagestyle\{headings\}} +\end{center} +to show worksheet header. Per default \emph{scrlayer-scrpage's} header is redefined and -- per default -- pagestyle "headings" is selected; suppress all this behaviour by calling \sourceCodeWorksheetHideHeader{} \textbf{before} {\ttfamily\aqua{\textbackslash begin}\{document\}}.\par + +\subsection*{Babel} +The package worksheet redefines {\ttfamily\textbackslash selectlanguage\{...\}} keeping the original functionality plus checking the selected language's support and changing the internal language if the selected language is supported. + +\end{document} diff --git a/Master/texmf-dist/tex/latex/worksheet/worksheet.sty b/Master/texmf-dist/tex/latex/worksheet/worksheet.sty new file mode 100644 index 00000000000..b2c8e2fe04c --- /dev/null +++ b/Master/texmf-dist/tex/latex/worksheet/worksheet.sty @@ -0,0 +1,397 @@ +%------------------------------------------------------------------------------------------------------------% +% Package worksheet by Benjamin Zöllner (c)2018 % +% % +% This work may be distributed and/or modified under the % +% conditions of the LaTeX Project Public License (latest version). % +%------------------------------------------------------------------------------------------------------------% + +\NeedsTeXFormat{LaTeX2e}[2018] +\ProvidesPackage{worksheet}[2018/08/08 by Benjamin Zoellner (c)2018 v1.0 This Package provides functions and an environment for easy worksheet creation] + +\PassOptionsToPackage{headsepline=1pt}{scrlayer-scrpage} +\RequirePackage{scrlayer-scrpage} + +% BEWARE! +% DO NOT CHANGE THE FORMATTING OF FOLLOWING CODE! DO NOT DELETE EMPTY COMMENTS! + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Extraxt Number From \jobname + +% Bools for Number Detection +\newcounter{@worksheet@numberFound} +\newcounter{@worksheet@numberEnded} + +% evil String Search Hacking using Latex-Kernel Functions \in@ & \ifin@ +\def\@worksheet@isInString#1#2{TT\fi\begingroup % What the f**k?! +\edef\x{\endgroup\noexpand\in@{#1}{#2}}\x\ifin@} + +% Character-wise expanding Macro Loop for extracting containing Numbers leaving leading Zeroes +% if a single Character #1 is a natural Number less than 10, a containing Number is found +% @worksheet@numberFound will be set +% #1 will be displayed +% every following natural Number less than 10 including 0 will be displayed until #1 is a Character other than +% a natural Number less than 10 or 0 +% @worksheet@numberEnded will be set when #1 is not a number +\def\@worksheet@loopElementsExtractNumber#1{% + \ifx\relax#1\else + \ifnum\value{@worksheet@numberEnded}=0 + \ifnum\value{@worksheet@numberFound}=0 + \if\@worksheet@isInString{#1}{123456789}#1\setcounter{@worksheet@numberFound}{1}\fi + \else + \if\@worksheet@isInString{#1}{0123456789}#1\else\setcounter{@worksheet@numberEnded}{1}\fi + \fi + \fi + \expandafter\@worksheet@loopElementsExtractNumber% + \fi +} + +% expand Loop and extract a containing Number +\def\@worksheet@expandNumberExtractingLoop#1{\setcounter{@worksheet@numberFound}{0}\setcounter{@worksheet@numberEnded}{0}\@worksheet@loopElementsExtractNumber#1\relax} + +% expand \jobname +\edef\@worksheet@expandjobname{\jobname} + +% accurate Loop Command Expansion +\def\@worksheet@numberInFileName{\expandafter\@worksheet@expandNumberExtractingLoop\expandafter{\@worksheet@expandjobname}} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Language Selection + +% Babel conforming Macros +\def\@worksheet@selectLanguage@english{ + \xdef\@worksheet@languageSelection@exercise{Exercise} + \xdef\@worksheet@languageSelection@score{Maximum Score} + \xdef\@worksheet@languageSelection@learningTargets{Learning Targets} + \xdef\@worksheet@languageSelection@difficulty{Difficulty Level} + \xdef\@worksheet@languageSelection@easy{Easy} + \xdef\@worksheet@languageSelection@medium{Medium} + \xdef\@worksheet@languageSelection@hard{Hard} +} +\def\@worksheet@selectLanguage@german{ + \xdef\@worksheet@languageSelection@exercise{Aufgabe} + \xdef\@worksheet@languageSelection@score{Punkte} + \xdef\@worksheet@languageSelection@learningTargets{Lernziele} + \xdef\@worksheet@languageSelection@difficulty{Schwierigkeitsgrad} + \xdef\@worksheet@languageSelection@easy{Leicht} + \xdef\@worksheet@languageSelection@medium{Mittel} + \xdef\@worksheet@languageSelection@hard{Schwer} +} +\def\@worksheet@selectLanguage@ngerman{\@worksheet@selectLanguage@german} + +% call Babel conforming Macro if defined +\def\@worksheet@checkLanguage{ + \expandafter\ifdefined\csname @worksheet@selectLanguage@\languagename\endcsname + \csname @worksheet@selectLanguage@\languagename\endcsname + \fi +} + +% Macros to call at \begin{document} +\def\@worksheet@languageSelection@beginDocument{ + \let\@worksheet@originalselectlanguage\selectlanguage + \def\selectlanguage##1{\@worksheet@originalselectlanguage{##1}\@worksheet@checkLanguage} + + \@worksheet@checkLanguage +} + +% select default Language +\@worksheet@selectLanguage@english + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Title of worksheet + +% worksheet internal Title & Subtitle +\def\@worksheet@title{} +\def\@worksheet@subTitle{} + +% set worksheet internal Title & Subtitle by redifining +\def\worksheetTitle#1{\edef\@worksheet@title{#1}} +\def\worksheetSubTitle#1{\edef\@worksheet@subTitle{#1}} + +% general Title Command +\def\worksheetMakeTitle{ + \ifx\relax\@worksheet@title\relax\else% + \begin{center} + \textbf{\sffamily\huge\@worksheet@title~\@worksheet@numberInFileName\nopagebreak}% + \ifx\relax\@worksheet@subTitle\relax\else% + \nopagebreak\par\addvspace{\topsep}{\sffamily\LARGE\@worksheet@subTitle} + \fi + \end{center} + \nopagebreak\par\addvspace{\topsep} + \fi +} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Directory File Name Extraction for temporary defining \@worksheet@currentFileName + +% seperate Name and Extension and leave Extension out +\def\@worksheet@omitFileExtension#1.#2\@nil{#1} + +% loop through Directory Elements and seperate Extension from last Element +\def\@worksheet@loopDirectoryElementsExtractName#1/#2/#3\@nil{\ifx\relax#2\relax\expandafter\@worksheet@omitFileExtension#1.\@nil\else\expandafter\@worksheet@loopDirectoryElementsExtractName#2/#3/\@nil\fi} + +% accurate Loop Command Expansion +\def\@worksheet@ExtractFileName#1{\expandafter\@worksheet@loopDirectoryElementsExtractName#1//\@nil} + +% define empty current File Name +\def\@worksheet@currentFileName{} + +% redefining \@iinput using original \@iinput +\let\@worksheet@original@iinput\@iinput +\def\@iinput#1{\edef\@worksheet@currentFileName{\@worksheet@ExtractFileName{#1}}\@worksheet@original@iinput{#1}\def\@worksheet@currentFileName{}} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Environment Exercise + +% Counter for Number of Exercises +\newcounter{@worksheet@numberOfExercises} + +% Control Flags +\newcounter{@worksheet@showFileNameFlag} +\newcounter{@worksheet@showScoreFlag} +\newcounter{@worksheet@showLearningTargetsFlag} +\newcounter{@worksheet@showDifficultyFlag} +\newcounter{@worksheet@showOccurrenceFlag} + +% Commands: set and unset Flags +\def\worksheetShowFileName{\setcounter{@worksheet@showFileNameFlag}{1}} +\def\worksheetHideFileName{\setcounter{@worksheet@showFileNameFlag}{0}} +\def\worksheetShowScore{\setcounter{@worksheet@showScoreFlag}{1}} +\def\worksheetHideScore{\setcounter{@worksheet@showScoreFlag}{0}} +\def\worksheetShowLearningTargets{\setcounter{@worksheet@showLearningTargetsFlag}{1}} +\def\worksheetHideLearningTargets{\setcounter{@worksheet@showLearningTargetsFlag}{0}} +\def\worksheetShowDifficulty{\setcounter{@worksheet@showDifficultyFlag}{1}} +\def\worksheetHideDifficulty{\setcounter{@worksheet@showDifficultyFlag}{0}} +\def\worksheetShowOccurrence{\setcounter{@worksheet@showOccurrenceFlag}{1}} +\def\worksheetHideOccurrence{\setcounter{@worksheet@showOccurrenceFlag}{0}} + +% Commands: set local Attributes of Exercise +\def\score#1{% + \ignorespaces% + \ifdefined\@worksheet@localExerciseGroup% + \if\relax#1\relax\else% + \edef\@worksheet@localScore{#1}% + \fi% + \fi% + \ignorespaces% +} +\def\learningtargets#1{% + \ignorespaces% + \ifdefined\@worksheet@localExerciseGroup% + \if\relax#1\relax\else% + \edef\@worksheet@localLearningTargets{#1}% + \fi% + \fi% + \ignorespaces% +} +\def\easy{% + \ignorespaces% + \ifdefined\@worksheet@localExerciseGroup% + \edef\@worksheet@localDifficulty{\@worksheet@languageSelection@easy}% + \fi% + \ignorespaces% +} +\def\medium{% + \ignorespaces% + \ifdefined\@worksheet@localExerciseGroup% + \edef\@worksheet@localDifficulty{\@worksheet@languageSelection@medium}% + \fi% + \ignorespaces% +} +\def\hard{% + \ignorespaces% + \ifdefined\@worksheet@localExerciseGroup% + \edef\@worksheet@localDifficulty{\@worksheet@languageSelection@hard}% + \fi% + \ignorespaces% +} + +% Commands: set global self emptying Attributes of Exercise +\def\@worksheet@occurence{} +\def\occurrence#1{% + \ignorespaces% + \ifdefined\@worksheet@localExerciseGroup% + \if\relax#1\relax\else% + \xdef\@worksheet@occurence{#1}% + \fi% + \fi% + \ignorespaces% +} + +% Exercise +\newenvironment{exercise}[1][]{ + + % increase @worksheet@numberOfExercises + \stepcounter{@worksheet@numberOfExercises} + + \begingroup\def\@worksheet@localExerciseGroup{} + \sffamily + % prevent other Text Sizes than normal, new Paragraph, make chaptersized vertical Space + \normalsize\par\addvspace{\topsep}% + + % make Aufgabe Title preventing Indents and ignoring Spaces + \noindent\ignorespaces\textbf{\@worksheet@languageSelection@exercise~\the@worksheet@numberOfExercises}% + % call Commands in optional Argument which define \@worksheet@localScore, \@worksheet@localLearningTargets and \@worksheet@localDifficulty locally within this group + #1% + % check if Score should be shown and if Score have been set + % show footnotesized raggedleft Score + \ifnum\value{@worksheet@showScoreFlag}=0\else + \ifdefined\@worksheet@localScore + {\hfill\footnotesize\@worksheet@languageSelection@score:~\@worksheet@localScore} + \fi + \fi + + % check if Difficulty should be shown and if Difficulty have been set + % show footnotesized natural Difficulty + % prevent Pagebreaks, Indents and Spaces + \ifnum\value{@worksheet@showDifficultyFlag}=0\else + \ifdefined\@worksheet@localDifficulty + \nopagebreak\par\noindent\ignorespaces + {\footnotesize\@worksheet@languageSelection@difficulty:~\@worksheet@localDifficulty% + \ifnum\value{@worksheet@showLearningTargetsFlag}=0\else% + \ifdefined\@worksheet@localLearningTargets% + ,% + \fi% + \fi% + }% + \fi% + \fi% + % + % check if Learning Targets should be shown and if Learning Targets have been set + % show footnotesized raggedleft Learning Targets + % prevent Pagebreaks, Indents and Spaces + \ifnum\value{@worksheet@showLearningTargetsFlag}=0\else% + \ifdefined\@worksheet@localLearningTargets% + \ifnum\value{@worksheet@showDifficultyFlag}=0% + \nopagebreak\par\noindent\ignorespaces% + \else% + \ifdefined\@worksheet@localDifficulty\else% + \nopagebreak\par\noindent\ignorespaces% + \fi% + \fi% + {\footnotesize\hfill\@worksheet@languageSelection@learningTargets:~\@worksheet@localLearningTargets} + \fi + \fi + + \endgroup + + % prevent Pagebreaks, Indents and Spaces + \nopagebreak\par\noindent\ignorespaces +}{ + % check if File Name should be shown and if \@worksheet@currentFilename is not empty + % prevent Pagebreaks, Indents and Spaces + % show tinyed non-empty \@worksheet@currentFileName + \ifnum\value{@worksheet@showFileNameFlag}=0\else + \if\@worksheet@currentFileName\relax\relax\else + \nopagebreak\par\noindent\ignorespaces + {\scriptsize\sffamily[\@worksheet@currentFileName]}% + \fi% + \fi% + % + % check if Occurrence should be shown and if \@worksheet@occurence is not empty + % prevent Pagebreaks, Indents and Spaces + % show tinyed non-empty \@worksheet@occurence + \ifnum\value{@worksheet@showOccurrenceFlag}=0\else% + \if\@worksheet@occurence\relax\relax\else% + \ifnum\value{@worksheet@showFileNameFlag}=0% + \nopagebreak\par\noindent\ignorespaces% + \else% + \if\@worksheet@currentFileName\relax\relax% + \nopagebreak\par\noindent\ignorespaces% + \fi% + \fi% + {\scriptsize\sffamily\hfill[\@worksheet@occurence]} + \fi + \fi + \gdef\@worksheet@occurence{} + + \par\addvspace{\topsep}% +} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% Header + +% Header Flags +\newcounter{@worksheet@hideHeader} +\newcounter{@worksheet@noSFFamilyInHeader} + +% prevent Header +\def\worksheetHideHeader{\setcounter{@worksheet@hideHeader}{1}} +\def\worksheetNoSFFamilyInHeader{\setcounter{@worksheet@noSFFamilyInHeader}{1}} + +% lv-File which should be loaded +\edef\@worksheet@lvFile{./lv.tex} + +% change lv-File Name and Path +\def\worksheetChangelvFile#1{\edef\@worksheet@lvFile{#1}} + +% define Header Information +% only if not empty +\def\worksheetAuthors#1{\if\relax#1\relax\else\xdef\@worksheet@authors{#1}\fi} +\def\worksheetCourseName#1{\if\relax#1\relax\else\xdef\@worksheet@course{#1}\fi} + +% formatting of worksheet Header +%\def\@worksheet@head#1#2{\vbox{\sffamily\small#1\hfill #2\par\vspace{3pt}\hrule}} + +% make Header +% make Header \sffamily if Document Class is KOMA +\def\@worksheet@makeHead#1#2{ + \clearpairofpagestyles + \cfoot*{\pagemark} + \@ifundefined{KOMAClassName}{% + \ihead{#1} + \ohead{#2} + }{% + \ihead{\ifnum\value{@worksheet@hideHeader}=0\sffamily\fi#1} + \ohead{\ifnum\value{@worksheet@hideHeader}=0\sffamily\fi#2} + } + \pagestyle{headings} +} + +% Macros to call at \begin{document} +\def\@worksheet@header@beginDocument{ + % default Pagestyle + \pagestyle{plain} + + % load \@worksheet@lvFile ("./lv.tex" by default) if existing + \begingroup + \IfFileExists{\@worksheet@lvFile}{ + \input{\@worksheet@lvFile} + \ifdefined\coursename\if\relax\coursename\relax\else\worksheetCourseName{\coursename}\fi\fi + \ifdefined\authors\if\relax\authors\relax\else\worksheetAuthors{\authors}\fi\fi + \ifdefined\lvname\if\relax\lvname\relax\else\worksheetCourseName{\lvname}\fi\fi + \ifdefined\autoren\if\relax\autoren\relax\else\worksheetAuthors{\autoren}\fi\fi + }{} + \endgroup + + % make Header at Begin of Document if \@worksheet@authors or \@worksheet@course is defined + \ifnum\value{@worksheet@hideHeader}=0 + \ifdefined\@worksheet@authors + \ifdefined\@worksheet@course + \@worksheet@makeHead{\@worksheet@course}{\@worksheet@authors} + \else + \@worksheet@makeHead{}{\@worksheet@authors} + \fi + \else + \ifdefined\@worksheet@course + \@worksheet@makeHead{\@worksheet@course}{} + \fi + \fi + \fi + \def\@worksheet@header@beginDocument{} +} + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +% At Document Begin + +\AtBeginDocument{ + \@worksheet@header@beginDocument + \@worksheet@languageSelection@beginDocument +} + +\endinput diff --git a/Master/tlpkg/bin/tlpkg-ctan-check b/Master/tlpkg/bin/tlpkg-ctan-check index cfbaa7cd9e8..9ca7d959996 100755 --- a/Master/tlpkg/bin/tlpkg-ctan-check +++ b/Master/tlpkg/bin/tlpkg-ctan-check @@ -695,7 +695,7 @@ my @TLP_working = qw( wadalab wallcalendar wallpaper warning warpcol was wasy wasy2-ps wasysym webguide widetable williams withargs witharrows - wnri wnri-latex wordcount wordlike + wnri wnri-latex wordcount wordlike worksheet wrapfig wsemclassic wsuipa wtref xargs xassoccnt xbmks xcharter xcite xcjk2uni xcntperchap xcolor xcolor-material xcolor-solarized diff --git a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc index d9607bf5a60..91970e96b57 100644 --- a/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc +++ b/Master/tlpkg/tlpsrc/collection-latexextra.tlpsrc @@ -1169,6 +1169,7 @@ depend williams depend withargs depend wordcount depend wordlike +depend worksheet depend wrapfig depend wtref depend xargs diff --git a/Master/tlpkg/tlpsrc/worksheet.tlpsrc b/Master/tlpkg/tlpsrc/worksheet.tlpsrc new file mode 100644 index 00000000000..e69de29bb2d -- cgit v1.2.3