[XeTeX] Unicode sans serif math

76nemo76 at gmx.ch 76nemo76 at gmx.ch
Mon Dec 4 10:35:04 CET 2017


Hi All,
      Finally I have found a solution even if I don't know if
it is fully correct.

The following document can be typeset with the sans serif font «DejaVuSans»
(when xelatex is used) or with the similar font «arev» (when pdftex is used). 

The mathematical part is correctly set in sans serif font 
and even a greek text (for an Euclid
citation for instance) would be correctly typeset if the font «DejaVuSans»
is used.

Alan

--------------------------MathSanserif.tex-------------------------------
\documentclass{article}

\usepackage{iftex}
\usepackage{amsmath}

\ifXeTeX
   \usepackage{fontspec}
   \usepackage{unicode-math}
      %DejaVuSans
      %\setmathfont{texgyredejavu-math.otf}
      \setmathfont{LucidaBrightMathOT.otf} %Font color match better with dejaVuSans
      \setmathfont{DejaVuSans.ttf}[range=up]
      \setmathfont{DejaVuSans.ttf}[range=bb->bfsfup]
      \setmathfont{DejaVuSans-Oblique.ttf}[range=it]
      \setmathfont{DejaVuSansMono.ttf}[range=tt]
      \setmathfont{DejaVuSans-Bold.ttf}[range=bfup]
      \setmathfont{DejaVuSans-BoldOblique.ttf}[range=bfit]
   \setmainfont{DejaVuSerif}[
      Extension=.ttf,
      UprightFont=*,
      ItalicFont=*-Italic,
      BoldFont=*-Bold,
      BoldItalicFont=*-BoldItalic,
      ]
   \setsansfont{DejaVuSans}[
      Extension=.ttf,
      UprightFont=*,
      ItalicFont=*-Oblique,
      BoldFont=*-Bold,
      BoldItalicFont=*-BoldOblique,
   ]
   \setmonofont{DejaVuSansMono}[% main typewriter
      Extension=.ttf,
      UprightFont=*,
      ItalicFont=*-Oblique,
      BoldFont=*-Bold,
      BoldItalicFont=*-BoldOblique,
   ]
   \renewcommand\familydefault{\sfdefault}
\else
  \RequirePackage[T1]{fontenc}
  \RequirePackage[utf8]{inputenc}%
  \newcommand\pointcentre{\ifmmode\cdot{}\else\textperiodcentered{}\fi}
  \RequirePackage{newunicodechar}
  \newunicodechar{×}{\ensuremath{\times}}
  \newunicodechar{Φ}{\ensuremath{\Phi}}
  \newunicodechar{φ}{\ensuremath{\phi}}
  \newunicodechar{Δ}{\ensuremath{\Delta}}
  \newunicodechar{α}{\ensuremath{\alpha}}
  \newunicodechar{±}{\ensuremath{\pm}}
  \newunicodechar{∞}{\ensuremath{\infty}}
  \newunicodechar{≠}{\ensuremath{\neq}}
  \newunicodechar{∀}{\ensuremath{\forall}}
  \newunicodechar{→}{\ensuremath{\rightarrow}}
  \newunicodechar{·}{\pointcentre}
  \newunicodechar{⇔}{\ensuremath{\Leftrightarrow}}
  \newunicodechar{ℤ}{\ensuremath{\mathbb{Z}}}
  \newunicodechar{∈}{\ensuremath{\in}}
  \usepackage{arev}
\fi


\begin{document}

\section{Number $\mathbf{φ}$ properties}
This is one interessant property:
\begin{equation}
	φ^2=φ+1 
\end{equation}

and an other one (related to Fibonacci numbers)

\begin{equation}
	\lim_{n→∞} \dfrac{F_{n+1}}{F_n}=φ
\end{equation}

Finally the last property $\frac{1}{φ}=φ-1$ to have a formula inline.
\end{document}


More information about the XeTeX mailing list