How to get monospace logic formulas?

This is no problem with XeTeX if you load a font that contains these characters:

\documentclass{minimal}

\usepackage{fontspec}

\setmainfont{DejaVu Serif}
\setsansfont{DejaVu Sans}
\setmonofont{DejaVu Sans Mono}

\begin{document}

\texttt{∀x(∃y((f(x)=y)∧(¬(g(y)=y))))}

If $\phi$ is a formula of first-order logic and $x$ is a variable, then
\texttt{∀$x$($\phi$)} is again a formula of first-order logic.

\end{document}

Note: Never load the inputenc package when compiling with XeTeX.

  • Results using DejaVu Sans Mono: DejaVu Sans Mono

  • Results using FreeMono: FreeMono


can't you use $\mathtt{\forall x(\exists y((f(x)=y)\land(\neg(g(y)=y))))}$ ?