Ubuntu Font in LaTeX

I think it is probably Ubuntu Mono:

Ubuntu Mono

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Ubuntu Mono}
\usepackage{kantlipsum}

\begin{document}

\kant[1]

\end{document}

If you don't want to use it as the main font for the document, fontspec allows you to configure it for specific uses or as your 'typewriter' font.

For example, you might want Ubuntu Mono as your 'typewriter' font and Ubuntu for sans:

Ubuntu and Ubuntu Mono for sans and typewriter

\documentclass{article}
\usepackage{fontspec}
\setsansfont{Ubuntu}% Ubuntu as sans - use \sffamily or \textsf{} as normal
\setmonofont{Ubuntu Mono}% Ubuntu Mono as 'typewriter' - use \ttfamily or \texttt{}
\usepackage{kantlipsum}

\begin{document}
\thispagestyle{empty}

{\noindent\sffamily Ubuntu:

\kant[1]}

{\noindent\ttfamily Ubuntu Mono:

\kant[2]}

\end{document}

If you want to use Ubuntu Mono for certain elements but not set it up as the default anything, you can specify a command to switch to it:

\documentclass{article}
\usepackage{fontspec}
\newfontfamily\ubuntumono{Ubuntu Mono}

\begin{document}
\thispagestyle{empty}

This is some text in the regular font.

{\ubuntumono This is some text in Ubuntu Mono.}

\end{document}

This produces the following (rather ugly) output but demonstrates the idea:

Ubuntu Mono via \ubuntumono


You can use any system font with the xetex or luatex engines with the fontspec package as a nice interface.

\documentclass{article}
\usepackage{fontspec}
\setmainfont{Ubuntu}
\begin{document}
The lazy fox jumpes over the brown dog.
\end{document}

Tags:

Fonts