5

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!

Su-47
  • 2,508
  • 2
    I don't recommend uarial: https://tex.stackexchange.com/a/309120/2388 – Ulrike Fischer Jan 11 '19 at 23:45
  • Back in 2012 some work (need to translate using url from German) was done by Günter Milde with a kudos to @UlrikeFischer see http://milde.users.sourceforge.net/ . lots of nice tables such as http://milde.users.sourceforge.net/Matheschriften/matheschriften.html with sources at http://milde.users.sourceforge.net/Matheschriften/?C=M;O=A –  Jan 12 '19 at 01:36
  • Do you really have to use Arial? Arial is not a math font, which means you get sub-optimal (and sometimes ugly) math formulas by substituting math fonts with Arial. If your goal is to have sans-serif for your whole document, why not consider using Fira Go as your text and Fira Math as your math? See the home page of Fira Math for showcase. (Unrelated note: Use \cdots instead of \ldots, ;-)) – Ruixi Zhang Jan 13 '19 at 03:26
  • Hello @Ruixi Zhang! Yes I have to use arial. – Su-47 Jan 15 '19 at 13:05

1 Answers1

11

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.

Davislor
  • 44,045
  • 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 '19 at 03: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 '19 at 03: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 '19 at 03:57
  • @RuixiZhang Unfortunately, the only sans-serif Unicode math font currently available is Fira Math, which is a work in progress. My choice of a font with wide equals signs as the backup made that issue worse. – Davislor Jan 13 '19 at 04:00
  • 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 '19 at 13:10
  • @Su-47 Yes, you’re right about which TeX engines to use. – Davislor Jan 15 '19 at 13:17
  • @Su-47 I add inputenc to all my PDFTeX examples here so that they will still work in older installations. In this case, it’s not needed: I don’t actually use any non-ASCII input characters. – Davislor Jan 15 '19 at 13:19
  • Hello @Davislor! Thank you for your comments! One last thing: Have one the chance to use arial instead of uarial without to move to LuaLaTeX or XeLaTeX? If yes, could you please add a third example showing it? Thank you for your help and effort in advance! – Su-47 Jan 15 '19 at 22:50
  • @Su-47 Yes, the winfonts package lets you do that. – Davislor Jan 15 '19 at 22:52
  • Hello @Davislor! Thank you for the third example and the comments! Next task: I use MiKTeX and it doesn't contain winfonts. Is there a way to get it working? Thank you for your help and effort in advance! – Su-47 Jan 17 '19 at 01:02
  • 1
    @Su-47 If you are on Windows, or installed MS Office. and already own the fonts, the instructions are here: https://ctan.org/tex-archive/fonts/winfonts (But remember, these fonts are copyrighted.) You might also want https://www.tug.org/fonts/getnonfreefonts/ which contains uarial. – Davislor Jan 17 '19 at 01:24