faktor: change order of optional arguments to not bother with '[' charactor after faktor

This commit is contained in:
Maximilian Keßler 2021-10-24 21:06:08 +02:00
parent dd60e7cba7
commit 5a7525ffa4
3 changed files with 15 additions and 18 deletions

View file

@ -18,26 +18,26 @@ __HEADER__(Faktor package that also handles cofaktors)
\RequirePackage{mathtools} \RequirePackage{mathtools}
\DeclareDocumentCommand{\faktor}{s m O{0.5} m O{-0.5}}{% \newfaktor[*]{#2}[#3]{#4}[#5] -> #2/#4 \DeclareDocumentCommand{\faktor}{s O{0.5} m O{-0.5} m}{% \newfaktor[*][#2]{#3}[#4]{#5} -> #3/#5
\setbox0=\hbox{\ensuremath{#2}}% Store numerator \setbox0=\hbox{\ensuremath{#3}}% Store numerator
\setbox1=\hbox{\ensuremath{\diagup}}% Store slash / \setbox1=\hbox{\ensuremath{\diagup}}% Store slash /
\setbox2=\hbox{\ensuremath{#4}}% Store denominator \setbox2=\hbox{\ensuremath{#5}}% Store denominator
\raisebox{#3\ht1}{\usebox0}% Numerator \raisebox{#2\ht1}{\usebox0}% Numerator
\mkern-5mu\ifthenelse{\equal{#1}{\BooleanTrue}}% Slash / \mkern-5mu\ifthenelse{\equal{#1}{\BooleanTrue}}% Slash /
{\diagup}% regular \faktor 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% \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 \DeclareDocumentCommand{\cofaktor}{s m O{-0.5} m O{0.5}}{% \newfaktor[*][#2]{#3}[#4]{#5} -> #2\#4
\setbox0=\hbox{\ensuremath{#2}}% Store numerator \setbox0=\hbox{\ensuremath{#3}}% Store numerator
\setbox1=\hbox{\ensuremath{\diagdown}}% Store slash / \setbox1=\hbox{\ensuremath{\diagdown}}% Store slash /
\setbox2=\hbox{\ensuremath{#4}}% Store denominator \setbox2=\hbox{\ensuremath{#5}}% Store denominator
\raisebox{#3\ht1}{\usebox0}% Numerator \raisebox{#2\ht1}{\usebox0}% Numerator
\mkern-5mu\ifthenelse{\equal{#1}{\BooleanTrue}}% Slash / \mkern-5mu\ifthenelse{\equal{#1}{\BooleanTrue}}% Slash /
{\diagdown}% regular \faktor 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% \mkern-4mu%
\raisebox{#5\ht2}{\usebox2}% Denominator \raisebox{#4\ht2}{\usebox2}% Denominator
} }

View file

@ -5,12 +5,12 @@
\begin{document} \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} \end{document}

View file

@ -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}%