From 5a7525ffa42840583a06447de29322f8cc77318f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Sun, 24 Oct 2021 21:06:08 +0200 Subject: [PATCH] faktor: change order of optional arguments to not bother with '[' charactor after faktor --- src/math/faktor.pysty | 24 ++++++++++++------------ tests/math/faktor/test.tex | 6 +++--- tests/wip/exercises/test.toc | 3 --- 3 files changed, 15 insertions(+), 18 deletions(-) delete mode 100644 tests/wip/exercises/test.toc diff --git a/src/math/faktor.pysty b/src/math/faktor.pysty index 81b3a6a..2f450a4 100644 --- a/src/math/faktor.pysty +++ b/src/math/faktor.pysty @@ -18,26 +18,26 @@ __HEADER__(Faktor package that also handles cofaktors) \RequirePackage{mathtools} -\DeclareDocumentCommand{\faktor}{s m O{0.5} m O{-0.5}}{% \newfaktor[*]{#2}[#3]{#4}[#5] -> #2/#4 - \setbox0=\hbox{\ensuremath{#2}}% Store numerator +\DeclareDocumentCommand{\faktor}{s O{0.5} m O{-0.5} m}{% \newfaktor[*][#2]{#3}[#4]{#5} -> #3/#5 + \setbox0=\hbox{\ensuremath{#3}}% Store numerator \setbox1=\hbox{\ensuremath{\diagup}}% Store slash / - \setbox2=\hbox{\ensuremath{#4}}% Store denominator - \raisebox{#3\ht1}{\usebox0}% Numerator + \setbox2=\hbox{\ensuremath{#5}}% Store denominator + \raisebox{#2\ht1}{\usebox0}% Numerator \mkern-5mu\ifthenelse{\equal{#1}{\BooleanTrue}}% Slash / {\diagup}% regular \faktor slash - {\rotatebox{-44}{\rule[#5\ht2]{0.4pt}{-#5\ht2+#3\ht0+\ht0}}}% tilted rule as a slash + {\rotatebox{-44}{\rule[#4\ht2]{0.4pt}{-#4\ht2+#2\ht0+\ht0}}}% tilted rule as a slash \mkern-4mu% - \raisebox{#5\ht2}{\usebox2}% Denominator + \raisebox{#4\ht2}{\usebox2}% Denominator } -\DeclareDocumentCommand{\cofaktor}{s m O{-0.5} m O{0.5}}{% \newfaktor[*]{#2}[#3]{#4}[#5] -> #2/#4 - \setbox0=\hbox{\ensuremath{#2}}% Store numerator +\DeclareDocumentCommand{\cofaktor}{s m O{-0.5} m O{0.5}}{% \newfaktor[*][#2]{#3}[#4]{#5} -> #2\#4 + \setbox0=\hbox{\ensuremath{#3}}% Store numerator \setbox1=\hbox{\ensuremath{\diagdown}}% Store slash / - \setbox2=\hbox{\ensuremath{#4}}% Store denominator - \raisebox{#3\ht1}{\usebox0}% Numerator + \setbox2=\hbox{\ensuremath{#5}}% Store denominator + \raisebox{#2\ht1}{\usebox0}% Numerator \mkern-5mu\ifthenelse{\equal{#1}{\BooleanTrue}}% Slash / {\diagdown}% regular \faktor slash - {\rotatebox{44}{\rule[-#5\ht2]{0.4pt}{#5\ht2-#3\ht0+\ht0}}}% tilted rule as a slash + {\rotatebox{44}{\rule[-#4\ht2]{0.4pt}{#4\ht2-#2\ht0+\ht0}}}% tilted rule as a slash \mkern-4mu% - \raisebox{#5\ht2}{\usebox2}% Denominator + \raisebox{#4\ht2}{\usebox2}% Denominator } diff --git a/tests/math/faktor/test.tex b/tests/math/faktor/test.tex index b2deb2b..3191431 100644 --- a/tests/math/faktor/test.tex +++ b/tests/math/faktor/test.tex @@ -5,12 +5,12 @@ \begin{document} \[ - \faktor{A}{B} \cong \cofaktor{A}{B} + \faktor{A}{B} \cong \cofaktor{C}{D} \] \[ - \faktor{A}[1]{B}[-1.5] \cong \cofaktor{A}[-1]{B}[0.5] + \faktor[1]{A}[-1.5]{B} \cong \cofaktor[-1]{A}[0.5]{B} \] \[ - \cofaktor*{A}[-1]{B}[2] = x + \cofaktor*[-1]{A}[2]{B} = x \] \end{document} diff --git a/tests/wip/exercises/test.toc b/tests/wip/exercises/test.toc deleted file mode 100644 index ac51e5c..0000000 --- a/tests/wip/exercises/test.toc +++ /dev/null @@ -1,3 +0,0 @@ -\contentsline {section}{\numberline {1}test}{1}{section.1}% -\contentsline {subsection}{1. Exercise Sheet}{1}{section*.2}% -\contentsline {subsection}{2. Exercise Sheet}{1}{section*.3}%