With a recent TeX distribution, the easy answer to this question is "load the sansmathaccent package" (which is Ariel's implementation of my answer). Actually, the corrected font should be loaded automatically by beamer, but somehow this doesn't work at the moment.

I just went to a math conference where I saw lots of slides prepared with the beamer class that contained badly positioned math accents like these: . The LaTeX file is

$\tilde M$ $\dot u$ $\hat T$

As you can see, the accents are centered over the bases of the corresponding letters, i.e., the skew of the letters isn't taken into account. I'm pretty sure that the reason for this is missing entries in the kerning table of the standard math font; see also the discussion of the \skewchar in this post.

I know that one option would be to try other fonts, but I don't like this for two reasons: Firstly, I otherwise do like the appearance of the standard fonts, and secondly, if I use different fonts, then I'll still have to live with looking at the slides of all the others who use the standard fonts. So my questions are: Does there exist a fix that gives me well-behaved standard fonts with beamer, and is there hope that the above LaTeX file will yield correctly positioned accents in some future version of beamer? (I think it wouldn't be a problem to make such a change in the fonts of the class as it won't affect the bounding box of, e.g. \dot u, so it wouldn't lead to any changes in spacing, line breaks and page breaks.)

  • 1
    +1 Yeah! That also annoys me to no end. My personal "solution" to it has been to avoid math accents as much as possible when using Beamer. I would love it if someone has an answer. Oct 16, 2010 at 14:09
  • 1
    @Willie Wong: Since avoiding math talks as much as possible is not a viable solution, I'll probably notify the beamer maintainers, as proposed by Khaled. Oct 17, 2010 at 7:59
  • @Willie: I went ahead and talked to Joseph Wright; you can find a preliminary result below. Dec 22, 2010 at 14:40
  • @Willie: I recently saw the first beamer talk with properly placed accents! Sep 9, 2012 at 14:32
  • @HendrikVogt With TeXLive 2012 and the latest version of beamer, should we still use the package sansmathaccent? Sep 9, 2012 at 15:48

6 Answers 6


You can use the \skew macro:


Specifically, I would define macros for the symbols. So they can easily be adjusted later, especially if a font change occurs.


Gives in beamer:

alt text

  • Thanks, that's not a bad workaround. I'll still have to guess the amount of the skew, but at least the macro is easy to use. What a pity that other people won't use the workaround and I'll still have to see all these talks with misaligned accents. Dec 21, 2010 at 16:10

OK, after talking to Joseph Wright I went ahead and wrote a patch for cmssi, which is the standard math font in beamer. The problem is that this font (computer modern sans serif italics) is designed as a text font, so it doesn't contain any information about positioning of accents. Compare these for before and after patching:

Now the answer (hopefully) is in its final version and ready for use. However, what I'm going to write will only work on Unix type systems. Strangely enough, the patch I initially wrote for 10pt works also great for the other sizes.

Here's what you have to do in order to obtain nicely positioned accents. No change to the actual TeX files is needed, and nothing in the output will change except the accent positions. OK, create some testing directory and run the following script. (If you have root rights on your system, you probably want to replace the updmap command with updmap-sys; thanks, Herbert! Moreover, the map file that gets deleted in the end should probably be stored at some proper location, but I'm not sure where.)

# Create the patch file:
echo '17a18,61
>    (LABEL C E)
>    (LABEL C H)
>    (LABEL C M)
>    (LABEL C N)
>    (LABEL C Q)
>    (LABEL C i)
>    (LABEL C j)
>    (KRN O 177 R 0.1)
>    (STOP)
>    (LABEL C J)
>    (KRN O 177 R 0.22)
>    (STOP)
>    (LABEL C e)
>    (LABEL C m)
>    (LABEL C n)
>    (LABEL C r)
>    (LABEL C B)
>    (LABEL C R)
>    (LABEL C S)
>    (LABEL C Z)
>    (KRN O 177 R 0.08)
>    (STOP)
>    (LABEL C c)
>    (LABEL C q)
>    (LABEL C s)
>    (LABEL C z)
>    (KRN O 177 R 0.06)
>    (STOP)
>    (LABEL C v)
>    (LABEL C x)
>    (KRN O 177 R 0.04)
>    (STOP)
>    (LABEL C h)
>    (KRN O 177 R 0.02)
>    (STOP)
>    (LABEL C l)
>    (LABEL C U)
>    (KRN O 177 R 0.11)
>    (STOP)
>    (LABEL C d)
>    (LABEL C C)
>    (LABEL C G)
>    (KRN O 177 R 0.12)
>    (STOP)
>    (KRN O 177 R 0.1)
>    (KRN O 177 R 0.04)
>    (KRN O 177 R 0.03)
>    (KRN O 177 R 0.08)
>    (KRN O 177 R 0.04)
>    (KRN O 177 R 0.1)
>    (KRN O 177 R 0.07)
>    (KRN O 177 R 0.08)
>    (KRN O 177 R 0.06)
>    (KRN O 177 R 0.09)
>    (KRN O 177 R 0.06)
>    (KRN O 177 R 0.08)
>    (KRN O 177 R 0.1)
>    (KRN O 177 R 0.05)
>    (KRN O 177 R 0.06)
>    (KRN O 177 R 0.08)
>    (KRN O 177 R 0.07)
>    (KRN O 177 R 0.08)
>    (KRN O 177 R 0.14)
>    (KRN O 177 R 0.05)
>    (KRN O 177 R 0.01)
>    (KRN O 177 R 0.1)' > cmssi.patch
# Patch the font metrics of cmssi8, 9, 10, 12 and 17:
for i in 8 9 10 12 17; do
tftopl $(kpsewhich cmssi$i.tfm) > cmssmi$i.pl
patch cmssmi$i.pl cmssi.patch
pltotf cmssmi$i.pl
# Include the patched font in beamerbasefont.sty and define its \skewchar:
cp $(kpsewhich beamerbasefont.sty) newbeamerbasefont.sty
sed '
' newbeamerbasefont.sty > beamerbasefont.sty
# Make the font metric available to the system:
echo 'cmssmi8 cmssmi8 <cmssi8.pfb
cmssmi9 cmssmi9 <cmssi9.pfb
cmssmi10 cmssmi10 <cmssi10.pfb
cmssmi12 cmssmi12 <cmssi12.pfb
cmssmi17 cmssmi17 <cmssi17.pfb' > cmssmi.map
updmap --enable Map=cmssmi.map
# clean up:
rm cmssi.patch cmssmi{8,9,10,12,17}.pl newbeamerbasefont.sty cmssmi.map

This creates six files: five tfm files named cmssmi<n>.tfm , which contain the patched font metrics, and beamerbasefont.sty, which will be used instead of the original beamerbasefont.sty. (I thought that cmssmi is nice for "computer modern sans serif math italics".) Now you're ready to go and test the following example TeX file. This should go into the same testing directory since the above six files are only available there. Feedback is highly appreciated!

\renewcommand\test[1]{{$#1 ##1_{{#1 ##1_{#1 ##1}}}$} }
\test a
\test b
\test c
\test d
\test e
\test f
\test g
\test h
\test i
\test j
\test k
\test l
\test m
\test n
\test o
\test p
\test q
\test r
\test s
\test t
\test u
\test v
\test w
\test x
\test y
\test z
\test A
\test B
\test C
\test D
\test E
\test F
\test G
\test H
\test I
\test J
\test K
\test L
\test M
\test N
\test O
\test P
\test Q
\test R
\test S
\test T
\test U
\test V
\test W
\test X
\test Y
\test Z

  • Hendrik: Your solution works beautifully on UNIX-type systems. Would you mind if I turned it into a fonts package and uploaded it to CTAN?
    – user13668
    Apr 25, 2012 at 23:53
  • @Ariel: I'd be happy if you do that. My original hope had been that this would just be included into the standard beamer package, but my report on the beamer issue tracker has been unresolved for more than a year now. So please go ahead and upload it to CTAN, that would be a great step in the right direction! Apr 26, 2012 at 11:07
  • Done; it is on CTAN under the name "sansmathaccent" (ctan.org/pkg/sansmathaccent). (I apologize for posting this in the wrong place, but as far as I can tell, I haven't been using stackexchange long enough to actually make comments.)
    – user13668
    Apr 29, 2012 at 16:56

Apparently the default beamer font is not suitable font for quality math typesetting (lacking proper accent positioning is one aspect, but I suspect there are more).

There is no way to fix this except by using a proper math font, see this for samples of different math fonts with beamer. Of course, it would be much better if beamer maintainers were notified to set a better font by default.

  • 1
    I don't think Beamer does set a particular font. It just sets the font family to sans serif, so you get CMSS. I'm not sure it's good practice for a general-use document class to pick a nonstandard (and hence, not guaranteed to exist) font for the user. The class does offer an option \usefonttheme[onlymath]{serif} to revert to normal math.
    – frabjous
    Oct 16, 2010 at 14:20
  • This is a "particular font" in my book, CM is the default LaTeX font, so CMSS is the default sans serif font; it is not just a random sans serif font. And since the question is about the default behaviour, which is a legitimate request IMO, I think some one have to discuss this beamer maintainers. Of course fixing the actual font is much better, but I don't think one is allowed to touch CM and keep calling it CM. Oct 16, 2010 at 14:36
  • @frabjous: I think I was in some talks where people did use \usefonttheme[onlymath]{serif}, and I would say that the normal serif math font does not go well with the sans serif text font. Oct 16, 2010 at 16:58
  • The pdf file you give in your link has an interesting list of fonts, but the only sans serif math font with proper accent positioning I found there is CMBright, which seems too thin to me (as also mentioned on page 6 of the pdf file). What a pity! Oct 16, 2010 at 17:32

I suggest using


in the preamble. This turns the math-fonts into serif ones, so that you have a better visual separation between math and normal text. And it gives you proper math fonts.

  • Thanks for your answer, but see my comment to dan's answer. Jan 5, 2011 at 15:29

I find sans-serif fonts ugly for talks. They are hard to read in books, so I don't see any reason to use them in talks, either. The following looks reasonably good to me. (I also slightly adjusted the accenting commands.)

$\widetilde{M}$ $\dot u$ $\widehat{T}$
  • 1
    In the moment I can't give a particular reason for using sans serif fonts in talks, but that's what people recommend, and I like it. By the way, the positioning of the accents in your example file is only slightly better than in mine. (Regarding adjusted accenting commands: I used \tilde and \hat above since this is what I saw in the talks.) Oct 18, 2010 at 5:36
  • Sans-serif are recommended (by some) for short texts, like headlines, logos etc. So it makes sense to use them for presentations, which don't have much running text usually. Apr 26, 2012 at 6:32

I use


and also experience bad positioning of math accents. I use a quick and dirty hack to make some corrections which in most cases work:





Disclaimer: I know that this is not a good idea.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .