I have the product of two quantities with diacritics (\tilde, \hat and \bar - to be more precise), which give this ugly result. Based on your PDF viewer and zoom selection the sight might be more or less of an eyesore.

The other problem is the height at which the diacritics appear above the lowercase v, which is horrble when the d is next to it.

How can I fix these things? Is there any kind of panacea for all these problems?

Here's the code for a few samples:








... and the result:

enter image description here

PS: Using an increased kerning between the factors of the products makes things bearable (i.e. avoids the tildes sticking together), but I think that's a really clumsy hack and I'd like to have a more elegant solution.

PS2: As per request, a sample of what I'd like to achieve (using Photoshop after LaTeX :P). Granted, the hat floats high above the v, but I prefer it that way. :)

enter image description here

  • Good question, to which I don't have a good answer:-) the horizontal kerning is perhaps easier to automate, but what do you want to happen for hat d hat v If you make the hat always high enough to fit over a d it would look very high on a v, so I suspect there isn't much you can do about that even if you think it looks horrible. (If you think there is a more pleasing typesetting of that, post an image with it, even if you have just faked it by moving the diacritics in an image editor, then it gives anyone trying automated macros something to aim for. – David Carlisle May 28 '12 at 12:42
  • @DavidCarlisle: Question updated to accommodate your request. :) – Count Zero May 28 '12 at 12:54
  • It's well known that the PXfonts don't have good sidebearings for math characters. I'd suggest to use mathpazo instead. – egreg May 28 '12 at 18:25
  • @egreg: Thanks for the suggestion, will switch over. – Count Zero May 28 '12 at 18:49

Here's a solution to the d/v-problem that automatically inserts the correct kerns for the accent. The idea is taken from another answer of mine, which in turn is based on what I learned from TH. The command \ra ("raise accent") takes two arguments, the accent and the letter. The accent is then put at the same height as it would be over the letter d. This works equally well for normal text and for sub-/superscripts:

example with accents

The solution also works if you replace pxfonts with mathpazo – I strongly support this suggestion of egreg (see comment to the question). However, let me point out that this only works for latin letters, so \ra \hat \gamma won't work. Note that \ra \hat d has the same effect as \hat d since the accent doesn't have to be raised.

Personally, I wouldn't raise the accents; I think it's substituting one eyesore for another.




$\ra\hat d\ra\hat v_{ap}$
$A_{\ra\hat d\ra\hat v_{ap}}$
  • Thanks for the nice solution, wrapping things into a macro, that's definitely a plus! In the meantime, egreg also pointed out in a comment the that mathpazo was a better choice than pxfonts. Nevertheless, the accents need to be arranged there, too... – Count Zero May 31 '12 at 11:28
  • @Count: Ah, I didn't read egreg's comment properly. My solution works with mathpazo, too, and there the f is fine. – Hendrik Vogt May 31 '12 at 11:36
  • Yep, it does! :) – Count Zero May 31 '12 at 11:37

For the d/v hat perhaps


does what you want:

enter image description here

It could perhaps be incorporated with a general macro that makes each accent macro look-ahead and insert horizontal kerns or vertical struts on a case-by-case basis.

  • 1
    Seeing that makes me shiver. ;-) – egreg May 28 '12 at 20:02

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.