TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to use lmodern as my default teletype font, while using other fonts for sans etc.

So far I have


{\ttfamily Hello in lmodern }

What do I have to replace the ??? with in order for the lmodern to be used as the default teletype?

share|improve this question
Nothing, just remove \renewcommand*\ttdefault{???} – David Carlisle Mar 29 '13 at 11:35
Loading lmodern after cantarell will override the choice of the sans serif font; change the loading order, if you want Cantarell as sans serif font. As David says, nothing is necessary for the monospaced font. – egreg Mar 29 '13 at 11:41
Good tip on the load order. Thanks. – kasperhj Mar 29 '13 at 11:58
up vote 7 down vote accepted

The cantarell package with the defaultsans option sets the sans serif font to Cantarell by redefining \sfdefault. However, lmodern does


so loading it after cantarell will override the specification made by this package. The lmodern package sets \ttdefault to lmtt (Latin Modern Typewriter), so you get served by


{\sffamily Hello in Cantarell}

{\ttfamily Hello in lmodern}

without doing anything for \ttdefault.

enter image description here

share|improve this answer

Your Answer


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.