# Tilde in math mode using helvetica

I am forced to use Arial for my thesis. My configuration as shown in the minimal working example below works fine for me exept for the tilde. It does not blend in well and has too much space above and below it (compare it to the tilde in text-mode).

Does anybody have a hint?

\documentclass{scrbook}

\usepackage[scaled=0.92]{helvet}
\usepackage[ngerman]{babel}
\usepackage{mathtools}
\usepackage[helvet]{sfmath}

\renewcommand{\familydefault}{\sfdefault}

\begin{document}
\~{l} = \~{a}
\begin{align*}
\overset{\sim}{l}= \sqrt{\overset{\sim}{[a]}}\\
\end{align*}
\end{document}

• Welcome to TeX.SX! You can have a look on our our starter page to familiarize yourself further with our format. – Claudio Fiandrino Aug 27 '13 at 16:09
• $\tilde{a}$ should work – egreg Aug 27 '13 at 16:33

I would seriously consider ignoring (or getting changed) a rule that says that you should use a sans serif font for a mathematical thesis.

However the markup for a tilde accent in math is \tilde not \overset{\sim}

\documentclass{scrbook}

\usepackage[scaled=0.92]{helvet}
\usepackage[ngerman]{babel}
\usepackage{mathtools}
\usepackage[helvet]{sfmath}

\renewcommand{\familydefault}{\sfdefault}

\begin{document}
\begin{center}     \~{l} = \~{a}\end{center}
\begin{align*}
\overset{\sim}{l}= \sqrt{\overset{\sim}{[a]}}\\
\end{align*}
\begin{align*}
\tilde{l}= \sqrt{\widetilde{[a]}}\\
\end{align*}

\end{document}

• Thank you very much. Now the remaining problem is the horizontal alignment of the tilde for the slanted characters. I solved it like this: \skew{5}{\tilde}{l} – Pete Aug 29 '13 at 13:20
• @Pete yes the default alignment is bad but it's just the tip of the iceberg, helvetica is not set up for math typesetting and all your maths is going to look indescribably horrible if set that way, even if you do shift an accent or two. If you just want a small fragment in a sans serif poster or something, you can perhaps get away with it, but otherwise... – David Carlisle Aug 29 '13 at 13:31
• For any thesis.... – JPi May 28 '17 at 1:08

The newer, Unicode and OpenType, toolchain gives you a lot of flexibility in what font you use for text and math, and lets you mix-and-match fonts and symbols in math mode. Here’s an example.

\documentclass[crop,varwidth]{standalone}
\usepackage{iftex}
\usepackage[ngerman]{babel}
\usepackage{mathtools}

\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}
\fi

\DeclareRobustCommand\d[1]{\mathop{d{#1}}}

\begin{document}
In text mode, \~{l} = \~{a}.

$$\begin{lgathered} abc+\sum_{k=1}^{n}\int_{0}^{k}\sqrt{2}f(x)\d{x}\\ \tilde{l}= \sqrt{\widetilde{[a]}} \end{lgathered}$$
\end{document}


Run this in pdflatex, and you will get the following, legacy-mode output, similar to David Carlisle’s:

Run it in xelatex, and it will set the main font to Arial (in case your thesis committee is checking the tail of the lowercase a), math letters to Arial, math-mode tilde symbols to TeX Gyre DejaVu Math, and other math symbols to Asana Math. Season to taste.

(You would need to change the first line to \documentclass[crop,varwidth,multi]{standalone} to get it to work in lualatex, but that would break the cropping.)

GUST should be coming out with a sans-serif math version of DejaVu Sans sometime soon, but for now, if you want a sans-serif math package, there are arev and arevmath.