diff options
author | Norbert Preining <norbert@preining.info> | 2021-06-27 03:01:41 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2021-06-27 03:01:41 +0000 |
commit | a090105758cdab68b58246a8aea7cb79dc168501 (patch) | |
tree | 367d8c9718710cbba51d660b61273b20fb056080 /macros/latex/contrib/thorshammer/system-scripts | |
parent | 3d1055e1e00548f29b9d4ba0a79c717b9b6b2ae3 (diff) |
CTAN sync 202106270301
Diffstat (limited to 'macros/latex/contrib/thorshammer/system-scripts')
4 files changed, 225 insertions, 15 deletions
diff --git a/macros/latex/contrib/thorshammer/system-scripts/standalone/00-class.cfg b/macros/latex/contrib/thorshammer/system-scripts/standalone/00-class.cfg new file mode 100644 index 0000000000..fda6a2efa1 --- /dev/null +++ b/macros/latex/contrib/thorshammer/system-scripts/standalone/00-class.cfg @@ -0,0 +1,4 @@ +\classMember{Muehle}{Waeter}{MW634B/_Thor} +\classMember{Anton}{Mueller}{AM256M/_Thor} +\classMember{Laura}{Voegt}{LM356B/_Thor} + diff --git a/macros/latex/contrib/thorshammer/system-scripts/standalone/csvTOcfg.ps1 b/macros/latex/contrib/thorshammer/system-scripts/standalone/csvTOcfg.ps1 new file mode 100644 index 0000000000..87cda66f1a --- /dev/null +++ b/macros/latex/contrib/thorshammer/system-scripts/standalone/csvTOcfg.ps1 @@ -0,0 +1,67 @@ +# Make a complete cfg for thorshammer package from a csv list +# accepted list delimiters: , or ;. Spaces ar not allowed! Replace all german umlauts +# with ue, oe, ae, ss to avoid problems with thorshammer package +# +# Example list: +# First Name|Last Name|Folder +# Anton;Müller;AM29914M +#\classMember{Anton}{Mueller}{AM299/instructor-name} +# Anton;Müller;*C:/.../AM299 +#\classMember{Anton}{Mueller}*{C:/.../AM299/instructor-name} +# +If ( $args.Length -eq 0 ) { + Write-Host "A CSV file of the class members is required," ` + "see documentation" + exit +} else { + $listName=$args[0] + if(Test-Path -Path ./$listName.csv) { + } else { + Write-Host "Cannot find the file `"$listName.csv`" in the current folder," ` + "check the spelling, do not include the extension." + exit + } +} +get-content "$listName.csv" | foreach { +"\classMember{" + $_ ` ++ "/_Thor}" ` +-Replace ";", "}{" ` +-Replace ",","}{" ` +-Replace "{\*", "*{" } | Set-Content "convertedList.cfg" + +# Store convertedList.cfg in a variable +$convertedListCfg = get-content .\convertedList.cfg -Raw + +# function to replace umlauts +# https://www.datenteiler.de/powershell-umlaute-ersetzen/ +function Replace-Umlaute ([string]$s) { + $UmlautObject = New-Object PSObject | Add-Member -MemberType NoteProperty -Name Name -Value $s -PassThru + + # hash tables are by default case insensitive + # we have to create a new hash table object for case sensitivity + + $characterMap = New-Object system.collections.hashtable + $characterMap.ä = "ae" + $characterMap.ö = "oe" + $characterMap.ü = "ue" + $characterMap.ß = "ss" + $characterMap.Ä = "Ae" + $characterMap.Ü = "Ue" + $characterMap.Ö = "Oe" + + foreach ($property in "Name") { + foreach ($key in $characterMap.Keys) { + $UmlautObject.$property = $UmlautObject.$property -creplace $key,$characterMap[$key] + } + } + $UmlautObject +} + +# replace umlauts in .cfg and make a correctedListCfg +$correctedListCfg = Replace-Umlaute "$convertedListCfg" +$correctedListCfg.Name + +# Finally append correctedListCfg to desired +# cfg file, usually class.cfg +add-content "00-class.cfg" $correctedListCfg.Name +Remove-Item convertedList.cfg diff --git a/macros/latex/contrib/thorshammer/system-scripts/standalone/mkclassFolders.ps1 b/macros/latex/contrib/thorshammer/system-scripts/standalone/mkclassFolders.ps1 new file mode 100644 index 0000000000..7f7fcc3ef6 --- /dev/null +++ b/macros/latex/contrib/thorshammer/system-scripts/standalone/mkclassFolders.ps1 @@ -0,0 +1,60 @@ +$classPath="C:\Users\dpstory\Desktop\Test Folder\target\myClass" +# Create class folders +If ( $args.Length -eq 0 ) { + Write-Host "A CVS file of the class members is required," ` + "see documentation" + exit +} else { + $listName=$args[0] + if(Test-Path -Path ./$listName.csv) { + } else { + Write-Host "Cannot find the file `"$listName.csv`" in the current folder," ` + "check the spelling, do not include the extension." + exit + } +} +get-content "$listName.csv" | foreach { +$_ +">_Thor" -Replace ";","," } | Set-Content "commaList.csv" + +$argList=@() +get-content "commaList.csv" | %{ +# Write-Host "$_" + $split=$_.split(",") +# Write-Host $split[2] + $argList+=$split[2] +} +$currentPath=Convert-Path . +cd $classPath +Write-Host "Creating folder structure at `$classPath`"," ` + "with some exceptions" +for ($i=0; $i -lt $argList.length; $i++) { + $arg=$argList[$i] + $splitTwo=$argList[$i].split(">") + $firstName=$splitTwo[0] + $secondName=$splitTwo[1] + if ($firstName[0] -eq "*") { + $arg=$arg.substring(1) + $msg="Parsing the full path $arg" -Replace ">","/" + Write-Host $msg + Write-Host "Creating exceptional folders" + $firstName=$firstName.substring(1) +#Write-Host "$firstName" + Write-Host " Creating folder: $firstName" + New-Item $firstName -ErrorAction:Ignore -ItemType directory + $secondName=$firstName+"/$secondName" +#Write-Host "$secondName" + Write-Host " Creating folder: $secondName" + New-Item $secondName -ErrorAction:Ignore -ItemType directory + } else { + $msg="Parsing the relative path $arg" -Replace ">","/" + Write-Host $msg + Write-Host " Creating folder: $firstName" + New-Item $firstName -ErrorAction:Ignore -ItemType directory + cd $firstName + Write-Host " Creating subfolder of $firstName named: $secondName" + New-Item $secondName -ErrorAction:Ignore -ItemType directory + cd .. + } +} +cd $currentPath +Remove-Item commaList.csv diff --git a/macros/latex/contrib/thorshammer/system-scripts/thors-structure/thmclass.ps1 b/macros/latex/contrib/thorshammer/system-scripts/thors-structure/thmclass.ps1 index 2dcbc65c25..7f1f72bf27 100644 --- a/macros/latex/contrib/thorshammer/system-scripts/thors-structure/thmclass.ps1 +++ b/macros/latex/contrib/thorshammer/system-scripts/thors-structure/thmclass.ps1 @@ -1,3 +1,11 @@ +# Version 1.4 changes +# ===================================================================================================== +# small modifications of tex template +# remove some comments +# added partial support for cntdwn package, not fully working here to keep tex template small +# interested users should refer to Acrotex blog for further explanations +# anyway the template compiles without errors +# ===================================================================================================== # Version 1.3 changes # ===================================================================================================== # copyka.ps1 allows a comment character (#) @@ -415,7 +423,7 @@ New-Item "tex-template.tex" -ItemType file If ($locale -like "*$myLocale*") { # German ###################################### Set-Content "tex-template.tex" '%% Customize template ! %% -\documentclass[fontsize=11pt]{scrartcl} +\documentclass[fontsize=12pt]{scrartcl} \usepackage[% german, pro, @@ -424,17 +432,19 @@ navibar, forcolorpaper %forpaper ]{web} +% Page layout \usepackage[top=20mm,left=20mm,right=20mm,bottom=25mm]{geometry} +%\useFullWidthForPaper \usepackage[usesumrytbls,allowrandomize]{exerquiz} \usepackage{ran_toks} \usepackage[% % usebatch % copy to class folder -batchdistr % only copy to instructors folder -% testmode % testing quizzes +% batchdistr % only copy to instructors folder +testmode % testing quizzes ]{thorshammer} \hypersetup{pdfencoding=auto} % include or remove hyperref options %\usepackage{thorshammerConf} % place your own sty file here -\usepackage[autostyle=true]{csquotes} % change quotes globally +%\usepackage[autostyle=true]{csquotes} % change quotes globally \DeclareQuiz{q#number} \setInitMag{fitwidth} @@ -454,8 +464,8 @@ batchdistr % only copy to instructors folder %\DeclareCoverPage{0} % Header settings -\thQzName{#theme} % Thema -\thQzHeaderL{#class} % Klasse +\thQzName{#theme} +\thQzHeaderL{#class} \thQzHeaderCQ{#subject: \thqzname} \thQzHeaderCS{Lösungen: \thqzname} @@ -464,7 +474,7 @@ batchdistr % only copy to instructors folder \subject{#subject} \author{#instrName} \keywords{#time} -\university{Freiherr-vom-Stein-Berufskolleg} % change to your institution +\university{Freiherr-vom-Stein-Berufskolleg} \version{#number} \copyrightyears{#date} @@ -475,9 +485,26 @@ batchdistr % only copy to instructors folder \sadMultQuizzes \end{makeClassFiles} +% Timer settings, this are personal settings for a timer in the quiz, if you want that, refer to +% http://www.acrotex.net/blog/?p=450 +% with \usepackage[shortcount]{cntdwn} + +% \newcommand{\thorTimer}[2]{% +% \setShortCntDwn{CntDwnTimer1} +% {% +% length=#1*\minutes, +% notify1=#2*\minutes, +% event1=AllowEndQuiz1, +% event2=NoAction, +% event3=NoAction, +% endEvent=EndTheQuiz1 +% } +% } +%\thorTimer{#time}{10} % original command \setShortCntDwn + \begin{document} + \makeinlinetitle -% Instructions % Declare Quiz bodys \declareQuizBody{qzbody1} @@ -487,11 +514,22 @@ batchdistr % only copy to instructors folder \begin{qzbody1} \bRTVToks{\currQuiz} -% Change margin settings for summary tables, and set it back after -% \thQuizHeader execution -\newgeometry{top=20mm,left=30mm,right=20mm,bottom=25mm} \thQuizHeader -\newgeometry{top=20mm,left=20mm,right=20mm,bottom=25mm} + +% priorInitQuiz for the timer, see Timer settings +\begin{defineJS}[\makeesc\!]{\priorInitQuiz} +this.getField("endQuiz.!thisQuiz").display=display.hidden; +qtypesReadOnly("!thisQuiz",false); +\end{defineJS} + +% postInitQuiz for timer, see Timer settings +\begin{defineJS}[\makeesc\!]{\postInitQuiz} +AllowEndQuiz1.arg="!currQuiz"; +EndTheQuiz1.arg="!currQuiz"; +sStartTimer(_oCntDwnTimer1); +\end{defineJS} + +% Instructions here \begin{quiz*}{\currQuiz} % Bearbeiten Sie folgende Aufgaben. @@ -526,7 +564,11 @@ Set-Content "tex-template.tex" '%% Customize template ! %% \usepackage{web} \usepackage[usesumrytbls,allowrandomize]{exerquiz} \usepackage{ran_toks} -\usepackage[usebatch]{thorshammer} +\usepackage[% +% usebatch % copy to class folder +% batchdistr % only copy to instructors folder +testmode % testing quizzes +]{thorshammer} \DeclareQuiz{q#number} @@ -560,8 +602,8 @@ Set-Content "tex-template.tex" '%% Customize template ! %% %\DeclareCoverPage{0} % Header settings -\thQzName{#theme} % topic -\thQzHeaderL{#class} % class +\thQzName{#theme} +\thQzHeaderL{#class} \thQzHeaderCQ{#subject: \thqzname} \thQzHeaderCS{Solutions: \thqzname} @@ -581,14 +623,51 @@ Set-Content "tex-template.tex" '%% Customize template ! %% \sadMultQuizzes \end{makeClassFiles} +% Timer settings, this are personal settings +% for a timer in the quiz, if you want that, refer to % +% http://www.acrotex.net/blog/?p=450 + +% \newcommand{\thorTimer}[2]{% +% \setShortCntDwn{CntDwnTimer1} +% {% +% length=#1*\minutes, +% notify1=#2*\minutes, +% event1=AllowEndQuiz1, +% event2=NoAction, +% event3=NoAction, +% endEvent=EndTheQuiz1 +% } +% } +%\thorTimer{#time}{10} % original command \setShortCntDwn + + \begin{document} + +% Declare quiz bodies \declareQuizBody{qzbody1} +%\declareQuizBody{qzbody2} +%\declareQuizBody{qzbody3} +%\declareQuizBody{qzbody4} + \begin{qzbody1} \bRTVToks{\currQuiz} \thQuizHeader +% priorInitQuiz for the timer, see Timer settings +\begin{defineJS}[\makeesc\!]{\priorInitQuiz} +this.getField("endQuiz.!thisQuiz").display=display.hidden; +qtypesReadOnly("!thisQuiz",false); +\end{defineJS} + +% postInitQuiz for timer, see Timer settings +\begin{defineJS}[\makeesc\!]{\postInitQuiz} +AllowEndQuiz1.arg="!currQuiz"; +EndTheQuiz1.arg="!currQuiz"; +sStartTimer(_oCntDwnTimer1); +\end{defineJS} + % Instructions \begin{quiz*}{\currQuiz} Solve each of these problems, passing is 100\%. |