Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I switched to XeLaTeX and unicode-math a while ago. I really like the possibility to combine different fonts for mathematical symbols. But now I run into trouble by combining the \underbrace command with content from different fonts. I actually use Asana as my main math font, but don't like its \underbrace, as these are too wide and with too much space between itself and the content. Therfore I wanted to use some from another font, which gave some grapy output:

\documentclass[]{scrartcl}

\usepackage{amsmath}

\usepackage{polyglossia}
\setmainlanguage[]{english}
\setotherlanguage[spelling=new,babelshorthands=true]{german}

\usepackage{unicode-math}
  \setmathfont{Asana-Math.otf}

\begin{document}
  Asana math Blubb
  \[
    \underbrace{1} \quad \underbrace{1+1} \quad \underbrace{1+1+1} \quad \underbrace{1+1+1+1} \quad \underbrace{1+1+1+1+1}
  \]
  \setmathfont[]{xits-math.otf}
  XITS math
  \[
    \underbrace{1} \quad \underbrace{1+1} \quad \underbrace{1+1+1} \quad \underbrace{1+1+1+1} \quad \underbrace{1+1+1+1+1}
  \]
  \setmathfont[]{Cambria Math}
  Cambria Math
  \[
    \underbrace{1} \quad \underbrace{1+1} \quad \underbrace{1+1+1} \quad \underbrace{1+1+1+1} \quad \underbrace{1+1+1+1+1}
  \]
  \setmathfont[]{latinmodern-math.otf}
  Latin modern
  \[
    \underbrace{1} \quad \underbrace{1+1} \quad \underbrace{1+1+1} \quad \underbrace{1+1+1+1} \quad \underbrace{1+1+1+1+1}
  \]
  \setmathfont[]{texgyrepagella-math.otf}
  Neo Euler
  \[
    \underbrace{1} \quad \underbrace{1+1} \quad \underbrace{1+1+1} \quad \underbrace{1+1+1+1} \quad \underbrace{1+1+1+1+1}
  \]
  Asana as math font, change font for underbrace only:
  \setmathfont[]{Asana-Math.otf}
  \[
    \underbrace{1} \quad \underbrace{1+1} \quad \underbrace{1+1+1} \quad \underbrace{1+1+1+1} \quad \underbrace{1+1+1+1+1}
  \]
  \setmathfont[range=\mathunder]{xits-math.otf}
  XITS math
  \[
    \underbrace{1} \quad \underbrace{1+1} \quad \underbrace{1+1+1} \quad \underbrace{1+1+1+1} \quad \underbrace{1+1+1+1+1}
  \]
  \setmathfont[range=\mathunder]{Cambria Math}
  Cambria Math
  \[
    \underbrace{1} \quad \underbrace{1+1} \quad \underbrace{1+1+1} \quad \underbrace{1+1+1+1} \quad \underbrace{1+1+1+1+1}
  \]
  \setmathfont[range=\mathunder]{latinmodern-math.otf}
  Latin modern
  \[
    \underbrace{1} \quad \underbrace{1+1} \quad \underbrace{1+1+1} \quad \underbrace{1+1+1+1} \quad \underbrace{1+1+1+1+1}
  \]
  \setmathfont[range=\mathunder]{texgyrepagella-math.otf}
  Neo Euler
  \[
    \underbrace{1} \quad \underbrace{1+1} \quad \underbrace{1+1+1} \quad \underbrace{1+1+1+1} \quad \underbrace{1+1+1+1+1}
  \]
\end{document}

Is there any workaround for this? Or is it in general no good idea to combine different math fonts?

I'm in general not so sure if to stay with unicode-math, as the compilation speed slows down, and for example the XITS font has much too narrow spacing sometimes (using XeTeX, Version 3.1415926-2.4-0.9998, MiKTeX 2.9)

Annotation

According to the first comment I just tried the TeX Gyre Pagella Math which also seems to be a nice font with better underbraces than Asana-math. But this brought me just to another behavior of unicode-math with XeLaTeX I have noticed before already but forgotten about. If I run the following code:

\documentclass{article}

\usepackage{amsmath}
\usepackage{unicode-math}
\setmathfont{texgyrepagella-math.otf}


\begin{document}
Test.
\begin{align*}
  \frac{1}{x^2} \quad \underbrace{1+1+1+1+1}_F \underbrace{1+1}_F \underbrace{i}_F
\end{align*}
\end{document}

enter image description here

Some minor changes that do not directly affect the math environment can change this behavior:

\documentclass{article}

\usepackage{amsmath}
\usepackage{unicode-math}
\setmathfont{texgyrepagella-math.otf}


\begin{document}
\begin{align*}
  \frac{1}{x^2} \quad \underbrace{1+1+1+1+1}_F \underbrace{1+1}_F \underbrace{i}_F
\end{align*}
Some text.
\end{document}

enter image description here

I once got a similar behavior when I did a beamer presentation (using Asana-math, if I remember correctly) where changes anywhere in the TeX code could affect the braces in the shown way. I thought that this would maybe depend on the special circumstances of using beamer, but apparently hopping underbraces can appear anytime. Did anybody else see such a behavior of the \underbrace command before?

share|improve this question
1  
You should try TeX Gyre Pagella Math instead of Asana Math –  egreg Aug 27 '13 at 15:34
    
Thanks. Looks good and I will give it a try. –  Hypnotoad Aug 27 '13 at 18:33
    
The shifting braces is a big that was fixed in XeTeX 0.9999. –  Khaled Hosny Aug 27 '13 at 21:12
    
This is good new, but until now I avoided updating due to link –  Hypnotoad Aug 28 '13 at 8:59
    
This question appears to be off-topic because it is about a bug which is now fixed. –  Joseph Wright Sep 7 '13 at 21:48
add comment

closed as off-topic by Joseph Wright Sep 7 '13 at 21:48

  • This question does not fall within the scope of TeX, LaTeX or related typesetting systems as defined in the help center.
If this question can be reworded to fit the rules in the help center, please edit the question.