__HEADER__(Faktor package that also handles cofaktors) % Extension the faktor package for % - cofaktor command that provides A \ B notation % - scaling the / in the middle % - fine positioning of enumerator / denominator % This is essentially taken from the stackexchange question found at % https://tex.stackexchange.com/questions/27591/extending-the-faktor-package % and answered by 'Werner' (https://tex.stackexchange.com/users/5764/werner) % % This package only packages the corresponding answer and provides an analoguous way of a \cofactor command %Dependencies \RequirePackage{xparse} \RequirePackage{amssymb} % provides \diagup and \diagdown \RequirePackage{ifthen} % ifthenelse syntax \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 \setbox1=\hbox{\ensuremath{\diagup}}% Store slash / \setbox2=\hbox{\ensuremath{#4}}% Store denominator \raisebox{#3\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 \mkern-4mu% \raisebox{#5\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 \setbox1=\hbox{\ensuremath{\diagdown}}% Store slash / \setbox2=\hbox{\ensuremath{#4}}% Store denominator \raisebox{#3\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 \mkern-4mu% \raisebox{#5\ht2}{\usebox2}% Denominator }