I'm writing a script (topic ring theory) where I have to set lots of quotients of algebraic objects. Usually I simply write M/N
. However there are some cases where this is no easy to read (M+N/N
or such). So I want to set the first object a bit higher and the second a bit lower. I found the faktor package which does this. However faktor uses \diagup
in a fixed size. For larger expressions a larger one seems suitable. Do you have any idea how I can change the source code of the package so that
- I have two commands (one with a small and one with a large slash) or better
- the
\diagup
has automatically the right size.
I also tried xfrac
. First I ran into this message:
This is a LaTeX bug: check coding!
! Command name `\if_num:w' already defined! Current meaning: \ifnum.
\msg_kernel_bug:x ...oding!}\tex_errmessage:D {#1}
A comment at Debians bug tracking system suggested to exchange mathtools
and xfrac
. This worked on my system. However the formulas inside a gather*
-environment look too small to me:
The font size here seems smaller than at inline text. Thatswhy I wanted to try faktor
.
I noticed another disadvantage with xfrac
. My document needs a lot more time to compile. The initial revision took ~13 sec to compile (pdflatex) and with xfrac
it took ~1300 secs or nearly half an hour.
Best Answer
In essence, the
faktor
package defines the command\faktor
in the following way (let's call it\newfaktor
):Here is the similarity between
\faktor
and\newfaktor
:In order to satisfy the first request - to modifying the height/depth to which the numerator/denominator is raised/dropped - you could define some extra optional parameters for
\newfaktor
. And, for the sake of being complete, thexparse
package provides a convenient way of intermixing mandatory{}
and optional[]
arguments:This defines the command
\newfaktor{#1}[#2]{#3}[#4]
where#2
and#4
have defaults of0.5
and-0.5
respectively, and are optional. These optional arguments specify the fractional height/depth to which the numerator#1
and denominator#3
are raised/dropped. That is, specifying0.5
for#2
raises#1
by half of its regular height; specifying-1
for#4
drops#3
by its own height. For example:In the above image, the first four uses of
\newfaktor
yield a typesetting equivalent to\faktor
.In order to satisfy the second request -
\diagup
scales automatically with respect to its arguments - we have to go a different route. The reason for this is that scaling\diagup
happens in 2 dimensions, thereby making\diagup
fatter. See, for example, the difference between:So, instead, I went with stretching a
\rule
, built into the following macro:This creates
\newfaktor
just like before, but now with an optional*
. The starred version\newfaktor*
reverts to the older definition, using\diagup
as the slanted fraction, while the unstarred\newfaktor
draws a\rule
and tilts it into place. Consider the differences:Of course, if these definitions are entirely satisfaktory(!), you can change them to your liking.