6

My problem appears to be related to this earlier post:

Parentheses differ (XeLaTeX, fontspec, newtxmath, libertine)

but mine seems even simpler. My problem is that when I compile a simple beamer presentation and use the fontspec or mathspec packages, the parentheses are spaced poorly. As an MWE, when I compile the following with XeLaTeX:

\documentclass{beamer}
%\usepackage{fontspec}
\begin{document}  
\frame{
Hello!  $f(x)=x^2$
}
\end{document}

I get just what I would want:

a good picture with properly spaced parentheses

However, when I uncomment the fontspec bit,

\documentclass{beamer}
\usepackage{fontspec}
\begin{document}  
\frame{
Hello!  $f(x)=x^2$
}
\end{document}

I see the following:

a bad picture with ugly parentheses

Does anyone know what can be causing this? I don't see mention of parentheses in the documentation.

2
  • I think the problem is beamer+fontspec, not with fontspec. In fact beamer sets all the text (including math) in sans serif and this causes the problem. I guess I've seen similar threads in this site, but at the moment I can't find one... Sep 11, 2013 at 19:50
  • BTW: It's not a good practice to load fontenc when compiling with xetex, but adding the line \usepackage[T1]{fontenc} seems to solve the problem, until you get a better answer... Sep 11, 2013 at 20:01

1 Answer 1

6

XeTeX fails to set the correct italic correction in math (http://tug.org/pipermail/xetex/2011-March/020318.html) when open type fonts are used. I would suggest to use the normal T1-encoded font for the letters_

\documentclass{beamer}

\usepackage{fontspec}
\AtBeginDocument{%
  \DeclareSymbolFont{pureletters}{T1}{lmss}{\mddefault}{it}%
  }


\begin{document}

$f(x)$

\end{document}

Edit 2017

With the new latex format which uses opentype fonts by default with xelatex you will get the wrong spacing without any external packages like fontspec:

\documentclass{beamer}

%\AtBeginDocument{%
%      \DeclareSymbolFont{pureletters}{T1}{lmss}{\mddefault}{it}%
%      }

\begin{document}

\begin{frame}
\[f(x)\]
\end{frame}

\end{document}

enter image description here

1
  • If you use the mathserif option and want to stay with classical Computer Modern, do \DeclareSymbolFont{pureletters}{OT1}{cmr}{\mddefault}{it}. Jul 8, 2014 at 12:42

You must log in to answer this question.

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