Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

How do I use the font provided by Ubuntu in LaTeX?

Eg.

enter image description here

share|improve this question
2  
Can you at least tell us the name of the font? Then there are lots of duplicates on this site for using system fonts –  percusse Apr 5 at 17:50
    
As @percusse says. Just install the font and then use LuaLaTeX or XeLaTeX. Lots of questions explain how. –  cfr Apr 5 at 17:57
    
@cfr Well, the font is installed already, as he uses it in that editor. Subham: If you don't know the name of the font, go into the preferences of the editor (Gedit?), you can find which font is used there I'd think. –  Torbjørn T. Apr 5 at 18:00
    
@TorbjørnT. Probably. But it does no harm to point it out. (After all, the OP might want to use the font on a different system or have found a screenshot on the web.) –  cfr Apr 5 at 18:11
    
For users not using Ubuntu: The whole font family is available on Ubuntu Font Family – or at Google Fonts google.com/fonts . –  Speravir Apr 5 at 23:13
add comment

2 Answers 2

up vote 4 down vote accepted

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

share|improve this answer
add comment

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}
share|improve this answer
    
It is not the right font, though. Compare the 'i's ;). –  cfr Apr 5 at 20:53
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.