Please look at the following code:
\documentclass{article}
\usepackage{amsmath}
\begin{document}
\Huge
\begin{equation}
\frac{x^{2}}{x^{2}}
\end{equation}
\begin{equation}
x^{2} / x^{2}
\end{equation}
\end{document}
Can you see the wrong placement of the exponent in the denominator? Compare it to the flat fraction.
I do not really have an idea what to do to get the same spacing. Any suggestions?
Thanks.
Best Answer
Before reading on, please see this answer. What follows is about modifying TeX’s behavior so to obtain the desired output at the primitive level (in particular, not just for fractions, but for all occurences of a “cramped” style).
It is true what @Mico says in his comment, that is, that cramped style for denominators is a very low-level feature built into all TeX engines; but it is also true that it can be configured by means of the relevant
\fontdimen
parameters (so that I wouldn’t describe it as being “hard-wired”). The exact meaning of these parameters is defined in Appendix G of The TeXbook; in particular, what is relevant for this question is just the second sentence of Rule 18c (last two lines on p. 445), which dictates how TeX chooses the amount by which “ordinary” exponents (that is, not too deep) are to be raised when applied to “ordinary” base symbols (for example, single characters, as opposed to subformulas). It turns out that there are three possibilities:in
\displaystyle
, the chosen amount is the value of the parameter that can be referred to as\fontdimen 13 \textfont 2
;in any “uncramped”, non-display style, the chosen amount is the value of
\fontdimen 14 \<style>font 2
in any “cramped” (either display or non-display) style, the chosen amount is
\fontdimen 15 \<style>font 2
, except that<style>
is substituted withtext
if it isdisplay
.As it has already been pointed out by others, “cramped” styles are used for denominators of fractions; note, though, that they are used also in radicals, in
\overline
constructions, and still in other places.As a consequence, it is possible to “disable”, virtually, the “cramped” styles simply by assigning to the 15th
\fontdimen
parameter the value of the 14th, thereby rising exponents in denominators by the same amount that TeX ordinarily uses for exponents in numerators; that is, exactly the opposite of what @Mico’s solution, which forces a “cramped” style in the numerators too, does.However, there are some caveats.
First of all, changes to
\fontdimen
parameters do not obey TeX grouping rules: their scope is always global (The TeXbook, p. 277). This means that, if you want to undo them, you need to save the original values “by hand”.In the second place, each
\fontdimen
change should be repeated thrice (once for each style, that is, for\textfont 2
,\scriptfont 2
, and\scriptscript 2
), unless you want to disable “crampedness” only for some styles but not for others: for example, in order to disable “crampedness” only for\textstyle
and\scriptstyle
, but not for\scriptscriptstyle
, you would change\fontdimen 15 \textfont 2
and\fontdimen 15 \scriptfont 2
, but not\fontdimen 15 \scriptscriptfont 2
.This triple setting, in turn, must be repeated for all the sizes (
\normalsize
,\footnotesize
, …) at which you are typesetting formulas, since, in general, the font that corresponds to, say,\textfont 2
in\normalsize
is not the same one that corresponds to\textfont 2
in\footnotesize
.If you decide to suppress “crampedness”, it seems wise to suppress “displayedness” too, that is, to give the same value as
\fontdimen 14
to\fontdimen 13
as well (see above).The following code gives a sort of “proof of concept”. It defines two declarations, both of which are irreversible:
\LeveledExponentsForCurrentSize
suppresses both “crampedness” and “displayedness” for the current font size only (but all the way to\scriptscriptstyle
);\LeveledExponentsForAllSizes
suppresses both “crampedness” and “displayedness” for all the standard LaTeX sizes; note, however, that this will load a large number of math fonts, most of which you are never going to use, and which might cause you to hit the limit for the number of loadable fonts in certain engines (mainly, in pdfTeX).As already hinted, the code makes no provision for saving the original values, and hence for reverting to the original setting. This isn’t difficult to accomplish, however.
For your convenience, here is the resulting output: