[Tex/LaTex] How to use math mode and siunitx with arial

fontsmath-modesiunitx

I have to use arial within the whole document. My code:

\documentclass[ngerman]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage{
            lmodern,
            babel,
            uarial,%from https://tex.stackexchange.com/questions/23957/how-to-set-font-to-arial-throughout-the-entire-document/23961#23961
            amsmath,
            eurosym
           }
%from https://tex.stackexchange.com/questions/23957/how-to-set-font-to-arial-throughout-the-entire-document/23961#23961
\renewcommand{\familydefault}{\sfdefault}
\usepackage[locale=DE]{siunitx}
%from https://tex.stackexchange.com/questions/110972/eurosym-seems-to-not-be-working/110979?r=SearchResults#110979
\DeclareRobustCommand{\officialeuro}{%
  \ifmmode\expandafter\text\fi{
  \fontencoding{U}\fontfamily{eurosym}\selectfont e}}
\begin{document}

  Text.
  \begin{align}
    K & = A_0 + \sum\limits_{t = 1}^{T} A_t ( 1 + i )^{-t} \text{, mit $T = 3$ und } i = \SI{4}{\percent} = \frac{4}{100} \Rightarrow\\
      & = \left( - 500 + \ldots + \frac{200}{1{,}04^3}\right) \EUR{1000}
  \end{align}
  Text.

\end{document}

The result:

result

My observation:

  1. If I have \text{} in a math mode than it appears sans serif.
  2. siunitx content appears sans serif too, even numbers.
  3. But all other content appears in serif.

Than I have a mixture of sans serif and serif. I don't have the experience in this area and don't know how it should be. For me it looks inconsistently. I found a lot of information here (1, 2 and 3) and don't know what I should to use.

Which is the usually way?

Thank you for your help and effort in advance!

Best Answer

The Modern Way

I personally recommend you use unicode-math on LuaLaTeX or XeLaTeX when you can, and the legacy toolchain when you have to. You’ll get more symbols with more consistency than any combination of legacy packages could give you, it’ll be simpler, and you’ll even be able to copy and paste from the PDF.

It also allows you to use any system font in LaTeX, including Arial from the MS core fonts.

\documentclass[ngerman]{scrartcl}
\usepackage{amsmath}
\usepackage{unicode-math}
\usepackage{babel}

\defaultfontfeatures{ Scale=MatchLowercase, Ligatures = TeX }
\setmainfont{Arial}
\setsansfont{Arial}
\setmonofont{Andale Mono}
\setmathfont{GFSNeohellenicMath.otf}
\setmathfont[range=up]{Arial}
\setmathfont[range=it]{Arial Italic}
\setmathfont[range=bfup]{Arial Bold}
\setmathfont[range=bfit]{Arial Bold Italic}
\setmathfont[range=tt]{Andale Mono}

\newcommand\EUR[1]{\mbox{#1\,\texteuro}}

\usepackage[locale=DE]{siunitx}

\begin{document}
\begin{minipage}{10cm}
  Text.
  \begin{align}
    K & = A_0 + \sum\limits_{t = 1}^{T} A_t ( 1 + i )^{-t} \text{, mit $T = 3$ und } i = \SI{4}{\%} = \frac{4}{100} \Rightarrow\\
      & = \left( - 500 + \ldots + \frac{200}{1{,}04^3}\right) \EUR{1000}
  \end{align}
  Text.
\end{minipage}
\end{document}

MS Arial sample

With Modest Changes

This version adapts your MCVE with the following adjustments: It explicitly sets up textcomp to use the Arial version of the Euro symbol (and declares \EUR for compatibility), sets the math symbols to the sans-serif version of newtx, and sets the math letters to the text font with mathastext.

\documentclass[ngerman]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} % The default since 2018
\usepackage{
            lmodern,
            babel,
            newtxsf,
            uarial,%from https://tex.stackexchange.com/questions/23957/how-to-set-font-to-arial-throughout-the-entire-document/23961#23961
            textcomp,
            amsmath
           }
%from https://tex.stackexchange.com/questions/23957/how-to-set-font-to-arial-throughout-the-entire-document/23961#23961
\renewcommand{\familydefault}{\sfdefault}
\usepackage[italic]{mathastext}

\newcommand\EUR[1]{\mbox{#1\,\texteuro}}

\usepackage[locale=DE]{siunitx}

\begin{document}
\begin{minipage}{10cm}
  Text.
  \begin{align}
    K & = A_0 + \sum\limits_{t = 1}^{T} A_t ( 1 + i )^{-t} \text{, mit $T = 3$ und } i = \SI{4}{\%} = \frac{4}{100} \Rightarrow\\
      & = \left( - 500 + \ldots + \frac{200}{1{,}04^3}\right) \EUR{1000}
  \end{align}
  Text.
\end{minipage}
\end{document}

URW Arial sample

It is also possible to use Microsoft’s version of Arial in PDFTeX through the winfonts package. Use the command \fontfamily{arial}\selectfont, or redefine \familydefault and perhaps \sfdefault.

\documentclass[ngerman]{scrartcl}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc} % The default since 2018
\usepackage{
            lmodern,
            babel,
            newtxsf,
            winfonts,
            textcomp,
            amsmath
           }

\renewcommand{\sfdefault}{arial}
\renewcommand{\familydefault}{\sfdefault}
\usepackage[italic]{mathastext}

\newcommand\EUR[1]{\mbox{#1\,\texteuro}}

\usepackage[locale=DE]{siunitx}

\begin{document}
\begin{minipage}{10cm}
  Text.
  \begin{align}
    K & = A_0 + \sum\limits_{t = 1}^{T} A_t ( 1 + i )^{-t} \text{, mit $T = 3$ und } i = \SI{4}{\%} = \frac{4}{100} \Rightarrow\\
      & = \left( - 500 + \ldots + \frac{200}{1{,}04^3}\right) \EUR{1000}
  \end{align}
  Text.
\end{minipage}
\end{document}

Arial font sample

Including the winfonts package isn’t strictly necessary here, but at least requiring it tells the user what package needs to be installed.

Related Question