1

In my beamer, I applied "\setmainfont{Arial}" and "\setsansfont{Arial}" to set the main font as Arial, and I would like to apply the same or a similar font in the math mode. I write my LaTeK code as below, thanks to Tilde in math mode using helvetica.

However, there are many errors when running the code even if the pdf file can be still generated.

enter image description here

and the "\partical" cannot be displayed.

enter image description here

Shall I use another kind of font? I just want to use a math font that looks like Arial and also has an effect on the Greek alphabet like "\alpha" or "\varepsilon".

\documentclass[10 pt]{beamer}
\usepackage{amsmath, amssymb}
\setmainfont{Arial}
\setsansfont{Arial}
\numberwithin{equation}{section}
\usepackage{mathtools}
\usepackage{iftex}
\usepackage[ngerman]{babel} 

\ifPDFTeX
\usepackage[T1]{fontenc}
\usepackage[scaled=0.92]{helvet}
\usepackage[helvet]{sfmath}
\renewcommand{\familydefault}{\sfdefault}
\else
\usepackage{unicode-math}
\setmainfont{Arial}
\defaultfontfeatures{Scale=MatchUppercase}
\setsansfont{Arial}
%% Change this line to change the math symbols:
\setmathfont{Asana Math}
%% Set various (but not all) Unicode tilde symbols:
\setmathfont[range={"007E,"02DC,"02F7,"0303,"0330,"0334,"033F,"034A,"0360}]{TeX Gyre DejaVu Math}
%% Set the math alphabets:
\setmathfont[range=up]{Arial}
\setmathfont[range=it]{Arial Italic}
\setmathfont[range=bfup]{Arial Bold}
\setmathfont[range=bfit]{Arial Bold Italic}

\newcommand*{\dif}{\mathrm{d}}
\newcommand*{\N}{\mathrm{N}}

\begin{decument}
    \begin{frame}

    The equations were presented as
    \begin{align}
        &y_{i} = \beta_{1}x_{i, 1} + \beta_{2}\sin(x_{i, 2}) + \beta_{3}\ln(x_{i, 3}) + \varepsilon_{i} \quad \Phi(x) = 1-\Phi(-x) \\
        &\dfrac{\dif y}{\dif x} = e^{x} \quad \dfrac{\partial u}{\partial t}\bigg|_{t=0} = t \quad \oint_{|C|=1} f(z) \dif z = 2\pi i \times \left\lbrace \mathrm{res}[f(z), i] \right\rbrace \\
        &x_{n} \iid \N(0, 1) \quad x^{2}_{n} \iid \chi^{2}(1) \quad \sum_{n=1}^{N} x_{n} \iid \chi^{2}(N) \\
        &\iint_{R} g(x,y)\dif x\dif y= \int_{0}^{1}\dif x \int_{0}^{1}g(x,y)\dif y \quad \lim\limits_{\rho \to 0}h(\rho) = 0\left( \dfrac{1}{\alpha} \right) \\
        & x =\begin{cases}
            1, \mathcal{H}_{0}\\
            0, \mathcal{H}_{1} 
        \end{cases}\; (2\pi L(x;\mu,\sigma^{2}) = \sigma^{2})^{-\frac{N}{2}}\exp\left\lbrace -\dfrac{\sum_{n=1}^{N}(x_{n} - \mu)^{2}}{2\sigma^{2}} \right\rbrace 
    \end{align}
    \end{frame}
\end{document}
1
  • Your document not compile: fix typo \begin{decument} and there are double \setsansfont{Arial} and many mix of the packages. And do you want use helvet with arial togheter?
    – Sebastiano
    Apr 6, 2020 at 10:42

1 Answer 1

0

You can use the package \usepackage{sansmath}and not only \sfmath to set the font for all the document.

Please, check this thread for a full discussion about Math font setting: Typeset mathematical symbols also in sans serif font?

I hope it helps.

You must log in to answer this question.

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