4

cfr-lm provides \sbweight and \lgweight font weights.

  1. With

    \renewcommand\bfdefault{sb}
    

    we can use this like default bold font. Is this the best way?

  2. How can I use the \lgweight font weight with \texttt and \ttfamily?

  • 1
    lmodern realizes its lighttt option by using the light fonts when the font series is m and medium weight when the font series is “bold”. I guess that making this work with cfr-lm would require a new set of virtual fonts and suitable loading options. – egreg Jul 4 '14 at 9:34
  • 1
    \renewcommand\mddefault{l}? @egreg Why would I need to create a new set of virtual fonts? To make it possible to use the light weight of tt while continuing to use the medium weight for all other families without having to use additional commands or preamble workarounds, I would need to do something in terms of the family definition files and provide an equivalent package option to lighttt. But I don't see why that would require any additional virtual fonts? (And I'm not convinced setting this up would be a good idea given the number of possible combinations supported by the package.) – cfr Jul 4 '14 at 21:26
  • @cfr You surely know better. – egreg Jul 4 '14 at 21:34
  • 1
    @egreg I wouldn't bet on it... – cfr Jul 4 '14 at 21:43
2

To emulate what I think may be the effect of lmodern's lighttt option, you could try the following:

\documentclass{article}
\usepackage[tt={tabular, lining, monowidth}]{cfr-lm}
\newcommand{\myalph}{Aa Bb Cc Dd Ee Ff Gg Hh Ii Jj Kk Ll Mm Nn Oo Pp Qq Rr Ss Tt Uu Vv Ww Xx Yy Zz 0123456789}
\usepackage{filecontents}
\begin{filecontents}{t1clmt.fd}
%Filename: t1clmt.fd
%Original created by: tex clm-t1-drv
%Original created using fontinst v1.933

%THIS FILE SHOULD BE PUT IN A TEX INPUTS DIRECTORY

\ProvidesFile{t1clmt.fd}
   [2010/05/25 Fontinst v1.933 font definitions for T1/clmt. Hacked 2014/07/04.]

\DeclareFontFamily{T1}{clmt}{\hyphenchar\font=\m@ne}

\DeclareFontShape{T1}{clmt}{m}{n}{
   <-8.5> clmtt8t8
   <8.5-9.5> clmtt8t9
   <9.5-11> clmtt8t10
   <11-> clmtt8t12
}{}

\DeclareFontShape{T1}{clmt}{m}{sl}{
   <-> clmtto8t10
}{}

\DeclareFontShape{T1}{clmt}{m}{it}{
   <-> clmtti8t10
}{}

\DeclareFontShape{T1}{clmt}{m}{sc}{
   <-> clmtcsc8t10
}{}

\DeclareFontShape{T1}{clmt}{m}{scsl}{
   <-> clmtcso8t10
}{}

\DeclareFontShape{T1}{clmt}{bx}{n}{
   <-> clmtk8t10
}{}

\DeclareFontShape{T1}{clmt}{bx}{sl}{
   <-> clmtko8t10
}{}

\DeclareFontShape{T1}{clmt}{l}{n}{
   <-> clmtl8t10
}{}

\DeclareFontShape{T1}{clmt}{l}{sl}{
   <-> clmtlo8t10
}{}

\DeclareFontShape{T1}{clmt}{lc}{n}{
   <-> clmtlc8t10
}{}

\DeclareFontShape{T1}{clmt}{lc}{sl}{
   <-> clmtlco8t10
}{}

