# Glitch in math fonts caused by TU font encoding in new 2ekernel (XeTeX/LuaTeX) #375

Closed
opened this issue Feb 7, 2017 · 6 comments

Projects
None yet
3 participants
Collaborator

### louisstuart96 commented Feb 7, 2017 • edited

 MWE: \documentclass{beamer} \usefonttheme{serif} \begin{document} \begin{frame} $f(x)$ \end{frame} \end{document}  The glue between f' and left parenthesis is incorrect. I've checked the \mv@normal and mv@bold macros, the fonts used in math symbols and alphabets are: \symoperators OT1/cmr/m/n \symletters OML/cmm/m/it \symsymbols OMS/cmsy/m/n \symlargesymbols OMX/cmex/m/n \symAMSa U/msa/m/n \symAMSb U/msb/m/n \symnumbers TU/lmr/m/n \sympureletters TU/lmr/m/it \mathnormal \symletters \mathcal \symsymbols \mathrm TU/lmr/m/n \mathbf TU/lmr/bx/n \mathsf TU/lmss/m/n \mathit TU/lmr/m/it \mathtt TU/lmtt/m/n \mathfrak U/euf/m/n This patch after \fonttheme{serif} won't work (though it might be necessary when using \usepackage[T1]{fontenc}) \SetSymbolFont{operators}{normal}{\encodingdefault}{\mathfamilydefault}{\mddefault}{n} \ifx\mv@bold\@undefined \else \SetSymbolFont{operators}{bold}{\encodingdefault}{\mathfamilydefault}{\bfdefault}{n} \fi  Test for sans-serif math font is ongoing. Perhaps we should report bug to 2ekernel team?

### louisstuart96 changed the title Giltch in math fonts caused by TU font encoding in new 2ekernel (XeTeX/LuaTeX)Glitch in math fonts caused by TU font encoding in new 2ekernel (XeTeX/LuaTeX)Feb 7, 2017

Collaborator Author

### louisstuart96 commented Feb 7, 2017

 I forget font theme professional... This could solve the problem, but maybe it's better to patch the default font settings (or patch 2ekernel itself).

Owner

### josephwright commented Feb 8, 2017

 Math mode is unchanged by recent TU modification in the kernel: any issues are at the beamer end :)

### u-fischer commented Mar 10, 2017

 This just came up in a german group too. xetex has a problem with the italic correction when opentype text fonts are used in math (https://tex.stackexchange.com/questions/132835/fontspec-mathspec-ruins-my-parentheses-with-beamer). As beamer uses \encodingdefault to setup the math font for the letters in a new latex format open type fonts are used for the letters. I would suggest to revert at least with xelatex to OT1 or T1: \documentclass{beamer} %\usefonttheme{serif} \AtBeginDocument{% \DeclareSymbolFont{pureletters}{T1}{\mathfamilydefault}{\mddefault}{it}% } \begin{document} \begin{frame} $f(x)$ \end{frame} \end{document}  While this works fine with the default fonts, it will break as soon as other (open type) text fonts are used with fontspec for which T1+\mathfamilydefault will not exist. I don't see a good solution beside asking the users to give \mathfamilydefault a better definition ...

### louisstuart96 reopened this Nov 26, 2017

Collaborator Author

### louisstuart96 commented Nov 26, 2017 • edited

 Current math font scheme change all letters from OML encoding to text-based encoding (OT1, T1, TU, etc). The metrics differ a lot between fonts related to these two groups of encodings. This is improper in typesetting formulas. Besides, current 'sans-serif math' setting only covers basic operators, latin letters, capital Greek letters and numbers. For example, in a formula, some variables are denoted by latin letters, others denoted by a Greek letters, the output will be a mess. I'm planning to test the following strategy: Choose a scheme based on \ifbeamer@sansmath. We can either load sansmathfonts package or make use of its fonts manually. (No need to use sansmathaccent since metrics are adjusted to fit the accents well) Apply math font schemes at the end of font themes, instead of in \AtBeginDocument hook. For example, default font theme will apply sans-serif scheme, and serif font theme will override it with serif scheme.

Closed

Owner

### josephwright commented Dec 1, 2017

 @louisstuart96 Certainly the font situation now is very different from that when beamer was first written. Perhaps we should consider a release which just changes this, plus a mechanism to back up to the current approach (page option oldfontsetup`, perhaps).
Collaborator Author

### louisstuart96 commented Dec 2, 2017

 @josephwright Changing to new font settings while reserving the old ones would be a hard work. Shall we ask Tantau for his suggestions?

Open