% 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}\\[1.5ex] \sourceCodeWorksheetAuthors{Ignored Author}\\ \sourceCodeWorksheetCourseName{Ignored Header}\\[1.5ex] \sourceCodeBegin{document}... } \vfil \begin{center} \begin{minipage}[b]{\textwidth} \begin{minipage}[b]{0.5\textwidth} \noindent Content of "MySubDirectory/lv.tex":\par\addvspace{0.5\baselineskip}\noindent {\ttfamily\raggedright \aqua{\textbackslash def}\textbackslash coursename\{Example Header\}\\ \aqua{\textbackslash def}\textbackslash authors\{Example Author\}} \end{minipage}% \begin{minipage}[b]{0.5\textwidth} \noindent Also a german version of "MYSubDirectory/lv.tex" is possible:\par\addvspace{0.5\baselineskip}\noindent {\ttfamily\raggedright \aqua{\textbackslash def}\textbackslash lvname\{Example Header\}\\ \aqua{\textbackslash def}\textbackslash autoren\{Example Author\}} \end{minipage} \end{minipage} \end{center} % 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 Babel languages are: \begin{center} \textbf{english, french, 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\\ \sourceCodeWorksheetShowOccurrence\\[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 \worksheetShowOccurrence \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 macro functionality plus checking the selected language's support and changing the internal language if the selected language is supported. \end{document}