From 84b427a223c582c92db39cec3ddecd0dfd21f4c8 Mon Sep 17 00:00:00 2001 From: Andreas Strauman Date: Wed, 28 Nov 2018 20:22:44 +0100 Subject: [PATCH] Correct 'warning'-message if \DisplaySolutions is or is not shown. Fix #91 --- docs/changelog.tex | 3 ++ exercisebank.sty | 3 +- exercisebank.zip | Bin 327727 -> 327727 bytes release/example.zip | Bin 60347 -> 60347 bytes release/exercisebank-doc.pdf | Bin 251897 -> 251897 bytes releasing/do_release.rb | 69 ----------------------------------- src/envcontrol.tex | 2 +- src/hidetags.tex | 6 ++- src/main.tex | 12 ++++-- src/packageoptions.tex | 4 ++ src/preamble.tex | 7 ++++ src/spaceIgnore.tex | 29 +++++++++++++++ 12 files changed, 59 insertions(+), 76 deletions(-) delete mode 100755 releasing/do_release.rb create mode 100644 src/spaceIgnore.tex diff --git a/docs/changelog.tex b/docs/changelog.tex index 1ba4200..6dbe3de 100644 --- a/docs/changelog.tex +++ b/docs/changelog.tex @@ -70,6 +70,9 @@ \change{Fixed bug where part problem header repeats if solution is itemize.} \change{Introduced the \dac\rigid command for the \dac\At functionality. Also the \dac\ClearHook for deleting a hook} \change{\dac\buildset now gives error if set does not exist.} + \change{Made \dac\HideTags cummulative.} + \change{Created \dac\ShowAllTags for clearing tags list} + \change{Raises error when pdf\TeX(or pdf\LaTeX) is not used} \chlogtable diff --git a/exercisebank.sty b/exercisebank.sty index 68f85c0..27db4b7 100644 --- a/exercisebank.sty +++ b/exercisebank.sty @@ -892,4 +892,5 @@ nohead/.code = {\exb@noheadArgtrue\ea\gdef\csname setlist@\exb@currentSetID @noh \fi \fi } -\gdef\HideTags#1{\xdef\exb@hidetaglist{#1}} +\gdef\HideTags#1{\xdef\exb@hidetaglist{\unexpanded\expandafter{\exb@hidetaglist},#1}} +\gdef\ShowAllTags#1{\gdef\exb@hidetaglist{}} diff --git a/exercisebank.zip b/exercisebank.zip index fa25617d18288730ee9f55d7e9a98893ef458e89..31170a09c82f4ae877734bc7e818b24597159d3f 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^~^*96xC|aZR{rJiTmHKGUKN2R}Wq`usrg)4>CY3LIPk&ljX^ zf5cGoLEOnfE?~hy$C*J>6i;>ezmKkd_@%h?V=Ji8m?X sDGOHr(i}-{#Y;CN9{(#3BwocUcO>3}SDr{buh$@z6AgtYFMllp09?`EjQ{`u delta 518 zcmdmeoq6|lW}X0VW)?065HRtd$Rp3jGU-(`%cO~h(i|rKxxU%0diN)Ws6a(G*0o$` zYn(iFZfoOajvHcZ^&0BO?FAFn*!U97)cWdkl+K)4)U-zDzr_vKn-&qRH*Wmo_;+5< z>i=dLgFpRQAL;}70*+e?G(QP!5m8v2uJ<L61ARw~foa5QN zql_;e=(jZ3EO2OUHd?CTJVkW=z3tx)z5Ljf7Ps`D>x3n2*%3c|Z(XyS{b)vPs^`sJ z8P&0!U-N#yEtYFwopPAr&-;}nMP>yhW#xbTKSkV>w3J-n;pzIsW#K=0katCZp5*{~ zck=CfT2P;D=Dr`#!~_(|d8mm90+7IthZZn3-yUvZ1PQHqYy}mX{O0jZkjU{TmM{^v zr%@o0q^H&}ZHu2S0c-Po4%gQC{3u9Kzzba_mPwNjzLJFp_T(imjG$s572jW2fOv*4 rWx?uSnj^`rcLQL$`gs_^%|sdqM`8Q<*!8mP1oFu diff --git a/release/exercisebank-doc.pdf b/release/exercisebank-doc.pdf index 648f3966d45252dcfe9d8c2e58d7c8a9880d482f..93c1d3c7617b3efe95f672694d416691bc9df8ae 100644 GIT binary patch delta 114 zcmeylp8w~1{)QID7N#xCD-W?58XB1!8%|$;h*=iO-hSy2^A&DqBXd({7YjotXBQ`9 kOBYv1BPSO}17kO56Bh#mQv+8wI|Um;O18f|$1K1J03e?sIsgCw delta 114 zcmeylp8w~1{)QID7N#xCD-W?5Selv}n@wMTh*=iO-hSy2^A&Dqb4MdbV<$^j12;=& k6E|aXCudU=OII^Pb0aqcH)AJPI|Um;O18f|$1K1J03(GVEC2ui diff --git a/releasing/do_release.rb b/releasing/do_release.rb deleted file mode 100755 index 34a3e52..0000000 --- a/releasing/do_release.rb +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/env ruby -require_relative 'releaser' -require 'pathname' -require 'inifile' -require 'pp' -# p ARGV[0] -suggest_num_commits=20 -# n_commits=3 -FPATH=File.dirname(File.expand_path(__FILE__)) -def expath relpath - exercisebank_abspath=File.dirname(FPATH) - File.expand_path(File.join(exercisebank_abspath,relpath)) -end -ini_path=expath "/src/packaging/texpackvars.ini" -ini_path=File.expand_path(ini_path) -# ini_path="../src/packaging/texpackvars.ini" -myini = IniFile.load(ini_path) -version = myini[:global]['version'] -build = myini[:global]['build'] -# tag = "#{version}b#{build}-prerelease" -tag = "#{version}b#{build}-experimental" -$current_commit=`git log --pretty=format:'%H' -n 1` -r = Releaser.new(ENV['GH_TOKEN'], tag, 'Strauman/exercisebank') -r.get_release -def make_draft r - if ARGV.include?("-n") - n_commits=ARGV[ARGV.index("-n")+1] - else - $latest_commits=`git log --pretty=format:'%s' -n #{suggest_num_commits}` - $latest_commits = $latest_commits.split("\n") - $latest_commits.map!.with_index{|lc,i| "#{i+1}: #{lc}"} - puts($latest_commits) - print "Number of commit messages to include: " - n_commits=$stdin.gets - end - $current_body=`git log --pretty=format:'%B' -n #{n_commits}` - print $current_body - # exit 0 - r.push sha: $current_commit, body: $current_body - r.upload_asset(expath('release/exercisebank.sty')) - r.upload_asset(expath('release/exercisebank-doc.pdf')) - # r.upload_asset('../exercisebank.zip') -end -if ARGV.include?('--delete') - r.get_release - unless r.release.nil? - r.delete - r.get_release! - end -else - if r.release.nil? - make_draft r - elsif ARGV.include?('-f') - r.delete - r.get_release! - make_draft r - end - unless r.release.nil? - if r.release[:draft] - r.publish if ARGV.include?('--publish') - end - end - if r.release[:draft] - p 'DRAFT' - else - p 'NDRAFT' - end -end -pp r.release diff --git a/src/envcontrol.tex b/src/envcontrol.tex index f016db1..6ef3e32 100644 --- a/src/envcontrol.tex +++ b/src/envcontrol.tex @@ -30,7 +30,7 @@ %% ^ This should be fixed! %%NB: DOC for \DisplaySolutions are moved down \AtBeginDocument{ - \ifexb@DisplaySolutions\isFalse + \ifexb@DisplaySolutions\else \@latex@warning{Hiding solutions. Show them with \string\DisplaySolutions} \fi } diff --git a/src/hidetags.tex b/src/hidetags.tex index d51bce2..0ef60a0 100644 --- a/src/hidetags.tex +++ b/src/hidetags.tex @@ -11,4 +11,8 @@ %:=\HideTags{list} %:Hide all exercises containing the list of tags when building a set. %:- -\gdef\HideTags#1{\xdef\exb@hidetaglist{#1}} +\gdef\HideTags#1{\xdef\exb@hidetaglist{\unexpanded\expandafter{\exb@hidetaglist},#1}} +%:=\ShowAllTags +%:Reset tags set by \HideTags +%:- +\gdef\ShowAllTags{\gdef\exb@hidetaglist{}} diff --git a/src/main.tex b/src/main.tex index f94c633..1912d06 100644 --- a/src/main.tex +++ b/src/main.tex @@ -4,15 +4,19 @@ \usepackage{lipsum} \exercisebanksetup{% - exercise directory=../exercises + exercise directory=../exercises } %% The \makeset{setname}{exercises,to,include} picks exercises from the exercises-folder %% The \exclude{setname}{1,2,3,...,9} excludes partproblems 1,...,9 from setname \makeset{electro}{capacitance} \makeset{first}{firstexercise} -\makeset{2}{firstexercise, \exclude{secondexercise}{1,2}, \select{thirdexercise}{1,2}, \exclude{thirdexercise}{1,2}} -% \DisplaySolutions +% \DeclareExerciseCommand\extitle[1]{\strut{\vadjust{\vbox to 0pt{\hskip\pMarginLeft{\Large\bfseries #1}}}}%} +\DeclareExerciseCommand\problemtitle[1]{\stepcounter{problemcounter}% + \strut{\vadjust{\vbox to 0pt{\hskip\pMarginLeft{\Large{\bfseries Exercice \theproblemcounter.} #1}}}}% +} +\DisplaySolutions +\makeset[nohead]{2}{firstexercise, \exclude{secondexercise}{1,2}, \select{thirdexercise}{1,2}, \exclude{thirdexercise}{1,2}} \begin{document} - \buildset{2} + \buildset{2} \end{document} diff --git a/src/packageoptions.tex b/src/packageoptions.tex index 0f25648..dcb17f8 100644 --- a/src/packageoptions.tex +++ b/src/packageoptions.tex @@ -1,5 +1,6 @@ %!TEX root = main.tex \makeatletter +% \ignoreOutlineSpaces \edef\@isTrue{1} \edef\@isFalse{0} %:§config @@ -34,6 +35,7 @@ \gdef\exb@currentPoints{0} %:§config %:- +% \obeyOutlineSpaces % ---- \exercisebanksetup ----- % \pgfkeys{ /exbanksetup/.is family, /exbanksetup, @@ -79,6 +81,7 @@ F/.initial = \@isFalse, False/.initial = \@isFalse, } +% \ignoreOutlineSpaces %:=\exercisebanksetup{[key/values]} \newcommand\exercisebanksetup[1]{ \pgfkeys{/exbanksetup, #1}% @@ -102,6 +105,7 @@ \filbreak% \fi% } +% \obeyOutlineSpaces %: Here is a list of the different keys and their meaning diff --git a/src/preamble.tex b/src/preamble.tex index 7f698ec..b649c75 100644 --- a/src/preamble.tex +++ b/src/preamble.tex @@ -10,6 +10,9 @@ \@ifundefined{ownLineNoSpacesGotIt}{ \@latex@warning{Compilation wont work unless \string\end{problem} and \string\end{solution} are on their own lines and without any spaces. This warning can be removed by doing \string\def\string\ownLineNoSpacesGotIt{} before \@backslashchar usepackage{exercisebank}} }{} +\ifcsname pdfstrcmp\endcsname\else +\PackageError{exercisebank-@@VERSION}{Exercisebank currently only works with pdfLaTeX}{}\stop +\fi %:\!begin{marker}DEPRECATED! use \refCom{exercisebanksetup} with \refKey{exercise directory} instead!\!end{marker} %:=\setExercisesDir{directory} %:\!begin{marker}\setExercisesDir is deprecated! use \refCom{exercisebanksetup} with \refKey{exercise directory} instead!\!end{marker} @@ -26,10 +29,14 @@ \makeatother \global\let\incl = \input +\input{spaceIgnore} \input{ifs} \input{packages} +% \ignoreOutlineSpaces \input{helpers} +% \obeyOutlineSpaces% \input{packageoptions} +% \ignoreOutlineSpaces \input{stopfilbreak} \input{i18n} \input{at} diff --git a/src/spaceIgnore.tex b/src/spaceIgnore.tex new file mode 100644 index 0000000..b6a6419 --- /dev/null +++ b/src/spaceIgnore.tex @@ -0,0 +1,29 @@ +%!TEX root = main.tex +\makeatletter +\def\exb@rememberCC#1{% + \edef\exbtmp@charcode{\the\numexpr#1}% + \expandafter\xdef\csname exb@remcc@\exbtmp@charcode\endcsname{\the\catcode#1}% +} +\def\exb@ignoreCC#1{% + \edef\exbtmp@charcode{\the\numexpr#1} + \exb@rememberCC{\exbtmp@charcode}% + \catcode\exbtmp@charcode=9% +} +\def\exb@resetCC#1{ + \catcode#1=\csname exb@remcc@\the\numexpr#1\endcsname +} +% Ignores spaces that are not inline spaces +% (newlines and tabs) +\def\ignoreOutlineSpaces{% + \exb@ignoreCC{10}% line feed (New line) + \exb@ignoreCC{11}% Vertical Tab + \exb@ignoreCC{12}% Form Feed + \exb@ignoreCC{13}% Carriage Return +} +% Reset space ignore +\def\obeyOutlineSpaces{% + \exb@resetCC{10}% + \exb@resetCC{11}% + \exb@resetCC{12}% + \exb@resetCC{13}\ignorespaces% +}