3

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!

5

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.

  • 1
    You may want to mention that, as a non-math font, Arial does not have a proper “math table”, and thus the math formulas will be sub-optimal. The t touching = in the subscript of the \sum, the i touching ) in the summand, etc. – Ruixi Zhang Jan 13 at 3:22
  • Also, by issuing \defaultfontfeatures{Scale=MatchLowercase} you are effectively scaling Arial against Latin Modern, which is probably undesired (as the “main” font, there is no need to be scaled). For this reason, you may want to add \defaultfontfeatures[\rmfamily]{Scale=1} as well. See the last paragraph before Section 6.3 in the fontspec manual. – Ruixi Zhang Jan 13 at 3:34
  • @RuixiZhang The [Scale=1.0] suggestion is good, and I might edit it in. I usually do have something like that. – Davislor Jan 13 at 3:57
  • 1
    Hello @Davislor! Thank you for your answer! Like I understood the above example is for LuaLaTex or XeLaTeX only. The below example works with pdfLaTeX too? Another (maybe not smart) question: As you wrote (see also) is the default since 2018, why do you have it in the preamble? – Su-47 Jan 15 at 13:10
  • 1
    @Su-47 If you are on Windows, or installed MS Office. and already own the fonts, the instructions are here: ctan.org/tex-archive/fonts/winfonts (But remember, these fonts are copyrighted.) You might also want tug.org/fonts/getnonfreefonts which contains uarial. – Davislor Jan 17 at 1:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.