3

First, please note that this question pertains to pdflatex, not xelatex or lualatex. I cannot use any solution involving packages such as fontspec.

I'm trying to use Helvetica or a similar font in beamer for both text and math. Unfortunately, I consistently get ugly output. Here is a minimal working example:

\documentclass{beamer}

\setbeamertemplate{navigation symbols}{}

\usepackage{tgheros}

\begin{document}
\begin{frame}
\[\neg(A+1=B)\Longrightarrow A+1\ne B\]
\end{frame}
\end{document}

Here is the output I get:

enter image description here

There are two things wrong here. First, the thickness of the + sign does not match that of the letters. Second, there is a glitch in the \Longrightarrow (which presumably is composed of an equals sign and arrow in mismatched fonts).

I somewhat accidentally discovered that I can get much better looking output with:

\usepackage{lmodern}
\usepackage{tgheros}

Using both lmodern and tgheros in that order makes most equations look much better, but the artifacts get worse. Here is an example:

enter image description here

Now the + and = look much better, as they are matched to the font. But now the glitches in \Longrightarrow are even worse. Also, the \ne sign has the slash slightly off-center (though I suppose I could live with it if necessary).

My question is how to get the best of both worlds: Most symbols like + and = well matched to the font of the letters, but ugly artifacts also minimized.

2
  • Try with \usepackage{tgheros} \usepackage[italic]{mathastext}... Dec 1 '15 at 13:05
  • @PaulGaborit Thanks for the suggestion. That fixes \Longright arrow, but then the less than and greater than signs look horrible and completely incongruous with \ge and \le. Dec 1 '15 at 18:18
3

To get around the problem with the glitch in the arrow you can redefine the arrow to use cmr for the equal sign instead of cmss (which doesn't fit exactly:

\documentclass{beamer}

\usepackage{tgheros}

\renewcommand\Longrightarrow{%
 \mathrel{%
  \mbox{\fontfamily{cmr}\fontencoding{OT1}\selectfont=}}%
 \joinrel\Rightarrow}

\begin{document}
\begin{frame}
\[\neg(A+1=B)\Longrightarrow A+1\ne B\]

\end{frame}
\end{document}

enter image description here

4
  • Thanks. That fixes the most serious problem. I'm still going to leave this open for a bit in case someone has a more systematic solution. After all, wanting to use helvetica or a similar highly-readable sans-serif font in a presentation has to be a reasonably common requirement, so I'm hoping there is a package or option that just does this makes everything look good. Dec 1 '15 at 18:26
  • Also, how would I do this for \Longleftarrow? Simply flipping around what you've done--namely \Leftarrow\joinrel\mbox{...}--seems to leave a gap between the \Leftarrow and = sign. Dec 1 '15 at 18:38
  • You can use \renewcommand\Longleftarrow{\mathrel{\Leftarrow \joinrel\mathrel{\mbox{\fontfamily{cmr}\fontencoding{OT1}\selectfont=}}}} Dec 1 '15 at 21:45
  • @user3188445 Sorry I meant yesterday \renewcommand\Longleftarrow{\Leftarrow\joinrel\mathrel{\mbox{\fontfamily{cmr}\fontencoding{OT1}\selectfont=}}} The important bit it that both parts must be a mathrel. Dec 2 '15 at 8:21

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.