summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/nfssext-cfr
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 /macros/latex/contrib/nfssext-cfr
Initial commit
Diffstat (limited to 'macros/latex/contrib/nfssext-cfr')
-rw-r--r--macros/latex/contrib/nfssext-cfr/README26
-rw-r--r--macros/latex/contrib/nfssext-cfr/nfssext-cfr.pdfbin0 -> 180398 bytes
-rw-r--r--macros/latex/contrib/nfssext-cfr/nfssext-cfr.sty641
-rw-r--r--macros/latex/contrib/nfssext-cfr/nfssext-cfr.tex196
4 files changed, 863 insertions, 0 deletions
diff --git a/macros/latex/contrib/nfssext-cfr/README b/macros/latex/contrib/nfssext-cfr/README
new file mode 100644
index 0000000000..5a59f6bf04
--- /dev/null
+++ b/macros/latex/contrib/nfssext-cfr/README
@@ -0,0 +1,26 @@
+nfssext-cfr.sty is an extension of Philipp Lehman's nfssext.sty. nfssext.sty
+provides commands which enable one to specify font features not covered by
+the New Font Selection Scheme of LaTeX-2e. nfssext-cfr.sty provides
+additional commands, further extending the facilities offered by NFSS.
+
+nfssext-cfr.sty is required by various font support packages I've written.
+It is being released separately to avoid unnecessary duplication and
+confusion. At least, I hope it will remove at least one source of unnecessary
+confusion. I have no reason to think it will avoid any of the others.
+
+The code is somewhat experimental. It works for me. So far. If you discover
+problems, please let me know. If you know how to fix them, even better.
+
+The 2010 update includes an attempt to improve the behaviour of \ofstyle, and to
+add support for microtype. I didn't publish this at the time because I wanted
+to test it first. I have just discovered that I am still using a local copy.
+Insofar as one person can test something, I figure that 5 years ought to be
+enough to pick up the most obvious problems. However, your kilometres may, as
+always, vary.
+
+There should be no changes for the end user except that in certain cases it is
+possible that line-breaks may be altered if microtype is in use due to the
+enhanced support included for variant font families.
+
+- Clea F. Rees (ReesC21 <at> cardiff <dot> ac <dot> uk)
+2017/03/28
diff --git a/macros/latex/contrib/nfssext-cfr/nfssext-cfr.pdf b/macros/latex/contrib/nfssext-cfr/nfssext-cfr.pdf
new file mode 100644
index 0000000000..42380dd224
--- /dev/null
+++ b/macros/latex/contrib/nfssext-cfr/nfssext-cfr.pdf
Binary files differ
diff --git a/macros/latex/contrib/nfssext-cfr/nfssext-cfr.sty b/macros/latex/contrib/nfssext-cfr/nfssext-cfr.sty
new file mode 100644
index 0000000000..03d19d2e59
--- /dev/null
+++ b/macros/latex/contrib/nfssext-cfr/nfssext-cfr.sty
@@ -0,0 +1,641 @@
+%% nfssext-cfr.sty
+%% Additions and changes are copyright 2017 Clea F. Rees
+%% Code from nfssext.sty copyright 2003 Philipp Lehman (see below)
+%
+% 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 the file nfssext-cfr.sty.
+%
+% The file nfssext-cfr.sty is a derived work under the terms of the
+% LPPL. It is based on version 1.2 of nfssext.sty which is part of The
+% Font Installation Guide by Philipp Lehman. A copy of the The Font
+% Installation Guide, including the unmodified version of nfssext.sty
+% is available from
+% http://tug.ctan.org/cgi-bin/ctanPackageInformation.py?id=fontinstallationguide.
+% nfssext.sty is part of the included archive figuide-examples.tar.gz
+% which consists of examples and templates released under the LPPL.
+% nfssext.sty is included in the files for tutorials 3, 5 and 6.
+%
+% 2017-03-28: modify \tmstyle and \tvstyle to unmerge sans and other
+% typewriter before mergining appropriate variant
+%
+\NeedsTeXFormat{LaTeX2e}
+\RequirePackage{svn-prov}
+\ProvidesPackageSVN{$Id: nfssext-cfr.sty 6140 2017-03-28 18:07:31Z cfrees $}[\revinfo{} specially mangled by cfr; based on 2003/03/14 v1.2 Experimental NFSS Extensions]
+%:cfr-added: use ifthen
+\RequirePackage{ifthen}
+%:end-added
+\newcommand*{\exfs@tempa}{}
+\newcommand*{\exfs@tempb}{}
+%:cfr-added: extra variable (\exfs@tempf)
+\newcommand*{\exfs@tempf}{}
+%:end-added
+\newcommand*{\exfs@try@family}[2][]{%
+ \let\exfs@tempa\relax
+ \begingroup
+ \fontfamily{#2}\try@load@fontshape
+ \expandafter\ifx\csname\curr@fontshape\endcsname\relax
+ \edef\exfs@tempa{#1}%
+ \ifx\exfs@tempa\@empty
+ \PackageWarning{nfssext}{%
+ Font family '\f@encoding/#2' not available\MessageBreak
+ Ignoring font switch}%
+ \else
+ \PackageInfo{nfssext}{%
+ Font family '\f@encoding/#2' not available\MessageBreak
+ Font family '\f@encoding/#1' tried instead}%
+ \exfs@try@family{#1}%
+ \fi
+ \else
+ \gdef\exfs@tempa{\fontfamily{#2}\selectfont}%
+ \fi
+ \endgroup
+ \exfs@tempa}
+%:cfr-added exfs@try@series
+\newcommand*{\exfs@try@series}[2][]{%
+ \let\exfs@tempa\relax
+ \begingroup
+ \fontseries{#2}\try@load@fontshape
+ \expandafter\ifx\csname\curr@fontshape\endcsname\relax
+ \edef\exfs@tempa{#1}%
+ \ifx\exfs@tempa\@empty
+ \PackageWarning{nfssext-cfr}{%
+ Font series '\f@encoding/\f@family/#2' not available\MessageBreak
+ Ignoring font switch}%
+ \else
+ \PackageInfo{nfssext-cfr}{%
+ Font family '\f@encoding/\f@family/#2' not available\MessageBreak
+ Font family '\f@encoding/\f@family/#1' tried instead}%
+ \exfs@try@series{#1}%
+ \fi
+ \else
+ \gdef\exfs@tempa{\fontseries{#2}\selectfont}%
+ \fi
+ \endgroup
+ \exfs@tempa}
+%:end-added
+\def\exfs@get@base#1#2#3#4\@nil{#1#2#3}
+%:cfr-added:more \exfs@ commands (get@variants, next, shift, first, part, second)
+\def\exfs@get@variants#1#2#3#4\@nil{#4}
+\def\exfs@next#1#2\@nil{#1}
+\def\exfs@shift#1#2\@nil{#2}
+\def\exfs@first#1#2\@nil{#1}
+\def\exfs@part#1#2\@nil{#2}
+\def\exfs@second#1#2#3\@nil{#2}
+%:end-added
+\DeclareRobustCommand{\lnstyle}{%
+ \not@math@alphabet\lnstyle\relax
+ \exfs@try@family[\expandafter\exfs@get@base\f@family\@nil]%
+ {\expandafter\exfs@get@base\f@family\@nil x}}
+\DeclareRobustCommand{\osstyle}{%
+ \not@math@alphabet\osstyle\relax
+ \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil j}}
+\DeclareRobustCommand{\instyle}{%
+ \not@math@alphabet\instyle\relax
+ \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil 0}}
+\DeclareRobustCommand{\sustyle}{%
+ \not@math@alphabet\sustyle\relax
+ \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil 1}}
+\DeclareRobustCommand{\swstyle}{%
+ \not@math@alphabet\swstyle\relax
+ \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil w}}
+%:cfr-added - merge families
+\newcommand*\exfs@merge@families[1]{%
+ \edef\exfs@tempf{#1}%
+ \edef\tempa{\expandafter\exfs@get@variants\f@family\@nil}%
+ \edef\tempo{2j}%
+ \let\exfs@tempq\@empty
+ \def\exfs@tempg{}%
+ \newif\ifadded
+ \addedfalse
+ % check whether there are variants - if not just use the requested addition
+ \ifx\tempa\@empty
+ \edef\exfs@tempq{\exfs@tempf}%
+ \addedtrue
+ \else
+ \gdef\set{0,1,2,a,d,e,f,h,j,l,p,q,s,t,v,w}% these are the variants to consider - the order here and in the font name is crucial
+ \ifx\tempo\exfs@tempf
+ \@for \xx:=\set \do {%
+ % check whether there are variants left - if not set the ``next variant'' to empty
+ \ifx\tempa\@empty
+ \let\exfs@tempn\@empty
+ \else
+ % o/w get the next variant
+ \edef\exfs@tempn{\expandafter\exfs@next\tempa\@nil}%
+ \fi
+ \edef\tempt{2}%
+ \edef\tempj{j}%
+ % if the next variant is 2 or j, ignore it
+ \ifx\exfs@tempn\tempt
+ \edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
+ \fi
+ \ifx\exfs@tempn\tempj % if the next variant is j, ignore it
+ \edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
+ \fi
+ % see if the current value is either 2 or j and add it if so and if needed
+ \ifx\tempt\xx
+ \edef\exfs@tempg{\exfs@tempg\xx}%
+ \else
+ \ifx\tempj\xx % if the current value is j, we're done
+ \edef\exfs@tempq{\exfs@tempg\xx\tempa}%
+ \let\tempa\@empty
+ \addedtrue
+ \else
+ % o/w see if the current value matches the next variant
+ \ifx\xx\exfs@tempn
+ \edef\exfs@tempg{\exfs@tempg\xx}%
+ \edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
+ \fi
+ \fi
+ \fi
+ }%
+ \else
+ \@for \xx:=\set \do {%
+ % check whether there are variants left and, if not, add the addition if needed
+ \ifx\tempa\@empty
+ \ifadded
+ \else
+ \edef\exfs@tempq{\exfs@tempg\exfs@tempf}%
+ \addedtrue
+ \fi
+ \else
+ % o/w get the next variant
+ \edef\exfs@tempn{\expandafter\exfs@next\tempa\@nil}%
+ % if the new token equals the next variant, combine whatever is saved in \exfs@tempg with whatever remains in \tempa
+ \ifx\exfs@tempn\exfs@tempf
+ \edef\exfs@tempq{\exfs@tempg\tempa}%
+ \addedtrue
+ \let\tempa\@empty
+ \else
+ % o/w, if the current value matches the requested addition, add it in
+ \ifx\exfs@tempf\xx
+ \edef\exfs@tempq{\exfs@tempg\xx\tempa}%
+ \addedtrue
+ \let\tempa\@empty
+ \else
+ % o/w, if the current value matches the next variant, shift
+ \ifx\exfs@tempn\xx
+ \edef\exfs@tempg{\exfs@tempg\xx}%
+ \edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
+ \fi
+ \fi
+ \fi
+ \fi
+ }%
+ \fi
+ \fi
+ \ifx\exfs@tempq\@empty
+ \PackageError{nfssext-cfr}{Something is wrong here. Ignoring font switching command.}{}%
+ \else
+ \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil \exfs@tempq}%
+ \fi}
+\DeclareRobustCommand{\pstyle}{% proportional figures
+ \not@math@alphabet\pstyle\relax
+ \exfs@merge@families{2}}
+\DeclareRobustCommand{\tistyle}{% titling/display
+ \not@math@alphabet\tistyle\relax
+ \exfs@merge@families{d}}
+\DeclareRobustCommand{\ostyle}{% oldstyle figures (cf. original osstyle above)
+ \not@math@alphabet\ostyle\relax
+ \exfs@merge@families{j}}
+% combined command for proportional oldstyle
+\DeclareRobustCommand{\postyle}{%
+ \not@math@alphabet\postyle\relax
+ \exfs@merge@families{2j}}
+%note that this command is for use when the light version is a separate family rather than a weight variant (e.g. when you've got light, light bold etc. as well as regular weights)
+\DeclareRobustCommand{\ltstyle}{%
+ \not@math@alphabet\ltstyle\relax
+ \exfs@merge@families{l}}
+%let's hope there aren't any fonts with a light family *and* an outline/openface/blank version
+\DeclareRobustCommand{\ofstyle}{%
+ \not@math@alphabet\ofstyle\relax
+ \exfs@merge@families{l}}
+\DeclareRobustCommand{\altstyle}{% alternative style
+ \not@math@alphabet\altstyle\relax
+ \exfs@merge@families{a}}
+\DeclareRobustCommand{\regstyle}{% ``regular'' style
+ \not@math@alphabet\regstyle\relax
+ \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil}}
+\DeclareRobustCommand{\embossstyle}{%
+ \not@math@alphabet\embossstyle\relax
+ \exfs@merge@families{e}}
+\DeclareRobustCommand{\ornamentalstyle}{% intended primarily for decorative initial fonts etc.
+ \not@math@alphabet\ornamentalstyle\relax
+ \exfs@merge@families{p}}
+\DeclareRobustCommand{\qtstyle}{% quotation style (assumes sans)
+ \not@math@alphabet\qtstyle\relax
+ \sffamily
+ \exfs@merge@families{q}}
+\DeclareRobustCommand{\shstyle}{%
+ \not@math@alphabet\shstyle\relax
+ \exfs@merge@families{h}}
+\DeclareRobustCommand{\swashstyle}{% an attempt to improve on \swstyle
+ \not@math@alphabet\swashstyle\relax
+ \exfs@merge@families{w}}
+\DeclareRobustCommand{\tmstyle}{% monowidth typewriter
+ \not@math@alphabet\tmstyle\relax
+ \exfs@unmerge@families{s}%
+ \exfs@unmerge@families{v}%
+ \exfs@merge@families{t}}
+\DeclareRobustCommand{\tvstyle}{% variable width typewriter
+ \not@math@alphabet\tvstyle\relax
+ \exfs@unmerge@families{s}%
+ \exfs@unmerge@families{t}%
+ \exfs@merge@families{v}}
+%:cfr-added - unmerge families
+\newcounter{taken}%
+\newcommand*\exfs@unmerge@families[1]{%
+ \edef\exfs@tempf{#1}%
+ \edef\tempa{\expandafter\exfs@get@variants\f@family\@nil}%
+ \let\exfs@tempq\@empty
+ \edef\exfs@tempg{}%
+ \setcounter{taken}{0}%
+ % check whether there are variants - if not do nothing
+ \ifx\tempa\@empty
+ \edef\exfs@tempq{}%
+ \else
+ % o/w go through the variants to find the one to delete
+ \whiledo{\value{taken}<1}{%
+ % get the next variant
+ \edef\exfs@tempn{\expandafter\exfs@next\tempa\@nil}%
+ % see if the next variant is the thing we seek and, if so, eliminate it
+ \ifx\exfs@tempf\exfs@tempn
+ \edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
+ \edef\exfs@tempq{\exfs@tempg\tempa}%
+ \stepcounter{taken}%
+ % o/w save the next variant and move on if any variants remain
+ \else
+ \edef\exfs@tempg{\exfs@tempg\exfs@tempn}%
+ \edef\tempa{\expandafter\exfs@shift\tempa\@nil}%
+ \ifx\tempa\@empty% if there are no variants left, we're done
+ \edef\exfs@tempq{\exfs@tempg}%
+ \stepcounter{taken}%
+ \fi
+ \fi
+ }%
+ \fi
+ \exfs@try@family{\expandafter\exfs@get@base\f@family\@nil \exfs@tempq}}
+\DeclareRobustCommand{\tstyle}{% tabular figures
+ \not@math@alphabet\tstyle\relax
+ \exfs@unmerge@families{2}}
+\DeclareRobustCommand{\lstyle}{% lining figures (cf. command above)
+ \not@math@alphabet\lstyle\relax
+ \exfs@unmerge@families{j}}
+% make a combined command for tabular lining
+\DeclareRobustCommand{\tlstyle}{%
+ \lstyle\tstyle}
+% proportional lining
+\DeclareRobustCommand{\plstyle}{%
+ \lstyle\pstyle}
+% tabular oldstyle {?!}
+\DeclareRobustCommand{\tostyle}{%
+ \ostyle\tstyle}
+%:end-added % si is italic sc
+\newcommand*{\sidefault}{si}
+\DeclareRobustCommand{\sishape}{%
+ \not@math@alphabet\sishape\relax
+ \fontshape\sidefault\selectfont}
+%:cfr-added - is this how outline shapes should be handled?
+\newcommand*{\oldefault}{ol}
+\DeclareRobustCommand{\olshape}{%
+ \not@math@alphabet\olshape\relax
+ \fontshape\oldefault\selectfont}
+\newcommand*{\scoldefault}{scol}
+\DeclareRobustCommand{\scolshape}{%
+ \not@math@alphabet\scolshape\relax
+ \fontshape\scoldefault\selectfont}
+%\DeclareRobustCommand{\olshape}{%
+% \not@math@alphabet\olshape\relax
+% \exfs@merge@shape{\oldefault}{\scdefault}{\scoldefault}}
+%:fudge
+\newcommand*{\udefault}{u}
+\DeclareRobustCommand{\ushape}{%
+ \not@math@alphabet\ushape\relax
+ \fontshape\udefault\selectfont}
+\newcommand*{\scudefault}{su}
+\DeclareRobustCommand{\scushape}{%
+ \not@math@alphabet\scushape\relax
+ \fontshape\scudefault\selectfont}
+%:upright italic
+\newcommand*{\uidefault}{ui}
+\DeclareRobustCommand{\uishape}{%
+ \not@math@alphabet\uishape\relax
+ \fontshape\uidefault\selectfont}
+%:can i do this for reverse italic?
+\newcommand*{\ridefault}{ri}
+\DeclareRobustCommand{\rishape}{%
+ \not@math@alphabet\rishape\relax
+ \fontshape\ridefault\selectfont}
+%:end-added
+\newcommand*{\exfs@merge@shape}[3]{%
+ \edef\exfs@tempa{#1}%
+ \edef\exfs@tempb{#2}%
+ \ifx\f@shape\exfs@tempb
+ \expandafter\ifx\csname\f@encoding/\f@family/\f@series/#3\endcsname\relax
+ \else
+ \edef\exfs@tempa{#3}%
+ \fi
+ \fi
+ \fontshape{\exfs@tempa}\selectfont}
+%:cfr-added - merge width changes into series
+\newcommand*{\exfs@font@width}{%
+ \edef\exfs@tempf{\expandafter\exfs@first\f@series\@nil }%
+ \edef\exfs@temppart{\expandafter\exfs@part\f@series\@nil }%
+ \ifx\exfs@temppart\@empty
+ \def\exfs@width{}
+ \else
+ \edef\exfs@temps{\expandafter\exfs@second\f@series\@nil }%
+ \ifx\exfs@temps{b}
+ \edef\exfs@width{\expandafter\exfs@part\exfs@temps\@nil }%
+ \else
+ \ifx\exfs@temps{l}
+ \edef\exfs@width{\expandafter\exfs@part\exfs@temps\@nil }%
+ \else
+ \edef\exfs@width{\exfs@temppart}%
+ \fi
+ \fi
+ \fi
+ \exfs@width
+ }
+\newcommand*{\exfs@merge@width}[1]{%
+ \edef\exfs@temph{#1}%
+ \edef\exfs@tempf{\expandafter\exfs@first\f@series\@nil }%
+ \edef\exfs@temppart{\expandafter\exfs@part\f@series\@nil }%
+ \def\tempb{b}%
+ \def\templ{l}%
+ \ifx\exfs@temppart\@empty
+ \def\exfs@series{\expandafter\exfs@tempf\exfs@temph}%
+ \else
+ \edef\exfs@temps{\expandafter\exfs@second\f@series\@nil }%
+ \ifx\exfs@temps\tempb
+ \def\exfs@series{\expandafter\exfs@tempf\exfs@temps\exfs@temph}%
+ \else
+ \ifx\exfs@temps\templ
+ \def\exfs@series{\expandafter\exfs@tempf\exfs@temps\exfs@temph}%
+ \else
+ \def\exfs@series{\expandafter\exfs@tempf\exfs@temph}%
+ \fi
+ \fi
+ \fi
+ \exfs@try@series{\exfs@series}}
+% \fontseries\exfs@series\selectfont}
+\newcommand*{\exfs@unmerge@width}{%
+ \edef\exfs@tempf{\expandafter\exfs@first\f@series\@nil }%
+ \edef\exfs@temppart{\expandafter\exfs@part\f@series\@nil }%
+ \def\tempb{b}%
+ \def\templ{l}%
+ \ifx\exfs@temppart\@empty
+ \def\exfs@series{\expandafter\exfs@tempf}%
+ \else
+ \edef\exfs@temps{\expandafter\exfs@second\f@series\@nil }%
+ \ifx\exfs@temps\tempb
+ \def\exfs@series{\expandafter\exfs@tempf\exfs@temps}%
+ \else
+ \ifx\exfs@temps\templ
+ \def\exfs@series{\expandafter\exfs@tempf\exfs@temps}%
+ \else
+ \def\exfs@series{\expandafter\exfs@tempf}%
+ \fi
+ \fi
+ \fi
+ \exfs@try@series{\exfs@series}}
+\DeclareRobustCommand{\regwidth}{%
+ \not@math@alphabet\regwidth\relax
+ \exfs@unmerge@width}
+\newcommand*{\nwdefault}{c}
+\DeclareRobustCommand{\nwwidth}{%
+ \not@math@alphabet\nwwidth\relax
+ \exfs@merge@width{\nwdefault}}
+\newcommand*{\cddefault}{c}
+\DeclareRobustCommand{\cdwidth}{%
+ \not@math@alphabet\cdwidth\relax
+ \exfs@merge@width{\cddefault}}
+\newcommand*{\ecdefault}{ec}
+\DeclareRobustCommand{\ecwidth}{%
+ \not@math@alphabet\ecwidth\relax
+ \exfs@merge@width{\ecdefault}}
+\newcommand*{\ucdefault}{uc}
+\DeclareRobustCommand{\ucwidth}{%
+ \not@math@alphabet\ucwidth\relax
+ \exfs@merge@width{\ucdefault}}
+\newcommand*{\etdefault}{x}
+\DeclareRobustCommand{\etwidth}{%
+ \not@math@alphabet\etwidth\relax
+ \exfs@merge@width{\etdefault}}
+\newcommand*{\epdefault}{x}
+\DeclareRobustCommand{\epwidth}{%
+ \not@math@alphabet\epwidth\relax
+ \exfs@merge@width{\epdefault}}
+\newcommand*{\exdefault}{ex}
+\DeclareRobustCommand{\exwidth}{%
+ \not@math@alphabet\exwidth\relax
+ \exfs@merge@width{\exdefault}}
+\newcommand*{\uxdefault}{ux}
+\DeclareRobustCommand{\uxwidth}{%
+ \not@math@alphabet\uxwidth\relax
+ \exfs@merge@width{\uxdefault}}
+%:cfr-added merge weight changes into series
+\newcommand*{\exfs@merge@weight}[1]{%
+ \edef\exfs@tempg{#1}%
+ \edef\exfs@tempf{\expandafter\exfs@first\f@series\@nil }%
+ \edef\exfs@temppart{\expandafter\exfs@part\f@series\@nil }%
+ \def\templ{l}%
+ \def\tempb{b}%
+ %:case when there's no second part, so the single character must be the weight and should be replaced
+ \ifx\exfs@temppart\@empty
+ \def\exfs@series{\expandafter\exfs@tempg}%
+ %:case when there's a second part
+ \else
+ %:get first character of second part
+ \edef\exfs@temps{\expandafter\exfs@second\f@series\@nil }%
+ \edef\exfs@tempw{\expandafter\exfs@part\exfs@temps\@nil }%
+ %:is the first character b? if so, it is part of the weight and should be replaced
+ \ifx\exfs@temps\tempb
+ \def\exfs@series{\expandafter\exfs@tempg\exfs@tempw}%
+ \else
+ %:is the first character l? if so, it is part of the weight and should be replaced
+ \ifx\exfs@temps\templ
+ \def\exfs@series{\expandafter\exfs@tempg\exfs@tempw}%
+ \else
+ %:o/w the first character is part of the width and should be retained
+ \def\exfs@series{\expandafter\exfs@tempg\exfs@temppart}%
+ \fi
+ \fi
+ \fi
+ %\fontseries\exfs@series\selectfont}
+ \ifx\exfs@tempg\exfs@series
+ \exfs@try@series{\exfs@series}%
+ \else
+ \exfs@try@series[\exfs@tempg]{\exfs@series}% assume user wants to change weight even if this changes back to the default width
+ \fi}
+\newcommand*{\mbdefault}{mb}
+\DeclareRobustCommand{\mbweight}{%
+ \not@math@alphabet\mbweight\relax
+ \exfs@merge@weight{\mbdefault}}
+\newcommand*{\dbdefault}{db}
+\DeclareRobustCommand{\dbweight}{%
+ \not@math@alphabet\dbweight\relax
+ \exfs@merge@weight{\dbdefault}}
+\newcommand*{\sbdefault}{sb}
+\DeclareRobustCommand{\sbweight}{%
+ \not@math@alphabet\sbweight\relax
+ \exfs@merge@weight{\sbdefault}}
+\newcommand*{\ebdefault}{eb}
+\DeclareRobustCommand{\ebweight}{%
+ \not@math@alphabet\ebweight\relax
+ \exfs@merge@weight{\ebdefault}}
+\newcommand*{\ubdefault}{ub}
+\DeclareRobustCommand{\ubweight}{%
+ \not@math@alphabet\ubweight\relax
+ \exfs@merge@weight{\ubdefault}}
+\newcommand*{\lgdefault}{l}
+%note - use this if light is a variant weight, rather than a separate family
+\DeclareRobustCommand{\lgweight}{%
+ \not@math@alphabet\lgweight\relax
+ \exfs@merge@weight{\lgdefault}}
+\newcommand*{\eldefault}{el}
+\DeclareRobustCommand{\elweight}{%
+ \not@math@alphabet\elweight\relax
+ \exfs@merge@weight{\eldefault}}
+\newcommand*{\uldefault}{ul}
+\DeclareRobustCommand{\ulweight}{%
+ \not@math@alphabet\ulweight\relax
+ \exfs@merge@weight{\uldefault}}
+%:end-added
+\DeclareRobustCommand{\itshape}{%
+ \not@math@alphabet\itshape\mathit
+ \exfs@merge@shape{\itdefault}{\scdefault}{\sidefault}}
+% original
+%\DeclareRobustCommand{\scshape}{%
+% \not@math@alphabet\scshape\relax
+% \exfs@merge@shape{\scdefault}{\itdefault}{\sidefault}}
+%:cfr-altered: \scshape
+\DeclareRobustCommand{\scshape}{%
+ \not@math@alphabet\scshape\relax
+ \def\tempu{u}%
+ \def\tempo{ol}%
+ \ifx\f@shape\tempu
+ \exfs@merge@shape{\scdefault}{\udefault}{\scudefault}%
+ \else
+ \ifx\f@shape\tempo
+ \exfs@merge@shape{\scdefault}{\oldefault}{\scoldefault}%
+ \else
+ \exfs@merge@shape{\scdefault}{\itdefault}{\sidefault}%
+ \fi
+ \fi}
+%:end-altered
+\DeclareRobustCommand{\upshape}{%
+ \not@math@alphabet\upshape\relax
+ \exfs@merge@shape{\updefault}{\sidefault}{\scdefault}}
+\DeclareRobustCommand{\dfshape}{%
+ \not@math@alphabet\dfshape\relax
+ \fontshape\shapedefault\selectfont}
+\newcommand*{\swshapedefault}{\itdefault}
+\DeclareRobustCommand{\swshape}{%
+ \not@math@alphabet\swshape\relax
+ \swstyle\fontshape\swshapedefault\selectfont}
+\DeclareTextFontCommand{\textln}{\lnstyle}
+\DeclareTextFontCommand{\textos}{\osstyle}
+\DeclareTextFontCommand{\textin}{\instyle}
+\DeclareTextFontCommand{\textsu}{\sustyle}
+\DeclareTextFontCommand{\textsi}{\sishape}
+\DeclareTextFontCommand{\textdf}{\dfshape}
+\DeclareTextFontCommand{\textsw}{\swshape}
+%:cfr-added
+%:families
+\DeclareTextFontCommand{\textti}{\tistyle}
+\DeclareTextFontCommand{\textlt}{\ltstyle}
+\DeclareTextFontCommand{\textof}{\ofstyle} % open-face (or outline or blank) style
+\DeclareTextFontCommand{\textalt}{\altstyle} % alternative style
+\DeclareTextFontCommand{\textreg}{\regstyle} % ``regular'' style
+\DeclareTextFontCommand{\emboss}{\embossstyle}
+\DeclareTextFontCommand{\textorn}{\ornamentalstyle} % intended primarily for decorative initials etc.
+\DeclareTextFontCommand{\textqt}{\qtstyle}
+\DeclareTextFontCommand{\textsh}{\shstyle} % shadowed style
+\DeclareTextFontCommand{\texttm}{\tmstyle}
+\DeclareTextFontCommand{\texttv}{\tvstyle}
+%:families - figures
+\DeclareTextFontCommand{\textl}{\lstyle}
+\DeclareTextFontCommand{\texto}{\ostyle}
+\DeclareTextFontCommand{\textp}{\pstyle}
+\DeclareTextFontCommand{\textt}{\tstyle}
+\DeclareTextFontCommand{\textpl}{\plstyle}
+\DeclareTextFontCommand{\textpo}{\postyle}
+\DeclareTextFontCommand{\texttl}{\tlstyle}
+\DeclareTextFontCommand{\textto}{\tostyle}
+%:shapes
+\DeclareTextFontCommand{\textol}{\olshape} % outline
+\DeclareTextFontCommand{\textswash}{\swashstyle} % an attempt to improve on \textsw
+\DeclareTextFontCommand{\textu}{\ushape}
+\DeclareTextFontCommand{\textscu}{\scushape}
+\DeclareTextFontCommand{\textui}{\uishape} % upright italic
+\DeclareTextFontCommand{\textri}{\rishape} % reverse italic
+%:widths
+\DeclareTextFontCommand{\textnw}{\nwwidth}
+\DeclareTextFontCommand{\textcd}{\cdwidth}
+\DeclareTextFontCommand{\textec}{\ecwidth}
+\DeclareTextFontCommand{\textuc}{\ucwidth}
+\DeclareTextFontCommand{\textet}{\etwidth}
+\DeclareTextFontCommand{\textep}{\epwidth}
+\DeclareTextFontCommand{\textex}{\exwidth}
+\DeclareTextFontCommand{\textux}{\uxwidth}
+\DeclareTextFontCommand{\textrw}{\regwidth}
+%:weights
+\DeclareTextFontCommand{\textmb}{\mbweight}
+\DeclareTextFontCommand{\textdb}{\dbweight}
+\DeclareTextFontCommand{\textsb}{\sbweight}
+\DeclareTextFontCommand{\texteb}{\ebweight}
+\DeclareTextFontCommand{\textub}{\ubweight}
+\DeclareTextFontCommand{\textlg}{\lgweight}
+\DeclareTextFontCommand{\textel}{\elweight}
+\DeclareTextFontCommand{\textul}{\ulweight}
+%end-added
+\newcommand*{\DeclareTextOrnament}[7]{%
+ \expandafter\def\csname#1@orn\@roman#2\endcsname{#3/#4/#5/#6/#7}}
+\begingroup
+ \catcode`\/=12
+ \gdef\exfs@split@orndef#1/#2/#3/#4/#5\@nil{%
+ \def\f@encoding{#1}%
+ \def\f@family{#2}%
+ \def\f@series{#3}%
+ \def\f@shape{#4}%
+ \def\exfs@tempa{#5}}
+\endgroup
+\def\exfs@base@family{\expandafter\exfs@get@base\f@family\@nil}
+\DeclareRobustCommand{\ornament}[1]{%
+ \expandafter\ifx\csname\exfs@base@family @orn\@roman#1\endcsname\relax
+ \PackageWarning{nfssext}{%
+ Ornament #1 undefined for font family '\exfs@base@family'\MessageBreak
+ Setting debug mark}%
+ \rule{1ex}{1ex}%
+ \else
+ \begingroup
+ \edef\exfs@tempb{\csname\exfs@base@family @orn\@roman#1\endcsname}%
+ \expandafter\expandafter\expandafter\exfs@split@orndef
+ \expandafter\string\exfs@tempb\@nil
+ \selectfont\char\exfs@tempa
+ \endgroup
+ \fi}
+%:add microtype hooks
+%:partly from microtype docs; partly from MinionPro package
+\def\nfssextcfr@MT@Hook{%
+% \DeclareMicrotypeVariants{x,j,w,a,d,0,1}% this is the default declaration according to the docs
+% \DeclareMicrotypeVariants*{2,e,h,l}% this should *append* the variants (what do I use 'f' for? better take it out...)
+ \DeclareMicrotypeVariants*{2,2d,2dj,2j,dj,e,h,l}% is this necessary or would the previous line be enough?
+ }
+\@ifpackageloaded{microtype}{%
+ \nfssextcfr@MT@Hook}{%
+ \@ifundefined{Microtype@Hook}{%
+ \let\Microtype@Hook\nfssextcfr@MT@Hook}{% MinionPro has \global before this
+ \g@addto@macro\Microtype@Hook{\nfssextcfr@MT@Hook}}}
+\endinput
diff --git a/macros/latex/contrib/nfssext-cfr/nfssext-cfr.tex b/macros/latex/contrib/nfssext-cfr/nfssext-cfr.tex
new file mode 100644
index 0000000000..8cf5a6c788
--- /dev/null
+++ b/macros/latex/contrib/nfssext-cfr/nfssext-cfr.tex
@@ -0,0 +1,196 @@
+% !TEX TS-program = pdflatex
+% !TEX encoding = UTF-8 Unicode
+% arara: pdflatex: { synctex: true }
+\pdfminorversion=7
+\RequirePackage{svn-prov}
+\ProvidesFileSVN{$Id: nfssext-cfr.tex 6143 2017-03-28 22:45:37Z cfrees $}[\revinfo{}]
+\documentclass[pagesize=auto, fontsize=10pt, DIV=11]{scrartcl}
+
+\usepackage{cfr-lm}
+\usepackage{textcomp,longtable,array,booktabs}
+\usepackage{microtype}
+
+\newcommand*{\mail}[1]{\texttt{#1}}
+\newcommand*{\pkg}[1]{\mbox{\textsf{#1}}}
+\newcommand*{\cs}[1]{\texttt{\textbackslash #1}}
+
+\addtokomafont{title}{\rmfamily}
+
+\title{The \pkg{nfssext-cfr} package}
+\author{Clea F. Rees\thanks{\mail{ReesC21 <at> cardiff <dot> ac <dot> uk}}}
+\date{2017/03/28}
+
+
+\begin{document}
+
+\maketitle
+
+\begin{abstract}
+ \noindent \pkg{nfssext-cfr} is an extension of Philipp Lehman's \pkg{nfssext}\@.
+ \pkg{nfssext} provides commands which enables one to specify font features not covered by the New Font Selection Scheme of \LaTeXe\@.
+ \pkg{nfssext-cfr} provides additional commands, further extending the facilities offered by NFSS.
+\end{abstract}
+
+\section*{Introduction}
+
+\pkg{nfssext-cfr} is required by various font support packages I've written.
+It is being released separately to avoid unnecessary duplication and confusion.
+At least, I hope it will remove at least one source of unnecessary confusion.
+I have no reason to think it will avoid any of the others.
+
+The code is somewhat experimental.
+It works for me.
+So far.
+If you discover problems, please let me know.
+If you know how to fix them, even better.
+
+\section*{Caveats, Warnings and Qualifications}
+
+The actual effect of any macro depends on any changes made to the defaults for various font features, the current font and, of course, what is available.
+
+For example, \cs{itdefault} is intended to be the name of italic shape and is used by the redefined \cs{itshape} supplied by this package.
+By default, \cs{itdefault} is \texttt{it}.
+However, if you change that to, say, \texttt{sl}, then \cs{itshape} will use \texttt{sl} instead.
+
+Moreover, if the current shape is small-caps, \cs{itshape} will attempt to merge the default italic shape with the small-caps.
+That is, it will try to select small-caps italic, if possible, before resorting to plain italic.
+
+The macros operating on family names are almost entirely reliant on font names adhering strictly to the Karl Berry schema.
+This includes the stipulation that multiple variants be listed in alphabetical order.
+These macros cannot be used with fonts named in any other way.
+
+Likewise, the macros for series and shapes are unlikely to have their expected effects if fonts are not packaged in ways which both adhere to the NFSS schema and, where relevant, to the specific way that schema is extended here.
+In particular, note that italic small-caps is assumed to be coded as \texttt{si}.
+
+If a macro's attempt to enable or disable a font feature fails, a warning will generally be written to the console, but the code tries hard not to trigger errors.
+If an attempt triggers an error, that's a bug, so please let me know.
+If an attempt triggers a warning, please note that there may be no bug at all and, if there is a bug, it is probably not in this package.
+
+To be clear, there certainly are bugs.
+It is just statistically unlikely that any given warning is caused by one.
+
+{%
+ \fontfamily{pzc}\fontshape{it}\fontseries{m}\selectfont\Large Caveat emptor \dots\par
+}
+
+\section*{Macros}
+
+The following table includes macros supplied by the original \pkg{nfssext} and additions available with \pkg{nfssext-cfr}.
+
+The third column lists the default letter codes for various font features.
+As explained above, if the defaults are changed, the macros will try to do something different.
+
+A \texttt{+} indicates that the macro will attempt to merge the addition into the current font's family name, series or shape.
+For example, if the current font uses oldstyle figures, the \texttt{+2} indicates that \cs{pstyle} will attempt to select a font with figures which are both proportional and oldstyle.
+
+A \textt{-} indicates that the macro will attempt to subtract from the current font's family name, series or shape.
+For example, if the current font uses oldstyle figures, the \texttt{-2} indicates that \cs{tstyle} will attempt to select a font with figures which are both tabular and oldstyle.
+
+A comma-separated list indicates consecutive additions and/or subtraction.
+
+If no \texttt{+-} is used, the macro tries to select a font with the given feature without merging.
+For example \cs{sistyle} tries to switch to \texttt{si} shape regardless of the current font shape.
+
+A \texttt{--} indicates that the macro will try to clear all relevant letter codes from the current font's family name, series or shape.
+For example, \cs{regwidth} tries to switch to a series with no letter codes indicating non-standard widths in its name.
+
+Additions, subtractions and clearances operate on font family names, series or shapes, as appropriate.
+In general, macros with \texttt{style} in their names operate on family names; those with \texttt{shape} operate on shape codes; and those with \textt{width} or \texttt{weight} operate on series codes.
+
+The letter codes correspond to those specified by the NFSS specification, unless the specification does not include the relevant feature.
+In the latter case, I tried to choose something sensible i.e.~something which made sense to me at the time.
+
+
+\begin{longtable}{lll>{\ttfamily}ll}
+ \toprule\endhead
+ \bottomrule\endfoot
+ \multicolumn{5}{l}{\sffamily Standard macros redefined:}\\
+ \cmidrule(lr){1-5}
+ & \cs{itshape}\\
+ & \cs{scshape}\\
+ & \cs{upshape}\\
+ \cmidrule(lr){1-5}
+ \multicolumn{5}{l}{\sffamily Families --- Styles:}\\
+ \cmidrule(lr){1-5}
+ & \cs{textti} & \cs{tistyle} & +d & titling/display\\
+ & \cs{textlt} & \cs{ltstyle} & +l & light (when separate family)\\
+ & \cs{textof} & \cs{ofstyle} & +l & open-face (or outline or blank) style\\
+ & \cs{textalt} & \cs{altstyle} & +a & alternative style\\
+ & \cs{textreg} & \cs{regstyle} & -- & regular style\\
+ & \cs{emboss} & \cs{embossstyle} & +e & \\
+ & \cs{textorn} & \cs{ornamentalstyle} & +p & intended primarily for decorative initials etc.\\
+ & \cs{ornament} & \\
+ & \cs{textqt} & \cs{qtstyle} & +q & quotation style\\
+ & \cs{textsh} & \cs{shstyle} & +h & shadowed style\\
+ & \cs{texttm} & \cs{tmstyle} & -s,-v,+t & monowidth typewriter\\
+ & \cs{texttv} & \cs{tvstyle} & -s,-t,+v & variable width typewriter\\
+ & \cs{textswash} & \cs{swashstyle} & +w & an attempt to improve on \cs{textsw}\\
+ \cmidrule(lr){1-5}
+ \multicolumn{5}{l}{\sffamily Families --- Figures:}\\
+ \cmidrule(lr){1-5}
+ & \cs{textln} & \cs{lnstyle} & -- & lining figures (cf.~macro below)\\
+ & \cs{textos} & \cs{osstyle} & j & oldstyle figures (cf.~macro below)\\
+ & \cs{textin} & \cs{instyle} & 0 & inferior figures\\
+ & \cs{textsu} & \cs{sustyle} & 1 & superior figures\\
+ & \cs{textl} & \cs{lstyle} & -j & lining figures (cf.~command above)\\
+ & \cs{texto} & \cs{ostyle} & +j & oldstyle figures (cf.~original \cs{osstyle} above)\\
+ & \cs{textp} & \cs{pstyle} & +2 & proportional figures\\
+ & \cs{textt} & \cs{tstyle} & -2 & tabular figures\\
+ & \cs{textpl} & \cs{plstyle} & -j,+2 & proportional lining figures \\
+ & \cs{textpo} & \cs{postyle} & +2j & proportional oldstyle figures \\
+ & \cs{texttl} & \cs{tlstyle} & -j,-2 & tabular lining figures\\
+ & \cs{textto} & \cs{tostyle} & +j,-2 & tabular oldstyle figures\\
+ \cmidrule(lr){1-5}
+ \multicolumn{5}{l}{\sffamily Shapes:}\\
+ \cmidrule(lr){1-5}
+ & \cs{scolshape} & & scol & \\
+ & \cs{textol} & \cs{olshape} & ol & outline\\
+ & \cs{textsi} & \cs{sishape} & si & italic small-caps\\
+ & \cs{textu} & \cs{ushape} & u & \\
+ & \cs{textscu} & \cs{scushape} & su & \\
+ & \cs{textui} & \cs{uishape} & ui & upright italic\\
+ & \cs{textri} & \cs{rishape} & ri & reverse italic\\
+ & \cs{textdf} & \cs{dfshape} & n & default shape\\
+ & \cs{textsw} & \cs{swshape} & it & swash shape (cf.~\cs{swstyle} above)\\
+ & & \cs{swstyle} & \\
+ \cmidrule(lr){1-5}
+ \multicolumn{5}{l}{\sffamily Series --- Widths:}\\
+ \cmidrule(lr){1-5}
+ & \cs{textnw} & \cs{nwwidth} & +c & \\
+ & \cs{textcd} & \cs{cdwidth} & +c & \\
+ & \cs{textec} & \cs{ecwidth} & +ec & \\
+ & \cs{textuc} & \cs{ucwidth} & +uc & \\
+ & \cs{textet} & \cs{etwidth} & +x & \\
+ & \cs{textep} & \cs{epwidth} & +x & \\
+ & \cs{textex} & \cs{exwidth} & +ex & \\
+ & \cs{textux} & \cs{uxwidth} & +ux & \\
+ & \cs{textrw} & \cs{regwidth} & -- & \\
+ \cmidrule(lr){1-5}
+ \multicolumn{5}{l}{\sffamily Series --- Weights:}\\
+ \cmidrule(lr){1-5}
+ & \cs{textmb} & \cs{mbweight} & +mb & \\
+ & \cs{textdb} & \cs{dbweight} & +db & \\
+ & \cs{textsb} & \cs{sbweight} & +sb & \\
+ & \cs{texteb} & \cs{ebweight} & +eb & \\
+ & \cs{textub} & \cs{ubweight} & +ub & \\
+ & \cs{textlg} & \cs{lgweight} & +l & \\
+ & \cs{textel} & \cs{elweight} & +el & \\
+ & \cs{textul} & \cs{ulweight} & +ul & \\
+\end{longtable}
+
+\section*{History}
+
+\subsection*{2017-03-28}
+Attempt to modify \cs{tmstyle} and \cs{tvstyle} to work as advertised.
+Extend documentation somewhat.
+
+\subsection*{2010}
+The 2010 update includes an attempt to improve the behaviour of \verb|\ofstyle|, and to add support for \pkg{microtype}.
+I didn't publish this at the time because I wanted to test it first.
+I have just discovered that I am still using a local copy.
+Insofar as one person can test something, I figure that 5 years ought to be enough to pick up the most obvious problems.
+However, your kilometres may, as always, vary.
+
+There should be no changes for the end user except that in certain cases it is possible that line-breaks may be altered if \pkg{microtype} is in use due to the enhanced support included for variant font families.
+
+\end{document}