12

This is a question about the aesthetics of mathematical typesetting, as well as a technical question about LaTeX.

I'm writing a lot of expressions like this:

enter image description here

(\log\frac{p_{i\to j}}{p_{j\to i}} in a display math environment.)

This looks odd to me, because of the very large gap between the fraction line and the denominator, compared with quite a small gap between the line and the numerator.

I realise that in some sense that gap needs to be there in order to accommodate taller characters like 'A' or 'b', but since there are no such letters in my expression it seems like it might look better if the spacing were different.

So my questions are (with roughly equal priority):

  1. Should I be messing with this? Am I right in thinking the expression looks unbalanced, or should I just trust the algorithm's designer (presumably Knuth) to have made the right decision about how to typeset this?

  2. If I should change it, what should change exactly? Should the line be lower, or should the denominator and/or numerator be higher up?

  3. If changing it isn't a terrible idea, what is the best way to affect such a change?

I believe this is not a duplicate of How to vertically center the fraction line?, since that question is about how the spacing relates to the font, rather than to the actual characters used in the numerator and denominator.

9
  1. Usually I don't bother about these things, except when the result is very ugly.

    In this case, the result is not so ugly, but effectively the fraction looks a bit unbalanced.

  2. I would live with it, but if you really can't, this can be a way to achieve a more balanced fraction.

    First of all, let's have a closer look at the result in all styles (displaystyle, textstyle, etc.)

    enter image description here

    IMHO, the latter two can be OK, while the former two need both the denominator and the numerator to be raised up.

    The following can be a solution (a new command \bfrac, with the meaning "balanced fraction"):

    \DeclareRobustCommand{\bfrac}[2]{%
      \mathchoice{\frac{\raisebox{0.1ex}{$#1$}}{\raisebox{0.4ex}{$#2$}}}%
                 {\frac{\raisebox{0.4ex}{$\scriptstyle#1$}}{\raisebox{0.1ex}{$\scriptstyle#2$}}}%
                 {\frac{#1}{#2}}%
                 {\frac{#1}{#2}}%
    }
    

    MWE

    \documentclass{article}
    \usepackage{amsmath}
    
    \DeclareRobustCommand{\bfrac}[2]{%
      \mathchoice{\frac{\raisebox{0.1ex}{$#1$}}{\raisebox{0.4ex}{$#2$}}}%
                 {\frac{\raisebox{0.4ex}{$\scriptstyle#1$}}{\raisebox{0.1ex}{$\scriptstyle#2$}}}%
                 {\frac{#1}{#2}}%
                 {\frac{#1}{#2}}%
    }
    
    \begin{document}
    \[
    \displaystyle{\frac{p_{i\to j}}{p_{j\to i}}}\quad
    \textstyle{\frac{p_{i\to j}}{p_{j\to i}}}\quad
    \scriptstyle{\frac{p_{i\to j}}{p_{j\to i}}}\quad
    \scriptscriptstyle{\frac{p_{i\to j}}{p_{j\to i}}}
    \]
    
    \bigskip
    
    \[
    \displaystyle{\bfrac{p_{i\to j}}{p_{j\to i}}}\quad
    \textstyle{\bfrac{p_{i\to j}}{p_{j\to i}}}\quad
    \scriptstyle{\bfrac{p_{i\to j}}{p_{j\to i}}}\quad
    \scriptscriptstyle{\bfrac{p_{i\to j}}{p_{j\to i}}}
    \]
    \end{document} 
    

    You can compare the output:

    enter image description here

  3. About this question, I don't have an answer...

  • 1
    May be using ex units (or mu/em) you can provide a more “secure” solution. – Manuel Feb 2 '14 at 10:30
  • @Manuel I definitely agree – karlkoeller Feb 2 '14 at 10:41
  • in the question, the fraction is set next to \log. context matters. although from the code, the vertical position of the fraction rule isn't adjusted, only that of the numerator and denominator, the effect of setting it in smaller sizes appears to lower the rule, which would look very odd in context, especially if it happens to be followed by, say, a plus or minus, which has a very strong horizontal at the math axis. it would be best if the fraction rule can be kept, even artificially, at the math axis. – barbara beeton Feb 2 '14 at 14:45
  • @barbarabeeton I can't notice any problem if the code is followed by a plus or minus. – karlkoeller Feb 2 '14 at 14:53
  • i didn't replicate the test, and i suspect other readers won't either. so if you separate the four examples by minus signs rather than a quad, the visual clue would be instructive. – barbara beeton Feb 2 '14 at 14:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.