5

I'm documenting a class with (ltx)doc. The macro names are quite long so I get a lot of overfull hboxes.

AFAIK latin modern has an additional typewriter font which is condensed. How do I switch the doc package to use that? I'd prefer a solution for pdflatex.

1
  • As far as I can see it, the condensed typewriter font only comes in a light weight, which does not mix well with LMRoman in the medium weight. Jul 5, 2011 at 16:03

2 Answers 2

9

Write this in the preamble of your document

\DeclareFontFamily{T1}{lmttc}{\hyphenchar \font-1 }
\DeclareFontShape{T1}{lmttc}{m}{n}
     {<-> ec-lmtlc10}{}
\DeclareFontShape{T1}{lmttc}{m}{it}
     {<->sub*lmttc/m/sl}{}
\DeclareFontShape{T1}{lmttc}{m}{sl}
     {<-> ec-lmtlco10}{}
\renewcommand{\ttdefault}{lmttc}

If you need OT1-encoding, change all T1 into OT1 and ec- into rm-.

With XeLaTeX or LuaLaTeX one can say

\setmonofont[HyphenChar=None]{Latin Modern Mono Light Cond}

and get the same result (loading fontspec, of course).

3
  • Thanks. Bonus question: How to do this with xelatex/lualatex? Jul 5, 2011 at 16:26
  • What did I win? :)
    – egreg
    Jul 5, 2011 at 16:37
  • 3
    @egreg: Another upvote. ;-)
    – lockstep
    Jul 5, 2011 at 17:07
3

Incidentally, you can see the effect of this in the paper I gave at Practical TeX 2006 on document classes: http://tug.org/TUGboat/tb28-1/tb88flynn.pdf

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .