Q: Non-raised tildes in a minted environment Consider the following minimal example that combines Beamer + Minted:
\documentclass[11pt,utf8]{beamer}
\usepackage{minted}

\begin{document}
\begin{frame}[fragile]
\frametitle{Foobar}
\begin{minted}{ocaml}
let foobar ~x ~y = x + y
\end{minted}
\end{frame}
\end{document}

The problem is that the tilde characters in function foobar inside the minted environment are rendered almost as superscripts.  I want them to be rendered as is customary in monospaced fonts: vertically centered.  Any ideas?

A: This is actually a font issue.  Try \usepackage[T1]{fontenc} plus
\usepackage{lmodern}, or something similar.


A: I had issue with tilde also after specifying font to \usepackage[T1]{fontenc} and \usepackage{lmodern}. I solved problem by setting:

\setminted[r]{fontfamily=courier}
% or equvalently
\mint[fontfamily=courier]{r}|lm(y~x)|


A: I combined the other two answers and solved the problem by setting:
\setminted[]{fontfamily=lmtt}

This way the font Latin Modern Sans Typewriter is set only to the minted environment, to all code snippets written in all languages.
