summaryrefslogtreecommitdiff
path: root/fonts/cfr-lm/tex/cfr-lm.sty
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /fonts/cfr-lm/tex/cfr-lm.sty
Initial commit
Diffstat (limited to 'fonts/cfr-lm/tex/cfr-lm.sty')
-rw-r--r--fonts/cfr-lm/tex/cfr-lm.sty242
1 files changed, 242 insertions, 0 deletions
diff --git a/fonts/cfr-lm/tex/cfr-lm.sty b/fonts/cfr-lm/tex/cfr-lm.sty
new file mode 100644
index 0000000000..db98421f72
--- /dev/null
+++ b/fonts/cfr-lm/tex/cfr-lm.sty
@@ -0,0 +1,242 @@
+%% Copyright 2015 Clea F. Rees
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Clea F. Rees.
+%
+% This work consists of all files listed in manifest.txt.
+%
+% Parts of this file are based on lmodern.sty which is included with
+% the Latin Modern fonts released by GUST and available from
+% http://www.gust.org.pl/projects/e-foundry/latin-modern.
+%
+% Improvements to this file in v1.2 (unpublished) and v1.3 owe almost
+% everything to Enrico Gregorio.
+%
+% v1.4 adds family-specific support for microtype. This draws also on the
+% documentation for the microtype package and MinionPro.sty. MinionPro.sty
+% is available as part of the minionpro package and can be obtain from
+% http://mirror.ctan.org/fonts/minionpro. MinionPro.sty is in the public
+% domain. The documentation for microtype is available in English and German
+% from http://ctan.org/pkg/microtype. It is part of the microtype package which
+% is itself licensed under the LPPL.
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{cfr-lm}[2015/02/01 v1.5 cfr-lm for use with LatinModern v2.004]
+\RequirePackage{xkeyval}
+\RequirePackage[T1]{fontenc}
+\RequirePackage{textcomp}
+\RequirePackage{nfssext-cfr}
+
+%:boolkeys for roman osf/lf
+\define@boolkey[cfrlm]{rm}{oldstyle}[true]{%
+ \ifcfrlm@rm@oldstyle
+ \def\cfrlm@rmol{j}%
+ \else
+ \def\cfrlm@rmol{}%
+ \fi}
+\define@boolkey[cfrlm]{rm}{lining}[true]{%
+ \ifcfrlm@rm@lining
+ \def\cfrlm@rmol{}%
+ \else
+ \def\cfrlm@rmol{j}%
+ \fi}
+
+%:boolkeys for roman prop/tab figures
+\define@boolkey[cfrlm]{rm}{proportional}[true]{%
+ \ifcfrlm@rm@proportional
+ \def\cfrlm@rmpt{2}%
+ \else
+ \def\cfrlm@rmpt{}%
+ \fi}
+\define@boolkey[cfrlm]{rm}{tabular}[true]{%
+ \ifcfrlm@rm@tabular
+ \def\cfrlm@rmpt{}%
+ \else
+ \def\cfrlm@rmpt{2}%
+ \fi}
+
+%:boolkeys for sans osf/lf
+\define@boolkey[cfrlm]{sf}{oldstyle}[true]{%
+ \ifcfrlm@sf@oldstyle
+ \def\cfrlm@sfol{j}%
+ \else
+ \def\cfrlm@sfol{}%
+ \fi}
+\define@boolkey[cfrlm]{sf}{lining}[true]{%
+ \ifcfrlm@sf@lining
+ \def\cfrlm@sfol{}%
+ \else
+ \def\cfrlm@sfol{j}%
+ \fi}
+
+%:boolkeys for sans prop/tab figures
+\define@boolkey[cfrlm]{sf}{proportional}[true]{%
+ \ifcfrlm@sf@proportional
+ \def\cfrlm@sfpt{2}%
+ \else
+ \def\cfrlm@sfpt{}%
+ \fi}
+\define@boolkey[cfrlm]{sf}{tabular}[true]{%
+ \ifcfrlm@sf@tabular
+ \def\cfrlm@sfpt{}%
+ \else
+ \def\cfrlm@sfpt{2}%
+ \fi}
+
+%:boolkeys for typewriter osf/lf
+\define@boolkey[cfrlm]{tt}{oldstyle}[true]{%
+ \ifcfrlm@tt@oldstyle
+ \def\cfrlm@ttol{j}%
+ \else
+ \def\cfrlm@ttol{}%
+ \fi}
+\define@boolkey[cfrlm]{tt}{lining}[true]{%
+ \ifcfrlm@tt@lining
+ \def\cfrlm@ttol{}%
+ \else
+ \def\cfrlm@ttol{j}%
+ \fi}
+
+%:boolkeys for typewriter prop/tab figures
+\define@boolkey[cfrlm]{tt}{proportional}[true]{%
+ \ifcfrlm@tt@proportional
+ \def\cfrlm@ttpt{2}%
+ \else
+ \def\cfrlm@ttpt{}%
+ \fi}
+\define@boolkey[cfrlm]{tt}{tabular}[true]{%
+ \ifcfrlm@tt@tabular
+ \def\cfrlm@ttpt{}%
+ \else
+ \def\cfrlm@ttpt{2}%
+ \fi}
+
+%:boolkeys for typewriter mono/variable width
+\define@boolkey[cfrlm]{tt}{monowidth}[true]{%
+ \ifcfrlm@tt@monowidth
+ \def\cfrlm@ttmv{t}%
+ \else
+ \def\cfrlm@ttmv{v}%
+ \fi}
+\define@boolkey[cfrlm]{tt}{variable}[true]{%
+ \ifcfrlm@tt@variable
+ \def\cfrlm@ttmv{v}%
+ \else
+ \def\cfrlm@ttmv{t}%
+ \fi}
+
+%:options for roman
+\define@key{cfr-lm.sty}{rm}{%
+ \setkeys[cfrlm]{rm}{#1}}
+
+%:options for sans
+\define@key{cfr-lm.sty}{sf}{%
+ \setkeys[cfrlm]{sf}{#1}}
+
+%:options for typewriter
+\define@key{cfr-lm.sty}{tt}{%
+ \setkeys[cfrlm]{tt}{#1}}
+
+%:note that this option does nothing unless \qtfont is defined appropriately
+\define@boolkey{cfr-lm.sty}[cfrlm@]{qt}[true]{%
+ \relax}
+
+%:defaults to ensure everything is defined to something
+\ExecuteOptionsX{rm={oldstyle,proportional},sf={oldstyle,proportional},tt={oldstyle,proportional,variable},qt=false}
+%\ExecuteOptionsX{rm={lining,tabular},sf={oldstyle,proportional},tt={oldstyle,proportional,variable},qt=false}
+
+%:options override defaults
+\ProcessOptionsX
+
+%:make LM default for all families, implementing options for each
+\renewcommand{\rmdefault}{clm\cfrlm@rmpt\cfrlm@rmol}
+\renewcommand{\sfdefault}{clm\cfrlm@sfpt\cfrlm@sfol s}
+\renewcommand{\ttdefault}{clm\cfrlm@ttpt\cfrlm@ttol\cfrlm@ttmv}
+
+%:handle the qt option, failing gracefully if somebody has enabled the option without defining \qtfont appropriately
+\ifcfrlm@qt
+ \@ifundefined{qtfont}{%
+ \PackageWarning{cfr-lm}{Option 'qt' cannot be implemented unless\MessageBreak
+ the command qtfont is defined appropriately. This is not\MessageBreak
+ done automatically to maximise compatibility with other\MessageBreak
+ classes and packages. The suggested use is to have qtfont\MessageBreak
+ redefine a command such as quotefont which is initially\MessageBreak
+ set to some reasonable default and is then used in the\MessageBreak
+ definition of the quote and/or quotation environments.\MessageBreak
+ Since these are class and package dependent, it cannot\MessageBreak
+ be done by a font package and the option is ignored here.}}{%
+ \qtfont{\qtstyle}}
+\fi
+
+%:based on lmodern.sty
+\SetSymbolFont{operators} {normal}{OT1}{lmr} {m}{n}
+\SetSymbolFont{letters} {normal}{OML}{lmm} {m}{it}
+\SetSymbolFont{symbols} {normal}{OMS}{lmsy}{m}{n}
+\SetSymbolFont{largesymbols}{normal}{OMX}{lmex}{m}{n}
+\SetSymbolFont{operators} {bold} {OT1}{lmr} {bx}{n}
+\SetSymbolFont{letters} {bold} {OML}{lmm} {b}{it}
+\SetSymbolFont{symbols} {bold} {OMS}{lmsy}{b}{n}
+\SetSymbolFont{largesymbols}{bold} {OMX}{lmex}{m}{n}
+
+\DeclareFontSubstitution{OT1}{lmr}{m}{n}
+\DeclareFontSubstitution{OML}{lmm}{m}{it}
+\DeclareFontSubstitution{OMS}{lmsy}{m}{n}
+\DeclareFontSubstitution{OMX}{lmex}{m}{n}
+
+\SetMathAlphabet{\mathbf}{normal}{OT1}{lmr}{bx}{n}
+\SetMathAlphabet{\mathsf}{normal}{OT1}{lmss}{m}{n}
+\SetMathAlphabet{\mathit}{normal}{OT1}{lmr}{m}{it}
+\SetMathAlphabet{\mathtt}{normal}{OT1}{lmtt}{m}{n}
+\SetMathAlphabet{\mathbf}{bold} {OT1}{lmr}{bx}{n}
+\SetMathAlphabet{\mathsf}{bold} {OT1}{lmss}{bx}{n}
+\SetMathAlphabet{\mathit}{bold} {OT1}{lmr}{bx}{it}
+\SetMathAlphabet{\mathtt}{bold} {OT1}{lmtt}{m}{n}
+
+\def\mathsterling{\mathit{\mathchar"70BF}}
+
+%:new in v1.1
+\DeclareRobustCommand{\dotdigitenc}{%
+ \not@math@alphabet\dotdigitenc\relax
+ \fontencoding{U}\selectfont}
+\DeclareTextFontCommand{\textdde}{\dotdigitenc}
+\newcommand*{\zeroslash}{\textdde{\char 250}}
+
+%:Partly from microtype docs; partly from MinionPro package
+%
+% We need to set up aliases for the font families created by cfr-lm so that
+% microtype recognises them as similar to Computer Modern Roman.
+%
+% T1 families in cfr-lm: clm clm2 clm2d clm2dj clm2j clm2jqs clm2js clm2jt
+% clm2jv clm2qs clm2s clm2t clm2v clmd clmdj clmj clmjqs clmjs clmjt clmjv
+% clmqs clms clmt clmv
+%
+% See variants set in nfssext-cfr
+%
+% Ref: http://tex.stackexchange.com/a/75440/39222
+\newcommand{\cfr@ffs}{% alias to cmr
+ clm,clm2,clm2j,clmj,% roman
+ clms,clm2js,clm2s,clmjs,% sans
+ clmqs,clm2jqs,clm2qs,clmjqs%
+% clm2d,clm2dj,clmd,clmdj,% leave unaliased?
+% clm2jv,clmjv,clm2v,clmv,% leave unaliased?
+% clmt,clm2t,clmjt,clm2jt% leave unaliased?
+ }
+\gdef\cfrlm@MicroType@Aliases{%
+ \@for \xx:=\cfr@ffs \do {%
+ \DeclareMicrotypeAlias{\xx}{cmr}}%
+ }
+\def\cfrlm@MT@Hook{\cfrlm@MicroType@Aliases}
+\@ifpackageloaded{microtype}{%
+ \cfrlm@MT@Hook}{%
+ \@ifundefined{Microtype@Hook}{%
+ \let\Microtype@Hook\cfrlm@MT@Hook}{% MinionPro has \global before this
+ \g@addto@macro\Microtype@Hook{\cfrlm@MT@Hook}}}
+\endinput