\DeclareFontShape{T1}{clmt}{m}{ui}{<->ssub * clmt/m/it}{}
\DeclareFontShape{T1}{clmt}{m}{si}{<->ssub * clmt/m/scsl}{}
\DeclareFontShape{T1}{clmt}{b}{n}{<->ssub * clmt/bx/n}{}
\DeclareFontShape{T1}{clmt}{bx}{sc}{<->ssub * clmt/bx/n}{}
\DeclareFontShape{T1}{clmt}{b}{sc}{<->ssub * clmt/bx/sc}{}
\DeclareFontShape{T1}{clmt}{b}{sl}{<->ssub * clmt/bx/sl}{}
\DeclareFontShape{T1}{clmt}{bx}{it}{<->ssub * clmt/bx/sl}{}
\DeclareFontShape{T1}{clmt}{b}{it}{<->ssub * clmt/bx/it}{}
\DeclareFontShape{T1}{clmt}{bx}{ui}{<->ssub * clmt/bx/it}{}
\DeclareFontShape{T1}{clmt}{b}{ui}{<->ssub * clmt/bx/ui}{}
\DeclareFontShape{T1}{clmt}{l}{sc}{<->ssub * clmt/l/n}{}
\DeclareFontShape{T1}{clmt}{l}{it}{<->ssub * clmt/l/sl}{}
\DeclareFontShape{T1}{clmt}{l}{ui}{<->ssub * clmt/l/it}{}
\DeclareFontShape{T1}{clmt}{lc}{sc}{<->ssub * clmt/lc/n}{}
\DeclareFontShape{T1}{clmt}{lc}{it}{<->ssub * clmt/lc/sl}{}
\DeclareFontShape{T1}{clmt}{lc}{ui}{<->ssub * clmt/lc/it}{}
\DeclareFontShape{T1}{clmt}{sb}{n}{<->ssub * clmt/m/n}{}
\DeclareFontShape{T1}{clmt}{sb}{sc}{<->ssub * clmt/m/sc}{}
\DeclareFontShape{T1}{clmt}{sb}{sl}{<->ssub * clmt/m/sl}{}
\DeclareFontShape{T1}{clmt}{sb}{it}{<->ssub * clmt/m/it}{}
\DeclareFontShape{T1}{clmt}{sb}{ui}{<->ssub * clmt/m/ui}{}

\endinput
\end{filecontents}


\renewcommand\bfdefault{sb}
\renewcommand\mddefault{l}

\begin{document}
  \myalph

  \textbf{\myalph}

  \ttfamily

  \myalph

  \textbf{\myalph}

\end{document}

What this does is substitutes the m weight for sb. Since you are declaring \bfdefault as sb, this effectively means that the medium weight will be used as bold when this font family is used. When you are using roman or sans, of course, you'll actually get sb because those families have that weight and the description files support it.

By setting \mddefault to l, you get the light weight as the normal, medium weight throughout. However, since only the typewriter fonts actually have this weight, it will have no effect on the weight used for roman or sans.

Note that this is definitely a hack and not at all correct, let alone elegant. Moreover, there are probably several things I've not thought of so please use with care and let me know. Caveat emptor...

Demi, medium and light

The above document writes the file t1clmt.fd to the current output directory (normally the same directory as your tex file). This means that TeX will use this version of the file rather than the original one from the main texmf tree. To use this hack with another document, best would be to put the t1clmt.fd file produced in the same directory as your document.

  • Thanks. Sorry, but I don't understand. Without t1clmt.fd the result is the same as \renewcommand\mddefault{l} only. – user56567 Jul 5 '14 at 7:40
  • @cornelius What do you mean 'without t1clmt.fd'? – cfr Jul 5 '14 at 21:04
  • I must put the t1clmt.fd file in a TeX input directory? – user56567 Jul 5 '14 at 21:57
  • 1
    @cornelius The above document writes the file to the current output directory (normally the same directory as the file). This means that TeX will use this version of the file rather than the original one. To use with another document, best would be to put the file in the same directory as your document. – cfr Jul 5 '14 at 22:00
  • 1
    @cornelius I've edited my answer to incorporate this information. If this answer works for you (and no better comes along), don't forget to accept it so that other users searching can find the solution. (Disclaimer: accepting my answer will get me points. It will also get you points!) Accepting and/or up-voting answers is the local way of saying 'thanks'. – cfr Jul 5 '14 at 22:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy