diff options
author | Karl Berry <karl@freefriends.org> | 2012-07-14 16:22:03 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2012-07-14 16:22:03 +0000 |
commit | 7580e0584873d1ed5ed97c98b87e3aa32753ea46 (patch) | |
tree | 93184cec15fc66922be520f2a60b0fb883a7f8fb /Master/texmf-dist/tex | |
parent | 2c00df54e8832273ac81fa75582d143889a2689b (diff) |
new latex package typeface (20jun12)
git-svn-id: svn://tug.org/texlive/trunk@27046 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex')
-rw-r--r-- | Master/texmf-dist/tex/latex/typeface/typeface.cfg | 320 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/typeface/typeface.sty | 5355 |
2 files changed, 5675 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/typeface/typeface.cfg b/Master/texmf-dist/tex/latex/typeface/typeface.cfg new file mode 100644 index 00000000000..99216730664 --- /dev/null +++ b/Master/texmf-dist/tex/latex/typeface/typeface.cfg @@ -0,0 +1,320 @@ +% $Id: typeface.cfg 905 2012-06-18 03:44:37Z Geoffrey $ +% +\ProvidesFile{\TF@CONFIGFILE} + [2012/03/05 \TF@PACKAGENAME\space package configuration file] + +% Provide some EXTRA encoding choices to typeface package users at +% this site. NB, internal code, so comma not colon-separated lists. +%------------------------------------------------------------------ +% % in this example, make sure xxenc.def and yyenc.def exist +% % or fontenc will complain +% \renewcommand*\tf@fontencodingchoices{XX,XY} + +% Redefine site default typefaces. Here are some typographically dubious +% examples. Note that since these definitions literally substitute for +% users' package options if not explicitly provided, ensure your syntax +% is correct -- package (sub)options lists should be colon not +% comma-separated. +%----------------------------------------------------------------------- +% \renewcommand*\TF@DEFAULTRMFONT{kpfonts:veryoldstyle:largesmallcaps} +% \renewcommand*\TF@DEFAULTSFFONT{helv:scale:0.75} +% \renewcommand*\TF@DEFAULTTTFONT{luxi} +% \renewcommand*\TF@DEFAULTMATHFONT{iwona:light:condensed} +% \renewcommand*\TF@DEFAULTSYMBOLSFONT{ams} +% \renewcommand*\TF@DEFAULTTEXTFIGURESFONT{palatino:spacing:20:lkern:-20:rkern:5} + +% Ditto here. Possibly useful for configuring locales, e.g., +%----------------------------------------------------------- +% \renewcommand*\TF@DEFAULTFONTENCODING{EU1:T1} +% \renewcommand*\TF@DEFAULTINPUTENCODING{dontload} +% \renewcommand*\TF@DEFAULTTEXTCOMP{safe} +% \renewcommand*\TF@DEFAULTCMAP{ignore} + +% Redefine in-built debug colours +%-------------------------------- +% \renewcommand*\TF@DEBUG@COLOUR@TS{purple} +% \renewcommand*\TF@DEBUG@COLOUR@SC{magenta} +% \renewcommand*\TF@DEBUG@COLOUR@JF{green} +% \renewcommand*\TF@DEBUG@COLOUR@XF{red} +% \renewcommand*\TF@DEBUG@COLOUR@LININGNUMS{olive} +% \renewcommand*\TF@DEBUG@COLOUR@RM{Indigo} +% \renewcommand*\TF@DEBUG@COLOUR@SF{Maroon} +% \renewcommand*\TF@DEBUG@COLOUR@TT{Green} +% \renewcommand*\TF@DEBUG@COLOUR@MATH{ProcessBlue} +% \renewcommand*\TF@DEBUG@COLOUR@XFNAME{\TF@DEBUG@COLOUR@XF} + +% Examples \beforeloadingXXX and \afterloadingXXX, +% where XXX is symbols, math, rm, sf, tt or textfigures +%-------------------------------------------------------- +% \newcommand*\beforeloadingmath{ +% \ifthenelse{\equal{\tf@mathfont}{amsfonts}}{ +% % undefine the following to prevent amsfonts namespace clashes +% \tf@undefinecommands{\underrightarrow,\underleftarrow} +% \TF@PackageDebugInfoNoLine[\TF@CONFIGFILE]{% +% Blew away \string\underrightarrow\space and +% \string\underleftarrow\MessageBreak +% symbols before loading amsfonts package} +% }{} +% } + +% User-supplied typeface definitions for the typeface package +%============================================================ +% The \newtypeface command can be used to introduce new +% fonts to typeface package management. The command accepts +% one optional and four required parameters: +% #1: [<optional comma-separated list of aliases for typeface name>] +% #2: {<typeface name>} +% #3: {<human-readable typeface name (its print name)>} +% #4: {<typeface family: rm, sf, tt, math, symbol or textfigures>} +% #5: {<typeface initialisation code>} +%--------------------------------------------------------------------- + +% Example typeface definitions follow. Most of these involve +% commercial fonts that will need to be purchased and installed. +% +% NB, bear in mind that unless you override it using the `fontloadorder' +% package option (which you should vigorously try to avoid) the +% typeface package loads fonts in this order: +% textfigures, symbols, math, rm, sf, tt +% This will make a difference if your code loads and doesn't properly +% account for packages that override font setups configured earlier in +% the chain (best if you can keep your code free of side effects, as +% in the examples below). +% +% Use debug-instrumented command \tf@usefontpackage in preference to +% \usepackage whenever loading font packages, not using it at other times. +%------------------------------------------------------------------------- + +% Adobe American Typewriter (strictly speaking, not a monospaced font) +\newtypeface[americantypewriter,americantt,att]{adobeamericantypewriter} + {Adobe American Typewriter}{tt}{ + % the \scaletypeface command, below, requires compatible *pat.fd files + \scaletypeface{tt}{\newcommand*\pat@scale{\tf@ttscalefactor}} + \renewcommand{\ttdefault}{pat} +} + +% Adobe Bembo +\newtypeface[bembo]{adobebembo}{Adobe Bembo}{rm}{ + \renewcommand*\rmdefault{pbb} + \tf@SCencodedosf +} + +% Adobe Caslon +\newtypeface{adobecaslon}{Adobe Caslon}{rm}{ + \renewcommand*\rmdefault{pac} + \tf@SCencodedosf +} + +% Adobe Garamond +\newtypeface{adobegaramond}{Adobe Garamond}{rm}{ + \renewcommand*\rmdefault{pad} + \tf@SCencodedosf +} + +% Adobe Gill Sans +\newtypeface[adobegill,gillsans,gill]{adobegillsans}{Adobe Gill Sans}{sf}{ + % the \scaletypeface command, below, requires compatible *pgs.fd files + \scaletypeface{sf}{\newcommand*\pgs@scale{\tf@sfscalefactor}} + \renewcommand*\sfdefault{pgs} +} + +% Adobe Granjon +\newtypeface{adobegranjon}{Adobe Granjon}{rm}{ + \renewcommand*\rmdefault{pgj} + \tf@SCencodedosf +} + +% Adobe Janson. NB, this is Adobe Janson, NOT Adobe Jenson! +\newtypeface{adobejanson}{Adobe Janson}{rm}{ + \renewcommand*\rmdefault{pjn} + \tf@SCencodedosf +} + +% Adobe Jenson. NB, this is Adobe Jenson, NOT Adobe Janson! +\newtypeface{adobejenson}{Adobe Jenson}{rm}{ + \renewcommand*\rmdefault{paj} + \TF@NativeOSFError +} + +% Adobe Lucida +\newtypeface{adobelucida}{Adobe Lucida}{rm}{ + \renewcommand*\rmdefault{plc} + \TF@NativeOSFError +} + +% Adobe Myriad Pro +\newtypeface{adobemyriadpro}{Adobe Myriad Pro}{sf}{ + \tf@ifsuboption{osf}{\tf@sffontoptions}{ + % Myriad Pro has an OSF variant (depending on your installation) + \renewcommand*\sfdefault{Myriad-OsF} + \xdef\tf@sfprintname{\tf@sfprintname\ OSF} + }{ + \renewcommand*\sfdefault{Myriad-LF} + } +} + +% Adobe Sabon +\newtypeface{adobesabon}{Adobe Sabon}{rm}{ + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@JF}}{ + \renewcommand*\rmdefault{psbj} % Native old style figures + \tf@define@liningfigures{psb} + }{ + \renewcommand*\rmdefault{psb} % Lining figures + } + \tf@define@oldstylenums@cmd{psbj} +} + +% Adobe Sabon text figures +\newtypeface{adobesabon}{Adobe Sabon}{textfigures}{ + \tf@initialisetextfiguresfont{T1} + \tf@DeclareOsfFontShape{m}{n} {psbr9d} + \tf@DeclareOsfFontShape{m}{sc} {psbrc9d} + \tf@DeclareOsfFontShape{m}{it} {psbri9d} + \tf@DeclareOsfFontShape{m}{sl} {psbri9d} + \tf@DeclareOsfFontShape{b}{n} {psbb9d} + \tf@DeclareOsfFontShape{b}{it} {psbbi9d} + \tf@DeclareOsfFontShape{b}{sl} {psbbi9d} + \tf@DeclareOsfFontShape{bx}{n} {psbb9d} + \tf@DeclareOsfFontShape{bx}{it}{psbbi9d} + \tf@DeclareOsfFontShape{bx}{sl}{psbbi9d} +} + +% Adobe Times Roman Expert (with true smallcaps and oldstyle figures) +% NB, if you receive `Package textcomp warning: Oldstyle digits unavailable +% for family ptmj' (or ptmx), you might try loading the typeface +% package with option `textcomp=force', e.g, +% \usepackage[typeface=timesexpert,textcomp=force,...]{typeface} +\newtypeface[timesx]{adobetimesexpert}{Adobe Times Roman Expert}{rm}{ + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@JF}}{ + \renewcommand*\rmdefault{ptmj} % Native old style figures + \tf@define@liningfigures{ptmx} + }{ + \renewcommand*\rmdefault{ptmx} % Lining figures + } +} + +\newtypeface[timesx]{adobetimesexpert}{Adobe Times Roman Expert}{textfigures}{ + \tf@initialisetextfiguresfont{T1} + \tf@DeclareOsfFontShape{m}{n} {ptmr9d} + \tf@DeclareOsfFontShape{m}{sc} {ptmrc9d} + \tf@DeclareOsfFontShape{m}{it} {ptmri9d} + \tf@DeclareOsfFontShape{m}{sl} {ptmri9d} + \tf@DeclareOsfFontShape{b}{n} {ptmb9d} + \tf@DeclareOsfFontShape{b}{sc} {ptmbc9d} + \tf@DeclareOsfFontShape{b}{it} {ptmbi9d} + \tf@DeclareOsfFontShape{b}{sl} {ptmbi9d} + \tf@DeclareOsfFontShape{bx}{n} {ptmb9d} + \tf@DeclareOsfFontShape{bx}{sc}{ptmbc9d} + \tf@DeclareOsfFontShape{bx}{it}{ptmbi9d} + \tf@DeclareOsfFontShape{bx}{sl}{ptmbi9d} +} + +% Adobe Trade Gothic +\newtypeface[atg,tradegothic]{adobetradegothic}{Adobe Trade Gothic}{sf}{ + % the \scaletypeface command, below, requires compatible *ptg.fd files + \scaletypeface{sf}{\newcommand*\ptg@scale{\tf@sfscalefactor}} + \renewcommand*\sfdefault{ptg} +} + +\newtypeface{ebgaramond}{EB Garamond}{rm}{ + % OTF's available at http://www.georgduffner.at/ebgaramond/ + % Converted to type1 using autoinst (but I screwed up ligatures + % conversion on my copy somewhere along the way). + % Note that it's early days for this font, e.g., no bold, bold-italic, + % and extremely poor italic correction. Nevertheless, what there is + % right now is very attractive and shows considerable promise. + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@JF}}{ + \renewcommand*\rmdefault{EBGaramond-OsF} % Native old style figures + \tf@define@liningfigures{EBGaramond-LF} + }{ + \renewcommand*\rmdefault{EBGaramond-LF} % Lining figures + } + \tf@define@oldstylenums@cmd{EBGaramond-OsF} +} + +% Emigre Mrs Eaves +\newtypeface{mrseaves}{Mrs Eaves}{rm}{ + \renewcommand*\bfdefault{b} + \renewcommand*\mddefault{m} + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@JF}}{ + \renewcommand*\rmdefault{MrsEavesOT-OsF} % Native old style figures + \tf@define@liningfigures{MrsEavesOT-LF} + }{ + \renewcommand*\rmdefault{MrsEavesOT-LF} % Lining figures + } + \tf@define@oldstylenums@cmd{MrsEavesOT-OsF} +} + +% Hoefler & Frere-Jones Hoefler Text +\newtypeface[hoefler]{hoeflertext}{Hoefler Text}{rm}{ + \renewcommand*\rmdefault{eht} % TODO: configure lf for HOEFLER TEXT ALT. + \tf@define@liningfigures{ptm} % Until then, use Times lf instead. Urggh. + \tf@define@oldstylenums@cmd{eht} % Redefine \oldstylenums to suit. +} + +\newtypeface[hoefler]{hoeflertext}{Hoefler Text}{textfigures}{ + \tf@initialisetextfiguresfont{T1} + \tf@DeclareOsfFontShape{m}{n} {ehtr8t} + \tf@DeclareOsfFontShape{m}{sc} {ehtrc8t} + \tf@DeclareOsfFontShape{m}{sl} {ehtro8t} + \tf@DeclareOsfFontShape{m}{it} {ehtri8t} + \tf@DeclareOsfFontShape{b}{n} {ehtb8t} + \tf@DeclareOsfFontShape{b}{sc} {ehtbc8t} + \tf@DeclareOsfFontShape{b}{sl} {ehtbo8t} + \tf@DeclareOsfFontShape{b}{it} {ehtbi8t} + \tf@DeclareOsfFontShape{eb}{n} {ehtc8t} + \tf@DeclareOsfFontShape{eb}{sc}{ehtcc8t} + \tf@DeclareOsfFontShape{eb}{sl}{ehtco8t} + \tf@DeclareOsfFontShape{eb}{it}{ehtci8t} + \tf@DeclareOsfFontShape{bx}{n} {ehtb8t} + \tf@DeclareOsfFontShape{bx}{sc}{ehtbc8t} + \tf@DeclareOsfFontShape{bx}{sl}{ehtbo8t} + \tf@DeclareOsfFontShape{bx}{it}{ehtbi8t} +} + +% Linotype Didot +\newtypeface[ldidot]{linotypedidot}{Linotype Didot}{rm}{ + \renewcommand*\rmdefault{ldo} + \tf@SCencodedosf +} + +% Linotype Sabon +\newtypeface[lsabon]{linotypesabon}{Linotype Sabon}{rm}{ + \renewcommand*\rmdefault{lsb} + \TF@NativeOSFError +} + +% Linotype Times Ten +\newtypeface[timesten]{linotypetimesten}{Linotype Times Ten}{rm}{ + \renewcommand*\rmdefault{ltt} + \TF@NativeOSFError +} + +% Monotype Scotch Roman. Ha ha! Might look good in an ancient history thesis! +\newtypeface[scotchroman]{monotypescotchroman}{Monotype Scotch Roman}{rm}{ + \renewcommand*\rmdefault{ms1} + \TF@NativeOSFError +} + +\newtypeface[vgaramond,varoquaux]{varoquauxgaramond} + {URW Garamond (Varoquaux)}{rm}{ + % Modded set of URW Garamond fonts (possibly) available at + % http://gael-varoquaux.info/computers/garamond/index.html + % This fontset provides several advantages over URW Garamond, including: + % smallcaps, osf and long tailed Q. However, like URW Garamond, there are + % weaknesses. Adobe Garamond offers another alternative. + \renewcommand*\rmdefault{ggm}\normalfont + \tf@define@liningfigures{ugm} + \TF@NativeLFError +} + +% Verdana truetype font (see verdana package for further details) +\newtypeface{verdana}{Verdana}{sf}{ + \tf@ifsuboption{nofligatures}{\tf@sffontoptions}{ + \renewcommand{\sfdefault}{vnax} % if f-ligatures cause problems + }{ + \renewcommand{\sfdefault}{vna} + } +} + +%-------- End typeface.cfg ---------------------------------------------------- diff --git a/Master/texmf-dist/tex/latex/typeface/typeface.sty b/Master/texmf-dist/tex/latex/typeface/typeface.sty new file mode 100644 index 00000000000..3a4ae254d73 --- /dev/null +++ b/Master/texmf-dist/tex/latex/typeface/typeface.sty @@ -0,0 +1,5355 @@ +% $Id: typeface.sty 904 2012-06-16 13:32:38Z Geoffrey $ +% +% typeface.sty Copyright (C) 2012 Geoffrey Jones +% +% This package (typeface.sty and optional configuration file, typeface.cfg) +% simplifies setting up rmdefault, sfdefault, ttdefault, symbols and math type1 +% format (postscript) fonts. It is designed to allow users the widest latitude +% in mixing and matching whatever combination they might desire from these. +% +% Recommendations: +% 1. Compile with pdflatex or variants like lualatex for best results +% (although since fontspec is a mainstay in lua, you might prefer to +% stick with that package -- see lualatex-doc in your installation or +% from internet download). Some type1 fonts do not render properly in +% pdfxelatex compiled documents. Compiling to dvi rather +% than directly to pdf can prove an `interesting' idea. +% +% Requires: +% 1. Requires e-TeX. +% 2. Ensure that microtype is already loaded if (and only if) text figures +% substitute font letter spacing is desired (advanced usage). However, +% note that microtype generally doesn't partner well with bitmap fonts, +% especially if any scaling is involved. Should you select bitmap fonts +% (concrete, cmbright, etc.), microtype will very likely throw "auto +% expansion is only possible with scalable fonts" errors. Bottom line: +% either avoid bitmap fonts (for example, install hfbright to configure +% a type1 variant of cmbright), or avoid microtype. +% +% Restrictions: +% 1. This package is most suited to pdfLaTeX, and not particularly to +% other TeX formats where, in any event, it would be swimming against +% their particular tides. However, it has been demonstrated to work +% (depending on your definition of `work') in LuaTeX and in more +% restricted circumstances under XeTeX. If using XeTeX, the +% fontspec package would make far and away the better choice. +% +% Programming conventions: +% 1. All commands in this package begin with `\tf@', `\TF@', usw. As far +% as I know, of all the usual packages, classes, etc., only LaTeX's +% math text size macro (\tf@size) and table files (`\tf@EXT' where EXT +% is toc, lof, lot, etc) co-claim this namespace. +% 2. \TF@XXX is a constant (of sorts, since users can redefine many of these). +% 3. \TF@Xxx overrides standard mixed-case commands, e.g., \TF@PackageInfo +% wrappers \PackageInfo. +% 4. Many internal commands can be overridden by pre-defining them in the +% package configuration file (\TF@CONFIGFILE, usually `typeface.cfg'). +% 5. \tf@@xxx commands are, if not strictly local to a command, volatile +% across the scope of this package. +% +% 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 Original Author of this work is Geoffrey Jones. +% The Current Maintainer of this work is Geoffrey Jones. +% ============================================================================= +\NeedsTeXFormat{LaTeX2e}[2009/09/24] + +\newcommand*\TF@PACKAGENAME{typeface} +\newcommand*\TF@CONFIGFILE{\TF@PACKAGENAME.cfg} +\xdef\TF@CONFIGFILE{\TF@CONFIGFILE} + +\ProvidesPackage{\TF@PACKAGENAME} + [2012/06/11 (prerelease) Type1 font load management pkg (GJ)] + +\RequirePackage{ifetex} +\NeedsETeX + +\RequirePackage{etexcmds} % renames e-tex \unexpanded to \etex@unexpanded +\RequirePackage{etoolbox} % used extensively throughout this package +\RequirePackage{ifthenx} % ifthen package plus extensions + +\RequirePackage{iftex} % TODO: have we properly incorporated this? +\RequirePackage{ifpdf} + +% Package-wide constants +%----------------------- +% User-reconfigurable constants +\providecommand*\TF@AUXFILENAME{\jobname.tf} + +% Defaults used whenever the user either 1) does not explicitly define a +% typeface option or 2) explicitly specifies `default' (or whatever +% \TF@DEFAULT happens to be). Users can specify site specific defaults +% by including statements like: +% \renewcommand*\TF@DEFAULTRMFONT{kpfonts:veryoldstyle:light}, or +% \renewcommand*\TF@DEFAULTFONTENCODING{T5} +% in their configuration file \TF@CONFIGFILE. See the bundled configuration +% file for further examples. +\newcommand*\TF@DEFAULT{default} % this pair should almost +\newcommand*\TF@DEFAULTPRINTNAME{Default} % certainly never be redefined! + +\newcommand*\TF@DONTLOAD{dontload} % generally synonyms +\newcommand*\TF@IGNORE{ignore} + +\newcommand*\TF@DEFAULTRMFONT{\TF@DEFAULT} +\newcommand*\TF@DEFAULTSFFONT{\TF@DEFAULT} +\newcommand*\TF@DEFAULTTTFONT{\TF@DEFAULT} +\newcommand*\TF@DEFAULTMATHFONT{\TF@DEFAULT} +\newcommand*\TF@DEFAULTSYMBOLSFONT{\TF@DEFAULT} +\newcommand*\TF@DEFAULTTEXTFIGURESFONT{\TF@DEFAULT} + +\newcommand*\TF@DEFAULTFONTENCODING{T1} +\newcommand*\TF@DEFAULTINPUTENCODING{utf8} +\newcommand*\TF@DEFAULTTEXTCOMP{full} +\newcommand*\TF@DEFAULTCMAP{resetfonts} + +\newcommand*\TF@DEBUG@COLOUR@TS{purple} +\newcommand*\TF@DEBUG@COLOUR@SC{magenta} +\newcommand*\TF@DEBUG@COLOUR@JF{green} +\newcommand*\TF@DEBUG@COLOUR@XF{red} +\newcommand*\TF@DEBUG@COLOUR@LININGNUMS{olive} +\newcommand*\TF@DEBUG@COLOUR@RM{Indigo} +\newcommand*\TF@DEBUG@COLOUR@SF{Maroon} +\newcommand*\TF@DEBUG@COLOUR@TT{Green} +\newcommand*\TF@DEBUG@COLOUR@MATH{ProcessBlue} +\newcommand*\TF@DEBUG@COLOUR@XFNAME{\TF@DEBUG@COLOUR@XF} + +% Non-reconfigurable constants -- see after aux file load, +% below, for especially constant constants. + +% Package-wide variables and pre-initialised commands +%---------------------------------------------------- +% Global macros -- stubs created here, code populated further below +\newcommand*\tf@fontencodingchoices{} % package option choice lists are +\newcommand*\tf@inputencodingchoices{} % initially empty; they are configured +\newcommand*\tf@textcompchoices{} % below, or via configuration file +\newcommand*\tf@cmapchoices{} % \TF@CONFIGFILE +\newcommand*\tf@rmtypefacechoices{} +\newcommand*\tf@sftypefacechoices{} +\newcommand*\tf@tttypefacechoices{} +\newcommand*\tf@mathtypefacechoices{} +\newcommand*\tf@symbolstypefacechoices{} +\newcommand*\tf@textfigurestypefacechoices{} + +\newcommand*\tf@loadrmtypeface{} % created here, populated by +\newcommand*\tf@loadsftypeface{} % expansions of \newtypeface font +\newcommand*\tf@loadtttypeface{} % definitions below and in user +\newcommand*\tf@loadmathtypeface{} % customisation file \TF@CONFIGFILE +\newcommand*\tf@loadsymbolstypeface{} +\newcommand*\tf@loadtextfigurestypeface{} + +\newcommand*\tf@rmdefault{\rmdefault} +\newcommand*\tf@sfdefault{\sfdefault} +\newcommand*\tf@ttdefault{\ttdefault} + +\newcommand*\tf@rationalisefontnames{} % typeface aliases management command +\newcommand*\tf@empty@sfcnt@hook{} % empty font size function hook + +% Volatiles +\newcommand*\tf@@listseparator{} % for lists constructed on the fly + +% Helper commands (heaps of them) +% =============================== + +% Info messaging commands +%------------------------ +\newcommand*\TF@PackageInfo[2][\TF@PACKAGENAME]{% + \PackageInfo{#1}{#2}% +} + +\newcommand*\TF@PackageInfoNoLine[2][\TF@PACKAGENAME]{% + \PackageInfo{#1}{#2\@gobble}% +} + +\newcommand*\TF@PackageDebugInfo[2][\TF@PACKAGENAME]{% + \ifbool{tf@debug}{\TF@PackageInfo[#1]{#2}}{}% +} + +\newcommand*\TF@PackageDebugInfoNoLine[2][\TF@PACKAGENAME]{% + \ifbool{tf@debug}{\TF@PackageInfoNoLine[#1]{#2}}{}% +} + +\newcommand*\TF@PackageWarning[2][\TF@PACKAGENAME]{% + \PackageWarning{#1}{#2}% +} + +\newcommand*\TF@PackageWarningNoLine[2][\TF@PACKAGENAME]{% + \PackageWarningNoLine{#1}{#2}% +} + +\newcommand*\TF@PackageError[3][\TF@PACKAGENAME]{% + \PackageError{#1}{#2}{#3}% +} + +\newcommand*\TF@ChoiceOptionError[2]{% + \PackageError{\TF@PACKAGENAME}{Unexpected option `#1=#2' ignored}{}% +} + +% etoolbox command wrappers +%-------------------------- +\newcommand\tf@patchcmd[3]{ + \patchcmd{#1}{#2}{#3} + {\TF@PackageInfo{Patched \string #1}} + {\TF@PackageError{Failed to patch \string #1}{}} +} + +\newcommand*\tf@newbool[2]{\newbool{#1}\setbool{#1}{#2}} + +% globally undefine each command in a list of commands +\newcommand*\tf@undefinecommands[1]{\forcsvlist{\tf@undefinecommand}{#1}} +\newcommand*\tf@undefinecommand[1]{\global\undef{#1}} + +% \usepackage wrapper command for (and only for) loading font packages +% in \newtypeface commands (below and in extension file \TF@CONFIGFILE) +%---------------------------------------------------------------------- +\newcommand*\tf@usefontpackage[2][]{% + \@ifpackageloaded{#2}{ + % Note that we often pre-pass options to packages using + % \PassOptionsToPackage. Thus, we can't just test for + % empty options ([#1]==[]) and proceed if so. Given that, + % we stop in all cases of the target package already being + % loaded. + \TF@PackageWarningNoLine{% + Package `#2' is already loaded. You should\MessageBreak + probably sort this out before proceeding. Did\MessageBreak + you load `#2' before this package? Do you\MessageBreak + need to revise your `fontloadorder' suboptions?\MessageBreak + What would you like to do?} + }{ + \TF@PackageDebugInfo{\string\usepackage[#1]{#2}} + \usepackage[#1]{#2} + } +} + +% A few little throwaway helpers +%------------------------------- +% Discard all but the six leftmost characters of a string +\def\tf@strleftvi#1{% + \expandafter\tf@@strleftvi#1\@empty\@empty\@empty\@empty\@empty\@empty\@nil% +} +\def\tf@@strleftvi#1#2#3#4#5#6#7\@nil{#1#2#3#4#5#6} + +% Round up the provided floating point number and truncate to, at most, +% six characters (including minus sign and/or decimal point) +\def\tf@roundvi#1{% + \edef\tf@@temp{\strip@pt\dimexpr#1pt+0.00005pt\relax}% + \expandafter\tf@strleftvi\expandafter{\tf@@temp000000}% +} + +\def\tf@roundvi@pt#1{% + \edef\tf@@temp{\strip@pt\dimexpr#1+0.00005pt\relax}% + \expandafter\tf@strleftvi\expandafter{\tf@@temp000000}pt% +} + +% Colon-separated value list commands +%------------------------------------ +% Helper test: \tf@ifsuboption tests whether item #1 is a member of +% colon-separated list #2. #2 will generally be \tf@XXfontoptions, where +% XX is one of rm, sf, tt, math, symbols or textfigures. Example usage: +% \tf@ifsuboption{light}{\tf@sffontoptions}{<true part>}{<false part>} +% The list item immediately following #1 is saved in \tf@nextsuboption. +\tf@newbool{tf@suboptionfound}{false} +\newcommand*\tf@nextsuboption{} +\DeclareListParser{\tf@doColonSeparatedList}{:} % refer etoolbox package + +\newcommand*\tf@ifsuboption[2]{% + % #1 item name, #2 item list + % side effects: 1) sets boolean tf@suboptionfound, + % 2) sets \tf@nextsuboption to next suboption in #2 + \edef\tf@suboption{#1}% + \xdef\tf@nextsuboption{}% + \boolfalse{tf@suboptionfound}% + \renewcommand*\do[1]{% + \ifbool{tf@suboptionfound}% + {\xdef\tf@nextsuboption{##1}\listbreak}{}% + \ifthenelse{\equal{\tf@suboption}{##1}}% + {\booltrue{tf@suboptionfound}}{}% + }% + \expandafter\tf@doColonSeparatedList\expandafter{#2}% + \ifbool{tf@suboptionfound}% + {\expandafter\@firstoftwo}% + {\expandafter\@secondoftwo}% +} + +% Replace first #1 (to-be-replaced item) with #2 (new item) in #3 (item list) +% (Note, no parm safety checking or messaging on failure.) +\newcommand*\tf@replacesuboption[3]{% + \edef\tf@originallist{#3} + \patchcmd{#3}{#1}{#2}{% + \TF@PackageDebugInfo{Replaced item `\string#1' with item `\string#2' + in list [\tf@originallist]}% + }{}% +} + +% Count the number of times item appears in the colon-separated item list +\newcounter{tf@suboptioncount} +\newcommand*\tf@suboptioncount[2]{% + % #1 item name + % #2 item list + % side effect: sets counter tf@suboptioncount + \setcounter{tf@suboptioncount}{0}% + \renewcommand*\do[1]{% + \ifthenelse{\equal{#1}{##1}}{\stepcounter{tf@suboptioncount}}{}% + }% + \expandafter\tf@doColonSeparatedList\expandafter{#2}% +} + +% Count the number of non-empty items in the colon-separated item list +\newcommand*\tf@suboptionitemscount[1]{% + % #1 item list + % side effect: sets counter tf@suboptioncount + \setcounter{tf@suboptioncount}{0}% + \renewcommand*\do[1]{\stepcounter{tf@suboptioncount}}% + \expandafter\tf@doColonSeparatedList\expandafter{#1}% +} + +% Auxiliary file management +% ========================= +\newcommand*\tf@initialise@auxfile{% + \@ifundefined{tf@@auxfilehandle}{% + \newwrite\tf@@auxfilehandle% + \tf@newbool{tf@auxfileopen}{false}% + \ifbool{@filesw}{% + \TF@PackageDebugInfoNoLine{Opening auxiliary file \TF@AUXFILENAME..}% + \immediate\openout\tf@@auxfilehandle=\TF@AUXFILENAME% + \booltrue{tf@auxfileopen}% + }{% + \TF@PackageWarningNoLine{Auxiliary file output disabled,\MessageBreak + `\TF@AUXFILENAME' not written}% + }% + }{}% +} + +\newcommand*\tf@writeauxfile[1]{ + \AtBeginDocument{% + \ifbool{@filesw}{% + \tf@initialise@auxfile% + \TF@PackageDebugInfoNoLine{% + Writing `#1' to auxiliary file \TF@AUXFILENAME..}% + \@bsphack% + {\let\protect\string\immediate\write\tf@@auxfilehandle{#1}}% + \@esphack% + }{}% + } +} + +\tf@newbool{tf@auxfilechanged}{false} +\tf@newbool{tf@sffontdirty}{false} % set these two if we need second run +\tf@newbool{tf@ttfontdirty}{false} % to ensure they are accurately scaled +\newcommand*\tf@notifyauxfiledirty[1]{ + \ifthenelse{\equal{#1}{sf}}{\global\booltrue{tf@sffontdirty}}{} + \ifthenelse{\equal{#1}{tt}}{\global\booltrue{tf@ttfontdirty}}{} + \notbool{tf@auxfilechanged}{ + \global\booltrue{tf@auxfilechanged} + \ifbool{@filesw}{ + \TF@PackageWarningNoLine{% + Auxiliary file `\TF@AUXFILENAME' has changed.\MessageBreak + You need to recompile `\jobname.tex' again} + }{} + }{} +} + +\AtEndOfPackage{ + \AtBeginDocument{% + \ifbool{tf@auxfileopen}{% + \TF@PackageDebugInfoNoLine{Closing auxiliary file \TF@AUXFILENAME..}% + \immediate\closeout\tf@@auxfilehandle% + \boolfalse{tf@auxfileopen}% + }{}% + } +} + +% \newtypeface typeface definition command. This is this package's central +% customisation command. Users can use this command to a) extend the range of +% typeface package managed fonts or b) override the font definitions set out +% below. User font (re)definitions should be placed in customisation file +% \TF@CONFIGFILE (see example customisation file provided with this package). +% =========================================================================== +\newcommand\newtypeface[5][]{% + % #1: [<optional comma-separated list of aliases for typeface name>] + % #2: {<typeface name>} + % #3: {<typeface human-readable print name>} + % NB, #3 can be empty, in which case the user must explicitly define + % the font's print name macro (e.g., \tf@rmprintname) in the code in #5 + % #4: {<typeface family: rm, sf, tt, math, symbols or textfigures>} + % #5: {<typeface initialisation code>}, e.g., + % {\renewcommand*\rmdefault{ppl}} or {\tf@usefontpackage{helv}...} + % Note that, for better integration and debugging, users should load + % font packages using \tf@usefontpackage rather than \usepackage (however, + % continuing to use \usepackage for loading non-font packages outside + % \newtypeface definitions). + % + \ifthenelse{\equal{#4}{rm} + \OR\equal{#4}{sf} + \OR\equal{#4}{tt} + \OR\equal{#4}{math} + \OR\equal{#4}{symbols} + \OR\equal{#4}{textfigures}}{ + + \def\do{} % pre-initialised stub + \ifcsundef{tf@#4font@#2}{ + + % Add any (optional #1) fontname aliases to the list of valid typeface + % package choices. Also, build helper macro \tf@rationalisefontnames + % (invoked once, further below). + \renewcommand*\do[1]{ + \expandafter\g@addto@macro\csname tf@#4typefacechoices\endcsname{##1,} + \g@addto@macro\tf@rationalisefontnames{% + % fyi, \tf@#4font is created by \tf@parsefontname, defined way below + % e.g., \tf@rmfont is created by \tf@parsefontname{rm} + \ifthenelse{\equal{\csname tf@#4font\endcsname}{##1}}{ + \expandafter\def\csname tf@#4font\endcsname{#2} + }{} + } + } + \docsvlist{#1} % iterate \do over each typeface alias in #1 + + % Add #2 to the \tf@#4typefacechoices comma separated list + \expandafter\g@addto@macro\csname tf@#4typefacechoices\endcsname{#2,} + + % Add #2 to the \tf@load#4typeface command + \expandafter\g@addto@macro\csname tf@load#4typeface\endcsname{ + \ifthenelse{\equal{\csname tf@#4font\endcsname}{#2}} + {\csname tf@#4font@#2\endcsname} + {} + } + + % Construct \tf@#4font@#2, the font initialisation command + % invoked by \tf@load#4typeface, just defined above + \expandafter\providecommand\csname tf@#4font@#2\endcsname{#5} + + % Prepend some debug code to the macro + \expandafter\pretocmd\expandafter{\csname tf@#4font@#2\endcsname} + {\TF@PackageDebugInfo{Loading #4 typeface `#2'...}}{}{} + + % Prepend the font print name to the macro (so long as #3 the print + % name isn't empty, otherwise whatever code invokes \newtypeface + % will explicitly need to take care of this itself) + \ifthenelse{\NOT\equal{#3}{}}{ + \expandafter\pretocmd\expandafter{\csname tf@#4font@#2\endcsname} + {\expandafter\def\csname tf@#4printname\endcsname{#3}}{}{} + }{} + + % Restore \DeclareSizeFunction if we redefined it in + % \tf@initialisetextfiguresfont (defined below) + \ifthenelse{\equal{#4}{textfigures}}{ + \expandafter\apptocmd\expandafter{\csname tf@#4font@#2\endcsname}{ + \ifthenelse{\NOT\isundefined{\oldDeclareSizeFunction}} + {\let\DeclareSizeFunction\oldDeclareSizeFunction}{} + }{}{} + }{} + + % Record our package-managed \rmdefault, \sfdefault, \ttdefault + \expandafter\apptocmd\expandafter{\csname tf@#4font@#2\endcsname}{ + \xdef\tf@rmdefault{\rmdefault} + \xdef\tf@sfdefault{\sfdefault} + \xdef\tf@ttdefault{\ttdefault} + }{}{} + + % Have the macro register itself as and whenever it happens to be invoked + \expandafter\g@addto@macro\csname tf@#4font@#2\endcsname{% + \expandafter\def\csname tf@#4fontloadcommand\endcsname{tf@#4font@#2}% + } + + % Finally, ensure our macro is restricted to the document preamble + \expandafter\@onlypreamble\csname tf@#4font@#2\endcsname + }{ + % User has included their own definition for standard typeface #2 + % in the #4 family (or they included multiple definitions for one + % of their own typefaces) in their config file. + \TF@PackageDebugInfo{% + Encountered multiple definitions for `#2' in\MessageBreak + the `#4' family. This is OK, however note that the\MessageBreak + first definition takes precedence while subsequent\MessageBreak + definitions are ignored} + } + }{ + \TF@PackageError{user configuration error: second\MessageBreak + mandatory argument to \string\newtypeface\ should\MessageBreak + be one of [rm,sf,tt,math,symbols,textfigures]}{} + } +} + +% User typeface scale command -- useful in the body of the initialisation +% code passed to the \newtypeface command (see examples below) +\newcommand*\scaletypeface[2]{ + % #1: sf, tt or textfigures + % #2: any scaling code recognised by the font definition (.fd) file + \ifthenelse{\equal{\csname tf@#1scalemethod\endcsname}{\TF@FX@SCALE}}{ + #2 + \booltrue{tf@#1scaledatloadtime} + }{} +} + +% Load package configuration file \TF@CONFIGFILE. This file may contain +% 1) user-defined fonts specifications (\newtypeface commands), and +% 2) overrides of constants in the code block immediately above. +%---------------------------------------------------------------------- +\IfFileExists{\TF@CONFIGFILE}{ + \TF@PackageInfoNoLine{Loading configuration file `\TF@CONFIGFILE'...} + \input{\TF@CONFIGFILE} + \TF@PackageInfoNoLine{...completed loading configuration file + `\TF@CONFIGFILE'} +}{ + \TF@PackageInfoNoLine{% + User typeface definition file `\TF@CONFIGFILE'\MessageBreak + cannot be found (`\TF@CONFIGFILE' not loaded)} +} + +% Non-reconfigurable enums -- (re)defined after config file load +%--------------------------------------------------------------- +\newcommand*\TF@IMPLICITDEFAULT {0} % pkg option kv unspecified +\newcommand*\TF@EXPLICITDEFAULT {1} % pkg option kv explicitly = \TF@DEFAULT +\newcommand*\TF@EXPLICITOTHER {2} % pkg option kv explicitly = something else + +\newcommand*\TF@OSF@LF{0} % lining figures +\newcommand*\TF@OSF@NF{1} % native font -- do nothing +\newcommand*\TF@OSF@JF{2} % native OSF 'j' (or equiv) font family +\newcommand*\TF@OSF@XF{3} % substitute font +\newcommand*\TF@OSF@TS{4} % TS1 encoding +\newcommand*\TF@OSF@SC{5} % small caps + +\newcommand*\TF@UNSCALED{1} % unitary scaling factor -- must be 1, not 1.0 etc. + +\newcommand*\TF@ER@SCALE{0} % user error +\newcommand*\TF@NO@SCALE{1} % don't scale font; equiv, scale to \TF@UNSCALED +\newcommand*\TF@FX@SCALE{2} % scale font to fixed positive real number +\newcommand*\TF@EX@SCALE{3} % scale font to rm font ex height +\newcommand*\TF@LC@SCALE{4} % scale font to rm font lowercase letters height +\newcommand*\TF@UC@SCALE{5} % scale font to rm font uppercase letters height +\newcommand*\TF@FG@SCALE{6} % scale font to rm font figures height + +\newcommand*\TF@DEFAULTFONTLOADORDER{textfigures:symbols:math:rm:sf:tt} + +% Package options processing +% ========================== +\RequirePackage{xkeyval} + +% Roman (default body text) typeface selection. +% Save <string> in \tf@rmfontname, given user options: +% `typeface=<string>' or `rm=<string>' +%----------------------------------------------------- +\newcommand*\tf@rmfontname{\TF@DEFAULT} +\newcommand*\tf@rmfontdefaultstatus{\TF@IMPLICITDEFAULT} + +\newcommand*\tf@define@key@typeface{ + \define@key{TF}{typeface}[]{ + \renewcommand*\tf@rmfontname{##1} + \renewcommand*\tf@rmfontdefaultstatus{\TF@EXPLICITOTHER} + % only partially initialised here -- complete initialisation below + } +} +\tf@define@key@typeface + +% As above but using synonym `rm=' instead +\tf@patchcmd{\tf@define@key@typeface}{typeface}{rm} +\tf@define@key@typeface + +% Sans serif typeface selection +% Save <string> in \tf@sffontname, given user options: +% `sanstypeface=<string>' or `sf=<string>' +%----------------------------------------------------- +\newcommand*\tf@sffontname{\TF@DEFAULT} +\newcommand*\tf@sffontdefaultstatus{\TF@IMPLICITDEFAULT} + +\newcommand*\tf@define@key@sftypeface{ + \define@key{TF}{sanstypeface}[]{ + \renewcommand*\tf@sffontname{##1} + \renewcommand*\tf@sffontdefaultstatus{\TF@EXPLICITOTHER} + % only partially initialised here -- complete initialisation below + } +} +\tf@define@key@sftypeface + +% As above but using synonym `sf=' instead +\tf@patchcmd{\tf@define@key@sftypeface}{sanstypeface}{sf} +\tf@define@key@sftypeface + +% Monospaced (typewriter) typeface selection +% Save <string> in \tf@ttfontname, given user options: +% `monotypeface=<string>' or `tt=<string>' +%----------------------------------------------------- +\newcommand*\tf@ttfontname{\TF@DEFAULT} +\newcommand*\tf@ttfontdefaultstatus{\TF@IMPLICITDEFAULT} + +\newcommand*\tf@define@key@tttypeface{ + \define@key{TF}{monotypeface}[]{ + \renewcommand*\tf@ttfontname{##1} + \renewcommand*\tf@ttfontdefaultstatus{\TF@EXPLICITOTHER} + % only partially initialised here -- complete initialisation below + } +} +\tf@define@key@tttypeface + +% As above but using synonym `tt=' instead +\tf@patchcmd{\tf@define@key@tttypeface}{monotypeface}{tt} +\tf@define@key@tttypeface + +% Math typeface selection +% Save <string> in \tf@mathfontname, given user options: +% `mathtypeface=<string>' or `math=<string>' +%------------------------------------------------------- +\newcommand*\tf@mathfontname{\TF@DEFAULT} +\newcommand*\tf@mathfontdefaultstatus{\TF@IMPLICITDEFAULT} + +\newcommand*\tf@define@key@mathtypeface{ + \define@key{TF}{mathtypeface}[]{ + \renewcommand*\tf@mathfontname{##1} + \renewcommand*\tf@mathfontdefaultstatus{\TF@EXPLICITOTHER} + % only partially initialised here -- complete initialisation below + } +} +\tf@define@key@mathtypeface + +% As above but using synonym `math=' instead +\tf@patchcmd{\tf@define@key@mathtypeface}{mathtypeface}{math} +\tf@define@key@mathtypeface + +% Symbols typeface selection +% Save <string> in \tf@symbolsfontname, given user options: +% `symbolstypeface=<string>' or `sym=<string>' +%--------------------------------------------------------- +\newcommand*\tf@symbolsfontname{\TF@DEFAULT} +\newcommand*\tf@symbolsfontdefaultstatus{\TF@IMPLICITDEFAULT} + +\newcommand*\tf@define@key@symbolstypeface{ + \define@key{TF}{symbolstypeface}[]{ + \renewcommand*\tf@symbolsfontname{##1} + \renewcommand*\tf@symbolsfontdefaultstatus{\TF@EXPLICITOTHER} + % only partially initialised here -- complete initialisation below + } +} +\tf@define@key@symbolstypeface + +% As above but using synonym `sym=' instead +\tf@patchcmd{\tf@define@key@symbolstypeface}{symbolstypeface}{sym} +\tf@define@key@symbolstypeface + +% Text figures (aka old style figures, aka lowercase roman numerals). +% Depending on your body text typeface, you can choose to source text +% figures from its old style font or from one of a limited number of +% entirely different substitute typefaces. +%-------------------------------------------------------------------- +\newcommand*\tf@textfiguresfontname{\TF@DEFAULT} +\newcommand*\tf@textfiguresfontdefaultstatus{\TF@IMPLICITDEFAULT} + +\newcommand*\tf@define@key@textfigurestypeface{ + \define@key{TF}{textfigures}[]{ + \renewcommand*\tf@textfiguresfontname{##1} + \renewcommand*\tf@textfiguresfontdefaultstatus{\TF@EXPLICITOTHER} + % only partially initialised here -- complete initialisation below + } +} +\tf@define@key@textfigurestypeface + +% Font encodings. Note that fontenc is one of only a rare number of +% packages that can be loaded multiple times. +% +% Typeface package option `fontencoding=<encs>' where <encs> is: +% 1) <empty>, in which case typeface will load the fontenc package +% with option \TF@DEFAULTFONTENCODING (as defined above or redefined in +% \TF@CONFIGFILE). This value is implied if the user does not explicitly +% set the this package's `fontencoding' option. +% 2) `ignore' or `dontload' (or whatever the values of `\TF@IGNORE' or +% `\TF@DONTLOAD' happen to be). In which case typeface does not load +% fontenc. +% 3) a colon-separated list of items drawn from comma-separated list +% \tf@fontencodingchoices (reader, are you listening up? <encs> is, like +% all all other multi-valued package options that can be passed to this +% package, colon-separated; \tf@fontencodingchoices is an internally +% coded list, thus comma-separated). The allowable set of <encs> choices, +% \tf@fontencodingchoices, is initialised below with possible additions +% in defined in \TF@CONFIGFILE. Font encoding choice items are passed to +% fontenc in the order that they appear in <encs>. +% Special value `default' (or whatever the value of \TF@DEFAULT happens +% to be), gets translated in the process to \TF@DEFAULTFONTENCODING +% (defined above or in \TF@CONFIGFILE). +% Note that the ***last*** (or most recently processed) item passed to +% fontenc becomes the current default font encoding. So, e.g., T1 is +% assigned to \encodingdefault when typeface is passed option +% `fontencoding=LGR:T1'. +% +% NB, the cause of LaTeX compiler error: +% LaTeX Error: Unknown option `YYY' for package `typeface' +% is forgetting that multi-valued package options (suboptions) are +% colon, NOT comma, separated. Instead of writing package option +% ...,fontencoding=XXX,YYY,... +% the user should instead have written +% ...,fontencoding=XXX:YYY,... +%---------------------------------------------------------------------------- +\newcommand*\tf@fontencodingstring{} +\newcommand*\tf@fontencodingdefaultstatus{} + +\define@key{TF}{fontencoding}[]{ + \renewcommand*\tf@fontencodingstring{#1} + % only partially initialised here -- complete initialisation below +} + +% List of common font encodings drawn from around the place, e.g., +% from `encguide.pdf'. You can add your own options to this list +% by including: +% \renewcommand\tf@fontencodingchoices{<choice,...>} +% in configuration file \TF@CONFIGFILE. It won't hurt if you repeat +% any choices here. +\g@addto@macro\tf@fontencodingchoices{,% + \TF@DEFAULT,% + EU1,EU2,L7X,LAE,LFE,LGR,LHE,LM1,LV1,LY1,% + OML,OMS,OMX,OT1,OT2,OT4,OT6,% + T1,T2A,T2B,T2C,T3,T4,T5,T6,T7,% + TS1,TS2,TS3,U,X1,X2,% +} + +% Inputenc package options -- see comments with fontencoding +%----------------------------------------------------------- +\newcommand*\tf@inputencodingstring{} +\newcommand*\tf@inputencodingdefaultstatus{} + +\define@key{TF}{inputencoding}[]{ + \renewcommand*\tf@inputencodingstring{#1} + % only partially initialised here -- complete initialisation below +} + +\g@addto@macro\tf@inputencodingchoices{,% + \TF@DEFAULT,% + ascii,latin1,latin2,latin3,latin4,latin5,latin9,latin10,% + decmulti,applemac,macce,next,cp850,cp852,cp858,cp437,% + cp437de,cp865,cp1250,cp1252,cp1257,ansinew,utf8,utf8x,% +} + +% Textcomp package options -- see comments with fontencoding +%----------------------------------------------------------- +\newcommand*\tf@textcompstring{} +\newcommand*\tf@textcompdefaultstatus{} + +\define@key{TF}{textcomp}[]{ + \renewcommand*\tf@textcompstring{#1} + % only partially initialised here -- complete initialisation below +} + +\g@addto@macro\tf@textcompchoices{,% + \TF@DEFAULT,safe,euro,full,almostfull,warn,force,% +} + +% Cmap package options -- see comments with fontencoding +%------------------------------------------------------- +\newcommand*\tf@cmapstring{} +\newcommand*\tf@cmapdefaultstatus{} + +\define@key{TF}{cmap}[]{ + \renewcommand*\tf@cmapstring{#1} + % only partially initialised here -- complete initialisation below +} + +\g@addto@macro\tf@cmapchoices{,% + \TF@DEFAULT,resetfonts,noresetfonts,% +} + +% Font load order. Default font load order is: +% textfigures -> symbols -> math -> rm -> sf -> tt +% (or as specified in \TF@DEFAULTFONTLOADORDER, above) +% +% 1. package option loadorder allows users to indicate (albeit strongly +% indicate) their preferred font load order. We do our best to honour +% the user's preference, but may occasionally choose to disregard it. +% 2. users should do their best to avoid using this option lest doing so +% lead to brittle code (seemingly innocuous changes to document code +% leading to unexpected problems). However, this option might prove +% useful, especially in cases where math/symbols load ordering can +% strongly affect results. +%----------------------------------------------------------------------- +\newcommand*\tf@fontloadorder{\TF@DEFAULTFONTLOADORDER} +\tf@newbool{tf@fontloadorderimplicit}{true} + +\define@key{TF}{fontloadorder}[\TF@DEFAULTFONTLOADORDER]{ + \renewcommand*\tf@fontloadorder{#1} + \boolfalse{tf@fontloadorderimplicit} +} + +% Output extra info in log files and coloured text when debugging +%---------------------------------------------------------------- +\tf@newbool{tf@debug}{false} +\tf@newbool{tf@debugimplicit}{true} + +\define@choicekey+{TF}{debug}[]{true,false}[true] + {\setbool{tf@debug}{#1}\boolfalse{tf@debugimplicit}} + {\TF@ChoiceOptionError{debug}{#1}} + +% Enabling print info commands will pull in packages we generally don't use +%-------------------------------------------------------------------------- +\tf@newbool{tf@printinfo}{false} +\tf@newbool{tf@printinfoimplicit}{true} + +\define@choicekey+{TF}{printinfo}[]{true,false}[true] + {\setbool{tf@printinfo}{#1}\boolfalse{tf@printinfoimplicit}} + {\TF@ChoiceOptionError{printinfo}{#1}} + +% Finished declaring package options -- process them +%--------------------------------------------------- +\TF@PackageDebugInfo{Processing package options...} +\ProcessOptionsX<TF>\relax + +% Set default options; reset or complain about those that don't make sense +% ======================================================================== +\TF@PackageDebugInfo{Reconfiguring and error-checking user options...} + +% Package options validation -- typeface/rm, sanstypeface/sf, monotypeface/tt, +% mathtypeface/math, symbolstypeface/sym, textfigures +\newcommand*\tf@reconfigurefontoption[1]{ + % Set font defaults if a) user did not explicitly specify a desired font + % or b) explicitly specified `default' (or whatever \TF@DEFAULT is defined + % to be) instead. + % #1 is rm, sf, tt, math, symbols or textfigures + \ifthenelse{\equal{\csname tf@#1fontname\endcsname}{}}{ + \expandafter\xdef\csname tf@#1fontname\endcsname{\TF@DEFAULT} + \expandafter\xdef\csname tf@#1fontdefaultstatus\endcsname + {\TF@IMPLICITDEFAULT} + }{} + + \ifthenelse{\equal{\csname tf@#1fontname\endcsname}{\TF@DEFAULT} + \AND\equal{\csname tf@#1fontdefaultstatus\endcsname}{\TF@EXPLICITOTHER}}{ + \expandafter\xdef\csname tf@#1fontdefaultstatus\endcsname + {\TF@EXPLICITDEFAULT} + }{} + + \ifthenelse{\equal{\csname tf@#1fontname\endcsname}{\TF@DEFAULT}}{ + \MakeUppercase{\xdef\noexpand\tf@@tmp{TF@DEFAULT#1FONT}} + \expandafter\xdef\csname tf@#1fontname\endcsname + {\csname\tf@@tmp\endcsname} + }{} +} +\forcsvlist{\tf@reconfigurefontoption}{rm,sf,tt,math,symbols,textfigures} + +% Shared fontencoding, inputencoding, textcomp, cmap options validation +% routine. Apologies for the jabberwocky code -- it was this or repeat +% the entire block several times. +\newcommand*\tf@@pkgoptionsvalidation[1]{ + % #1: fontencoding, inputencoding, textcomp or cmap + \expandafter\def\csname tf@#1\endcsname{} + \edef\tf@@optionstring{\csname tf@#1string\endcsname} + \MakeUppercase{\xdef\noexpand\tf@@tmp{TF@DEFAULT#1}} + \xdef\TF@@DEFAULTOPTION{\csname\tf@@tmp\endcsname} + + % Set (preliminary) defaultstatus depending on what the user specified + \ifthenelse{\equal{\tf@@optionstring}{}}{ + \expandafter\def\csname tf@#1defaultstatus\endcsname{\TF@IMPLICITDEFAULT} + }{ + \ifthenelse{\equal{\tf@@optionstring}{\TF@DEFAULT}} + {\expandafter\def\csname tf@#1defaultstatus\endcsname{\TF@EXPLICITDEFAULT}} + {\expandafter\def\csname tf@#1defaultstatus\endcsname{\TF@EXPLICITOTHER}} + } + + % Ensure each suboption in option string matches an item + % in the relevant options choices list + \tf@newbool{tf@#1match}{false} + \tf@newbool{tf@#1dontload}{false} + \newcounter{tf@#1suboptionscount} + \setcounter{tf@#1suboptionscount}{0} + \renewcommand*\tf@@listseparator{} + + \def\tf@@innerdo##1{ + \boolfalse{tf@#1match} + \ifthenelse{\equal{##1}{\tf@@option}} + {\booltrue{tf@#1match}\listbreak}{} + } + + \def\do##1{ + \ifthenelse{\equal{##1}{\TF@DONTLOAD}\OR\equal{##1}{\TF@IGNORE}}{ + \booltrue{tf@#1dontload} + \expandafter\def\csname tf@#1\endcsname{\TF@DONTLOAD} + }{ + \xdef\tf@@option{##1} + \xdef\tf@@options{\csname tf@#1choices\endcsname} + \expandafter\forcsvlist\expandafter\tf@@innerdo\expandafter{\tf@@options} + \ifbool{tf@#1match}{ + \ifthenelse{\equal{##1}{\TF@DEFAULT}}{ + % translate user suboption \TF@DEFAULT (usually `default') + % to appropriate value, setting default status accordingly + \expandafter\xdef\csname tf@#1\endcsname{% + \csname tf@#1\endcsname\tf@@listseparator\TF@@DEFAULTOPTION} + \expandafter\xdef\csname tf@#1primary\endcsname + {\TF@@DEFAULTOPTION}% fontenc only + \expandafter\xdef\csname tf@#1defaultstatus\endcsname + {\TF@EXPLICITDEFAULT} + }{ + \expandafter\xdef\csname tf@#1\endcsname{% + \csname tf@#1\endcsname\tf@@listseparator##1} + \expandafter\xdef\csname tf@#1primary\endcsname{##1}% fontenc only + \expandafter\xdef\csname tf@#1defaultstatus\endcsname + {\TF@EXPLICITOTHER} + } + \renewcommand*\tf@@listseparator{,} + }{ + \TF@PackageError{% + Suboption `##1' in `#1=\tf@@optionstring'\MessageBreak + is not valid. Setting `#1=\TF@@DEFAULTOPTION'}{} + \expandafter\xdef\csname tf@#1string\endcsname{} + \listbreak + } + } + \stepcounter{tf@#1suboptionscount} + } + \expandafter\tf@doColonSeparatedList\expandafter{\tf@@optionstring} + + \ifthenelse{\value{tf@#1suboptionscount} > 1}{ + \expandafter\xdef\csname tf@#1defaultstatus\endcsname{\TF@EXPLICITOTHER} + }{} + + % Option-specific error handling + \ifthenelse{\equal{#1}{fontencoding}}{ + \ifthenelse{\boolean{tf@fontencodingdontload} + \AND\value{tf@fontencodingsuboptionscount} > 1}{ + \TF@PackageError{% + #1 suboptions `\TF@DONTLOAD' and `\TF@IGNORE'\MessageBreak + do not mix with other suboptions. Package option\MessageBreak + `#1=\tf@@optionstring' is not valid.\MessageBreak + Setting `#1=\TF@@DEFAULTOPTION'}{} + \expandafter\xdef\csname tf@#1string\endcsname{} + }{} + }{% inputencoding, textcomp and cmap options + \ifthenelse{\value{tf@#1suboptionscount} > 1}{ + \TF@PackageError{% + Package option `#1=\tf@@optionstring' is\MessageBreak + not valid. `#1' does not accept multiple\MessageBreak + suboptions. Setting `#1=\TF@@DEFAULTOPTION'}{} + \expandafter\xdef\csname tf@#1string\endcsname{} + }{} + } + + \edef\tf@@optionstring{\csname tf@#1string\endcsname} + \ifthenelse{\equal{\tf@@optionstring}{}}{ + \expandafter\xdef\csname tf@#1\endcsname{\TF@@DEFAULTOPTION} + \expandafter\xdef\csname tf@#1primary\endcsname{\TF@@DEFAULTOPTION} + }{} +} +\forcsvlist{\tf@@pkgoptionsvalidation}{fontencoding,inputencoding,textcomp,cmap} + +% Package options validation -- fontloadorder +\xdef\tf@fontloadorder{\tf@fontloadorder:} % <-- insert guard + \tf@ifsuboption{textfigures}{\tf@fontloadorder}{\relax} + {\tf@replacesuboption{textfigure}{textfigures}{\tf@fontloadorder}} + \tf@ifsuboption{symbols}{\tf@fontloadorder}{\relax} + {\tf@replacesuboption{symbol}{symbols}{\tf@fontloadorder}} + \tf@replacesuboption{maths}{math}{\tf@fontloadorder} + \tf@replacesuboption{roman}{rm}{\tf@fontloadorder} + \tf@replacesuboption{sans}{sf}{\tf@fontloadorder} + \tf@replacesuboption{mono}{tt}{\tf@fontloadorder} + \tf@replacesuboption{teletype}{tt}{\tf@fontloadorder} +\def\tf@stripguard#1:\@empty#2\relax{#1} % <-- strip guard +\xdef\tf@fontloadorder{\expandafter% + \tf@stripguard\tf@fontloadorder\@empty\relax} + +\ifthenelse{\equal{\tf@fontloadorder}{\TF@DEFAULT}} + {\xdef\tf@fontloadorder{\TF@DEFAULTFONTLOADORDER}}{} % NB, not \newcommand + +% Check whether the font load order list is under or over complete +\newcommand*\tf@fontloadordercomplete[1]{ + \tf@ifsuboption{#1}{\tf@fontloadorder}{ + \tf@suboptioncount{#1}{\tf@fontloadorder} + \ifthenelse{\thetf@suboptioncount > 1}{ + \TF@PackageError{Suboption `#1' appears more than once in\MessageBreak + `fontloadorder=\tf@fontloadorder'.\MessageBreak + Setting `fontloadorder=\TF@DEFAULT'}{} + \xdef\tf@fontloadorder{\TF@DEFAULTFONTLOADORDER} % NB, not \newcommand! + }{} + }{ + \TF@PackageError{Suboption `#1' missing in package option\MessageBreak + `fontloadorder=\tf@fontloadorder'.\MessageBreak + Setting `fontloadorder=\TF@DEFAULT'}{} + \xdef\tf@fontloadorder{\TF@DEFAULTFONTLOADORDER} % NB, not \newcommand! + } +} +\forcsvlist{\tf@fontloadordercomplete}{rm,sf,tt,math,symbols,textfigures} + +% check for typos, weird entries in the font order list +\renewcommand*\do[1]{ % see etoolbox package docs + \ifthenelse{\NOT\equal{#1}{textfigures} + \AND\NOT\equal{#1}{symbols} + \AND\NOT\equal{#1}{math} + \AND\NOT\equal{#1}{rm} + \AND\NOT\equal{#1}{sf} + \AND\NOT\equal{#1}{tt}}{ + \TF@PackageError{Unexpected suboption `#1' in package option\MessageBreak + `fontloadorder=\tf@fontloadorder'.\MessageBreak + Setting `fontloadorder=\TF@DEFAULT'}{} + }{} +} +\expandafter\tf@doColonSeparatedList\expandafter{\tf@fontloadorder} + +% Package options validation -- cmap +% -- cmap accepts a faux option which, after validation, we can now remove +\tf@replacesuboption{noresetfonts}{}{\tf@cmap} + +% Load and process auxiliary file +% =============================== + +% Ensure our auxiliary parameters have not been pre-defined... +\tf@undefinecommands{ + \tf@aux@fontencoding, + \tf@aux@inputencoding, + \tf@aux@textcomp, + \tf@aux@cmap, + \tf@aux@rmfontname, + \tf@aux@sffontname, + \tf@aux@ttfontname, + \tf@aux@mathfontname, + \tf@aux@symbolsfontname, + \tf@aux@textfiguresfontname, + \tf@aux@sfscalefactor, + \tf@aux@ttscalefactor, + \tf@aux@mathscalefactor, + \tf@aux@textfiguresscalefactor, + \tf@aux@textfiguresspacing, +} + +% ... read them from our aux file if defined there ... +\InputIfFileExists{\TF@AUXFILENAME} + {\TF@PackageDebugInfo{Loading auxiliary file `\TF@AUXFILENAME'...}} + {\TF@PackageDebugInfo{Could not locate auxiliary file `\TF@AUXFILENAME'}} + +% ... or define them safely if they are not +\providecommand*\tf@aux@fontencoding{} +\providecommand*\tf@aux@inputencoding{} +\providecommand*\tf@aux@textcomp{} +\providecommand*\tf@aux@cmap{} + +\providecommand*\tf@aux@rmfontname{} +\providecommand*\tf@aux@sffontname{} +\providecommand*\tf@aux@ttfontname{} +\providecommand*\tf@aux@mathfontname{} +\providecommand*\tf@aux@symbolsfontname{} +\providecommand*\tf@aux@textfiguresfontname{} + +\providecommand*\tf@aux@sfscalefactor{} +\providecommand*\tf@aux@ttscalefactor{} +\providecommand*\tf@aux@mathscalefactor{} +\providecommand*\tf@aux@textfiguresscalefactor{} +\providecommand*\tf@aux@textfiguresspacing{} + +%--- Begin rebuilding the aux file anew --------------------------------------- +\tf@writeauxfile{\string\relax} % reset aux file contents +\tf@writeauxfile{\string\ProvidesFile{\TF@AUXFILENAME}[<\TF@PACKAGENAME package auxiliary file>]} +\tf@writeauxfile{\string\newcommand*\string\tf@aux@fontencoding{\tf@fontencoding}} +\tf@writeauxfile{\string\newcommand*\string\tf@aux@inputencoding{\tf@inputencoding}} +\tf@writeauxfile{\string\newcommand*\string\tf@aux@textcomp{\tf@textcomp}} +\tf@writeauxfile{\string\newcommand*\string\tf@aux@cmap{\tf@cmap}} +\tf@writeauxfile{\string\newcommand*\string\tf@aux@rmfontname{\tf@rmfontname}} +\tf@writeauxfile{\string\newcommand*\string\tf@aux@sffontname{\tf@sffontname}} +\tf@writeauxfile{\string\newcommand*\string\tf@aux@ttfontname{\tf@ttfontname}} +\tf@writeauxfile{\string\newcommand*\string\tf@aux@mathfontname{\tf@mathfontname}} +\tf@writeauxfile{\string\newcommand*\string\tf@aux@symbolsfontname{\tf@symbolsfontname}} +\tf@writeauxfile{\string\newcommand*\string\tf@aux@textfiguresfontname{\tf@textfiguresfontname}} +%------------------------------------------------------------------------------ + +% Shared typeface loading commands +% ================================ +\TF@PackageDebugInfo{Configuring shared typeface load commands...} + +% Some fonts may be called on by multiple typeface loading commands. In +% these cases, common code is factored out to assist font load management +% and to reduce code duplication. + +%------------------------------------------------------------------------------ +% NB, because they contain shared/refactored code, many (if not most) of +% these commands ignore user-specified changes in fontloadorder. +%------------------------------------------------------------------------------ + +% Adobe Minion Pro -- shared code +%-------------------------------- +\newcommand*\tf@mp@printname{Adobe Minion Pro} +\tf@newbool{tf@mp@implicitmathnums}{true} + +% Minion Pro load helper command +\newcommand*\tf@mp@processoptions[1]{ + % #1 is either \tf@rmfontoptions or \tf@mathfontoptions + \tf@ifsuboption{smallfamily}{#1} + {\PassOptionsToPackage{smallfamily}{MinionPro}}{} + \tf@ifsuboption{medfamily}{#1} + {\PassOptionsToPackage{medfamily}{MinionPro}}{} + \tf@ifsuboption{fullfamily}{#1} + {\PassOptionsToPackage{fullfamily}{MinionPro}}{} + \tf@ifsuboption{noopticals}{#1} + {\PassOptionsToPackage{noopticals}{MinionPro}}{} + \tf@ifsuboption{opticals}{#1} + {\PassOptionsToPackage{opticals}{MinionPro}}{} + \tf@ifsuboption{slides}{#1} + {\PassOptionsToPackage{slides}{MinionPro}}{} + \tf@ifsuboption{normalsize}{#1} + {\PassOptionsToPackage{normalsize}{MinionPro}}{} + \tf@ifsuboption{nonormalsize}{#1} + {\PassOptionsToPackage{nonormalsize}{MinionPro}}{} + + \ifthenelse{\equal{\tf@mathfont}{adobeminionpro}}{ + \def\tf@@configurempoptions##1{ + \tf@ifsuboption{##1}{\tf@mathfontoptions}{ + \PassOptionsToPackage{mathlf}{MinionPro} + \boolfalse{tf@mp@implicitmathnums} + }{} + } + \forcsvlist{\tf@@configurempoptions} + {lf,lsf,lining,liningstyle,liningstylefigures,mathlf} + + \def\tf@@configurempoptions##1{ + \tf@ifsuboption{##1}{\tf@mathfontoptions}{ + \PassOptionsToPackage{mathosf}{MinionPro} + \boolfalse{tf@mp@implicitmathnums} + }{} + } + \forcsvlist{\tf@@configurempoptions} + {osf,oldstyle,oldfigures,oldstylefigures,mathosf} + }{} + % unlike math where we allow many lf/osf aliases for configuring + % math figures, we only allow `mathlf' or `mathosf' in rm + % options to configure math figures + \ifthenelse{\equal{\tf@rmfont}{adobeminionpro}}{ + \tf@ifsuboption{mathlf}{\tf@rmfontoptions}{ + \PassOptionsToPackage{mathlf}{MinionPro} + \boolfalse{tf@mp@implicitmathnums}}{} + \tf@ifsuboption{mathosf}{\tf@rmfontoptions}{ + \PassOptionsToPackage{mathosf}{MinionPro} + \boolfalse{tf@mp@implicitmathnums}}{} + }{} + \ifbool{tf@mp@implicitmathnums}{ + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@LF}} + {\PassOptionsToPackage{mathlf}{MinionPro}} + {\PassOptionsToPackage{mathosf}{MinionPro}} + }{} + + \tf@ifsuboption{mathtabular}{#1} + {\PassOptionsToPackage{mathtabular}{MinionPro}}{} + \tf@ifsuboption{mnsy}{#1} + {\PassOptionsToPackage{mnsy}{MinionPro}}{} + \tf@ifsuboption{cmsy}{#1} + {\PassOptionsToPackage{cmsy}{MinionPro}}{} + \tf@ifsuboption{swash}{#1} + {\PassOptionsToPackage{swash}{MinionPro}}{} + \tf@ifsuboption{abx}{#1} + {\PassOptionsToPackage{abx}{MinionPro}}{} + \tf@ifsuboption{amsbb}{#1} + {\PassOptionsToPackage{amsbb}{MinionPro}}{} + \tf@ifsuboption{fourierbb}{#1} + {\PassOptionsToPackage{fourierbb}{MinionPro}}{} + \tf@ifsuboption{lucidabb}{#1} + {\PassOptionsToPackage{lucidabb}{MinionPro}}{} + \tf@ifsuboption{mixedgreek}{#1} + {\PassOptionsToPackage{mixedgreek}{MinionPro}}{} + \tf@ifsuboption{italicgreek}{#1} + {\PassOptionsToPackage{italicgreek}{MinionPro}}{} + \tf@ifsuboption{frenchmath}{#1} + {\PassOptionsToPackage{frenchmath}{MinionPro}}{} + \tf@ifsuboption{minionint}{#1} + {\PassOptionsToPackage{minionint}{MinionPro}}{} + \tf@ifsuboption{openg}{#1} + {\PassOptionsToPackage{openg}{MinionPro}}{} + \tf@ifsuboption{loosequotes}{#1} + {\PassOptionsToPackage{loosequotes}{MinionPro}}{} + \tf@ifsuboption{footnotefigures}{#1} + {\PassOptionsToPackage{footnotefigures}{MinionPro}}{} +} + +\newcommand*\tf@loadadobeminionpro{ + \providebool{tf@adobeminionproloaded} + \ifbool{tf@adobeminionproloaded}{\relax}{ + \booltrue{tf@adobeminionproloaded} + \ifthenelse{\equal{\tf@rmfont}{adobeminionpro}}{ + \tf@mp@processoptions{\tf@rmfontoptions} + \ifthenelse{\equal{\tf@mathfont}{adobeminionpro} + \OR\equal{\tf@mathfont}{\TF@DEFAULT}}{ + \renewcommand*\tf@mathprintname{\tf@mp@printname} + }{ + \PassOptionsToPackage{onlytext}{MinionPro} + } + \renewcommand*\tf@rmprintname{\tf@mp@printname} + }{} + + \ifthenelse{\equal{\tf@mathfont}{adobeminionpro}}{ + \tf@mp@processoptions{\tf@mathfontoptions} + \ifthenelse{\equal{\tf@rmfont}{adobeminionpro} + \OR\equal{\tf@rmfont}{\TF@DEFAULT}}{ + \renewcommand*\tf@rmprintname{\tf@mp@printname} + }{ + \PassOptionsToPackage{onlymath}{MinionPro} + } + \renewcommand*\tf@mathprintname{\tf@mp@printname} + \renewcommand*\tf@symbolsprintname{MnSymbol} + }{} + + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@LF}}{ + \PassOptionsToPackage{textlf}{MinionPro} + }{ + \PassOptionsToPackage{textosf}{MinionPro} + \renewenvironment{liningnums}{% + \ifbool{tf@debug}{% + \color{\TF@DEBUG@COLOUR@LININGNUMS}% + }{}% + \booltrue{tf@liningnums}% + \figureversion{lining}% % Adobe Minion Pro specific command + }{% + \boolfalse{tf@liningnums}% these lines are unnecessary, + \figureversion{text}% % but let's be explicit anyway + } + } + + \let\oldoldstylenums\oldstylenums % before MinionPro hijacks this + \tf@usefontpackage{MinionPro} + \ifthenelse{\NOT\equal{\tf@rmprintname}{\tf@mp@printname}}{ + % restore the hijacking if rm font is neither adobeminionpro nor default + \let\oldstylenums\oldoldstylenums + }{} + % Sidestep a pesky message from fontaxes, a package loaded by MinionPro. + % This message is generated whenever fontaxes tries to manage fonts that + % don't provide all the features that it requires -- in general, almost + % any font. In these cases, fontaxes will complain (a lot) that "I don't + % know how to decode family `X' on input line...", where (in our case) X + % is either \rmdefault (resp. \sfdefault, \ttdefault) or \tf@substosffont, + % our text figures substitute font. Note that the name of the fontaxes + % warning command depends on whether fontaxes has been installed via + % MinionPro package installation (\fa@warn@undecodable) or via a more + % recent fontaxes package update (\fontaxes@warn@undecodable). + \@ifpackageloaded{fontaxes}{ + \ifdef{\fa@warn@undecodable}{ + \renewcommand*\fa@warn@undecodable[1]{} + \TF@PackageInfoNoLine{Silenced fontaxes command % + \string\fa@warn@undecodable} + }{} + \ifdef{\fontaxes@warn@undecodable}{ + \renewcommand*\fontaxes@warn@undecodable[1]{} + \TF@PackageInfoNoLine{Silenced fontaxes command % + \string\fontaxes@warn@undecodable} + }{} + }{} + } +} + +% Antykwa Torunska -- shared code +%-------------------------------- +\newcommand*\tf@at@processoptions[1]{ + % #1 is either \tf@rmfontoptions or \tf@mathfontoptions + \tf@ifsuboption{mathnoalias}{#1}{ + \PassOptionsToPackage{mathnoalias}{anttor}}{} + \tf@ifsuboption{light}{#1}{ + \PassOptionsToPackage{light}{anttor} + \booltrue{tf@at@light}}{} + \tf@ifsuboption{condensed}{#1}{ + \PassOptionsToPackage{condensed}{anttor} + \booltrue{tf@at@condensed}}{} +} + +\newcommand*\tf@loadantykwatorunska{ + \providebool{tf@antykwatorunskaloaded} + \ifbool{tf@antykwatorunskaloaded}{\relax}{ + \booltrue{tf@antykwatorunskaloaded} + \newcommand*\tf@at@printname{Antykwa Toru\'nska} + \tf@newbool{tf@at@light}{false} + \tf@newbool{tf@at@condensed}{false} + + \ifthenelse{\equal{\tf@rmfont}{antykwatorunska} + \OR\equal{\tf@rmfont}{\TF@DEFAULT}}{ + \tf@at@processoptions{\tf@rmfontoptions} + \renewcommand*\tf@rmprintname{\tf@at@printname} + \renewcommand\oldstylenums[1]{{\scshape ##1}} + \tf@SCencodedosf + }{} + \ifthenelse{\equal{\tf@mathfont}{antykwatorunska} + \OR\equal{\tf@mathfont}{\TF@DEFAULT}}{ + \tf@at@processoptions{\tf@mathfontoptions} + \PassOptionsToPackage{math}{anttor} + \renewcommand*\tf@mathprintname{\tf@at@printname} + }{} + + \tf@usefontpackage{anttor} + + \newcommand*\tf@at@subprintname{} + \ifbool{tf@at@light} + {\edef\tf@at@subprintname{\tf@at@subprintname\space Light}}{} + \ifbool{tf@at@condensed} + {\edef\tf@at@subprintname{\tf@at@subprintname\space Condensed}}{} + \ifthenelse{\equal{\tf@rmprintname}{\tf@at@printname}} + {\xdef\tf@rmprintname{\tf@rmprintname\tf@at@subprintname}}{} + \ifthenelse{\equal{\tf@mathprintname}{\tf@at@printname}} + {\xdef\tf@mathprintname{\tf@mathprintname\tf@at@subprintname}}{} + } +} + +% CM Bright -- shared code +%------------------------- +% CM Bright is a raster rather than an outline (scalable) font unless the +% hfbright remappings of cmbright have been installed at the user's site. +\newcommand*\tf@loadcmbright{ + % Load math/rm/sf/tt CM Bright as applicable, additionally loading + % rm/sf/tt (but not math) if any of these happen to be default + \providebool{tf@cmbrightloaded} + \ifbool{tf@cmbrightloaded}{\relax}{ + \booltrue{tf@cmbrightloaded} + \ifthenelse{\equal{\tf@mathfont}{cmbright}}{ + \tf@ifsuboption{slantedGreek}{\tf@mathfontoptions}{ + \PassOptionsToPackage{slantedGreek}{cmbright}}{} + \tf@ifsuboption{standard-baselineskips}{\tf@mathfontoptions}{ + \PassOptionsToPackage{standard-baselineskips}{cmbright}}{} + \tf@usefontpackage{cmbright} + \tf@mathfont@cmbright % housekeeping, e.g., sets math print name + }{} + \ifthenelse{\equal{\tf@rmfont}{cmbright}\OR\equal{\tf@rmfont}{\TF@DEFAULT}}{ + \renewcommand*\rmdefault{cmbr} + \tf@TSencodedosf + \tf@rmfont@cmbright % housekeeping, e.g., sets rm print name + }{} + \ifthenelse{\equal{\tf@sffont}{cmbright}\OR\equal{\tf@sffont}{\TF@DEFAULT}}{ + \renewcommand*\sfdefault{cmbr} + \tf@sffont@cmbright % housekeeping, e.g., sets sf print name + }{} + \ifthenelse{\equal{\tf@ttfont}{cmbright}\OR\equal{\tf@ttfont}{\TF@DEFAULT}}{ + \renewcommand*\ttdefault{cmtl} + \tf@ttfont@cmbright % housekeeping, e.g., sets tt print name + }{} + } +} + +% Concrete -- shared code +%------------------------ +% Math - Concrete. NB, concrete math is a bitmap font. Likewise +% concrete roman with OT1 fontencoding; T1 fontencoding loads +% cm-super outline fonts instead. +\newcommand*\tf@loadconcrete{ + % Load math/rm concrete as applicable, additionally loading + % rm if user option typeface (rm) is set to \TF@DEFAULT + \providebool{tf@concreteloaded} + \ifbool{tf@concreteloaded}{\relax}{ + \booltrue{tf@concreteloaded} + \ifthenelse{\equal{\tf@mathfont}{concrete}}{ + \tf@ifsuboption{exscale}{\tf@mathfontoptions} + {\PassOptionsToPackage{exscale}{concmath}}{} + \tf@ifsuboption{amsfonts}{\tf@mathfontoptions} + {\PassOptionsToPackage{amsfonts}{concmath}}{} + \tf@ifsuboption{amssymb}{\tf@mathfontoptions} + {\PassOptionsToPackage{amssymb}{concmath}}{} + % The documentation discusses `sansbold' option; the style file only + % accepts `boldsans'. Might as well make things easy for end users. + \tf@ifsuboption{sansbold}{\tf@mathfontoptions} + {\PassOptionsToPackage{boldsans}{concmath}}{} + \tf@ifsuboption{boldsans}{\tf@mathfontoptions} + {\PassOptionsToPackage{boldsans}{concmath}}{} + \tf@usefontpackage{concmath} % preferable to ccfonts + \tf@mathfont@concrete % housekeeping, e.g., sets math print name + }{} + \ifthenelse{\equal{\tf@rmfont}{concrete}\OR\equal{\tf@rmfont}{\TF@DEFAULT}}{ + \renewcommand*\rmdefault{ccr} + \tf@TSencodedosf + \tf@rmfont@concrete % housekeeping, e.g., sets rm print name + }{} + } +} + +% Kepler Project fonts -- shared code +%------------------------------------ +\newcommand*\tf@loadkpfonts{ + \providebool{tf@kpfontsloaded} + \ifbool{tf@kpfontsloaded}{\relax}{ + \booltrue{tf@kpfontsloaded} + \edef\tf@@lfn{jkp} % lining figures fontname: jkp[l,x][k][f] + + \tf@newbool{tf@@kprm}{false} + \tf@newbool{tf@@kpmath}{false} + \ifthenelse{\equal{\tf@rmfont}{kpfonts}}{\booltrue{tf@@kprm}}{} + \ifthenelse{\equal{\tf@mathfont}{kpfonts}}{\booltrue{tf@@kpmath}}{} + \ifthenelse{\boolean{tf@@kprm}\AND\equal{\tf@mathfont}{\TF@DEFAULT}} + {\booltrue{tf@@kpmath}}{} + \ifthenelse{\boolean{tf@@kpmath}\AND\equal{\tf@rmfont}{\TF@DEFAULT}} + {\booltrue{tf@@kprm}}{} + + \ifthenelse{\boolean{tf@@kprm}} + {\renewcommand*\tf@rmprintname{KP Fonts}}{} + \ifthenelse{\boolean{tf@@kpmath}} + {\renewcommand*\tf@mathprintname{KP Fonts}}{} + + \ifthenelse{\boolean{tf@@kprm}\AND\NOT\boolean{tf@@kpmath}} + {\PassOptionsToPackage{nomath}{kpfonts}}{} + \ifthenelse{\boolean{tf@@kpmath}\AND\NOT\boolean{tf@@kprm}} + {\PassOptionsToPackage{notext}{kpfonts}}{} + + \ifbool{tf@@kprm}{ + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@JF}}{ + \PassOptionsToPackage{oldstylenums}{kpfonts} + \ifthenelse{\equal{\tf@mathfont}{\TF@DEFAULT}}{ + \PassOptionsToPackage{oldstylenumsmath}{kpfonts} + }{} + }{} + \tf@ifsuboption{oldstyle}{\tf@rmfontoptions}{ + \PassOptionsToPackage{oldstyle}{kpfonts} + }{ + \tf@ifsuboption{veryoldstyle}{\tf@rmfontoptions}{ + \PassOptionsToPackage{veryoldstyle}{kpfonts} + }{} + } + % NB, rmx trumps light in the kpfonts package. Also note + % that rmx might not be available under all installs. + \tf@ifsuboption{rmx}{\tf@rmfontoptions}{ + \PassOptionsToPackage{rmx}{kpfonts} + \edef\tf@@lfn{\tf@@lfn x} + }{} + \tf@ifsuboption{light}{\tf@rmfontoptions}{ + \PassOptionsToPackage{lighttext}{kpfonts} + \edef\tf@@lfn{\tf@@lfn l} + \xdef\tf@rmprintname{\tf@rmprintname\ Light} + }{ + \ifthenelse{\equal{\tf@rmfont}{\TF@DEFAULT}}{ + \tf@ifsuboption{light}{\tf@mathfontoptions}{ + \PassOptionsToPackage{lighttext}{kpfonts} + \edef\tf@@lfn{\tf@@lfn l} + \xdef\tf@rmprintname{\tf@rmprintname\ Light} + }{} + }{} + } + \tf@ifsuboption{largesmallcaps}{\tf@rmfontoptions}{ + \PassOptionsToPackage{largesmallcaps}{kpfonts} + \edef\tf@@lfn{\tf@@lfn k} + }{} + \tf@ifsuboption{nofligatures}{\tf@rmfontoptions}{ + \PassOptionsToPackage{nofligatures}{kpfonts} + \edef\tf@@lfn{\tf@@lfn f} + }{} + \tf@ifsuboption{easyscsl}{\tf@rmfontoptions}{ + \PassOptionsToPackage{easyscsl}{kpfonts} + }{} + }{} + + \ifbool{tf@@kpmath}{ + \tf@ifsuboption{light}{\tf@mathfontoptions}{ + \PassOptionsToPackage{lightmath}{kpfonts} + \xdef\tf@mathprintname{\tf@mathprintname\ Light} + }{ + \ifthenelse{\equal{\tf@mathfont}{\TF@DEFAULT}}{ + \tf@ifsuboption{light}{\tf@rmfontoptions}{ + \PassOptionsToPackage{lightmath}{kpfonts} + \xdef\tf@mathprintname{\tf@mathprintname\ Light} + }{} + }{} + } + \def\tf@@configurekpoptions##1{ + \tf@ifsuboption{##1}{\tf@mathfontoptions}{ + \PassOptionsToPackage{oldstylenumsmath}{kpfonts} + }{} + } + \forcsvlist{\tf@@configurekpoptions} + {osf,oldstyle,oldfigures,oldstylefigures,oldstylenums,oldstylenumsmath} + \@ifpackageloaded{amsmath}{ + \PassOptionsToPackage{noamsmath}{kpfonts}}{} + \tf@ifsuboption{noamsmath}{\tf@mathfontoptions}{ + \PassOptionsToPackage{noamsmath}{kpfonts}}{} + \tf@ifsuboption{sfmath}{\tf@mathfontoptions}{ + \PassOptionsToPackage{sfmath}{kpfonts}}{} + \tf@ifsuboption{sfmathbb}{\tf@mathfontoptions}{ + \PassOptionsToPackage{sfmathbb}{kpfonts}}{} + \tf@ifsuboption{rmmathbb}{\tf@mathfontoptions}{ + \PassOptionsToPackage{rmmathbb}{kpfonts}}{} + \tf@ifsuboption{nomathscript}{\tf@mathfontoptions}{ + \PassOptionsToPackage{nomathscript}{kpfonts}}{} + \tf@ifsuboption{mathcalasscript}{\tf@mathfontoptions}{ + \PassOptionsToPackage{mathcalasscript}{kpfonts}}{} + \tf@ifsuboption{classicReIm}{\tf@mathfontoptions}{ + \PassOptionsToPackage{classicReIm}{kpfonts}}{} + \tf@ifsuboption{uprightRoman}{\tf@mathfontoptions}{ + \PassOptionsToPackage{uprightRoman}{kpfonts}}{} + \tf@ifsuboption{frenchstyle}{\tf@mathfontoptions}{ + \PassOptionsToPackage{frenchstyle}{kpfonts}}{} + \tf@ifsuboption{upright}{\tf@mathfontoptions}{ + \PassOptionsToPackage{upright}{kpfonts}}{} + \tf@ifsuboption{oldstylenumsmath}{\tf@mathfontoptions}{ + \PassOptionsToPackage{oldstylenumsmath}{kpfonts}}{} + \tf@ifsuboption{oldstylemath}{\tf@mathfontoptions}{ + \PassOptionsToPackage{oldstylemath}{kpfonts}}{} + \tf@ifsuboption{veryoldstylemath}{\tf@mathfontoptions}{ + \PassOptionsToPackage{veryoldstylemath}{kpfonts}}{} + \tf@ifsuboption{narrowiints}{\tf@mathfontoptions}{ + \PassOptionsToPackage{narrowiints}{kpfonts}}{} + \tf@ifsuboption{partialup}{\tf@mathfontoptions}{ + \PassOptionsToPackage{partialup}{kpfonts}}{} + \tf@ifsuboption{widermath}{\tf@mathfontoptions}{ + \PassOptionsToPackage{widermath}{kpfonts}}{} + \tf@ifsuboption{noDcommand}{\tf@mathfontoptions}{ + \PassOptionsToPackage{noDcommand}{kpfonts}}{} + \tf@ifsuboption{intlimits}{\tf@mathfontoptions}{ + \PassOptionsToPackage{intlimits}{kpfonts}}{} + \tf@ifsuboption{nointlimits}{\tf@mathfontoptions}{ + \PassOptionsToPackage{nointlimits}{kpfonts}}{} + \tf@ifsuboption{fullintlimits}{\tf@mathfontoptions}{ + \PassOptionsToPackage{fullintlimits}{kpfonts}}{} + \tf@ifsuboption{sumlimits}{\tf@mathfontoptions}{ + \PassOptionsToPackage{sumlimits}{kpfonts}}{} + \tf@ifsuboption{nosumlimits}{\tf@mathfontoptions}{ + \PassOptionsToPackage{nosumlimits}{kpfonts}}{} + \tf@ifsuboption{fullsumlimits}{\tf@mathfontoptions}{ + \PassOptionsToPackage{fullsumlimits}{kpfonts}}{} + \tf@ifsuboption{uprightgreeks}{\tf@mathfontoptions}{ + \PassOptionsToPackage{uprightgreeks}{kpfonts}}{} + \tf@ifsuboption{slantedGreeks}{\tf@mathfontoptions}{ + \PassOptionsToPackage{slantedGreeks}{kpfonts}}{} + }{} + + \ifthenelse{\boolean{tf@@kprm}\AND\equal{\tf@sffont}{\TF@DEFAULT}} + {\renewcommand*\tf@sfprintname{KP Fonts}} + {\PassOptionsToPackage{nosf}{kpfonts}} + + \ifthenelse{\boolean{tf@@kprm}\AND\equal{\tf@ttfont}{\TF@DEFAULT}} + {\renewcommand*\tf@ttprintname{KP Fonts}} + {\PassOptionsToPackage{nott}{kpfonts}} + + \tf@usefontpackage[notextcomp]{kpfonts} + \tf@define@liningfigures{\tf@@lfn} + } +} + +% Lucida Bright fonts -- shared code +% (TODO: switch for lucimatx package if some kind soul could give me a copy) % <-- TODO +%--------------------------------------------------------------------------- +\tf@newbool{tf@@lbrm}{false} +\tf@newbool{tf@@lbmath}{false} +\tf@newbool{tf@@lbseriftt}{false} + +\newcommand*\tf@@loadlucidabrtextwithoutmath{ + % Note: no attempt is made to check for incompatible user options here + \renewcommand*\rmdefault{hlh} + \tf@ifsuboption{casual}{\tf@rmfontoptions}{\renewcommand*\rmdefault{hlcn}}{} + \tf@ifsuboption{fax}{\tf@rmfontoptions}{\renewcommand*\rmdefault{hlx}}{} + \tf@ifsuboption{seriftt}{\tf@rmfontoptions}{\booltrue{tf@@lbseriftt}}{} + + \def\tf@@lbscale{lucidascale} + \tf@ifsuboption{nolucidascale}{\tf@rmfontoptions} + {\def\tf@@lbscale{nolucidascale}}{} + \tf@ifsuboption{lucidasmallscale}{\tf@rmfontoptions} + {\def\tf@@lbscale{lucidasmallscale}}{} + + \ifthenelse{\equal{\tf@@lbscale}{nolucidascale}}{% strictly redundant + \def\DeclareLucidaFontShape##1##2##3##4##5##6{% + \DeclareFontShape{##1}{##2}{##3}{##4}{<->##5}{##6}% + } + }{} + + \ifthenelse{\equal{\tf@@lbscale}{lucidascale}}{ + \def\DeclareLucidaFontShape##1##2##3##4##5##6{% + \DeclareFontShape{##1}{##2}{##3}{##4}{% + <-5.5>s*[1.04]##5% + <5.5-6.5>s*[1.02]##5% + <6.5-7.5>s*[.99]##5% + <7.5-8.5>s*[.97]##5% + <8.5-9.5>s*[.96]##5% + <9.5-10.5>s*[.95]##5% + <10.5-11.5>s*[.94]##5% + <11.5-13>s*[.93]##5% + <13-15.5>s*[.92]##5% + <15.5-18.5>s*[.91]##5% + <18.5-22.5>s*[.9]##5% + <22.5->s*[.89]##5% + }{##6}% + } + }{} + + \ifthenelse{\equal{\tf@@lbscale}{lucidasmallscale}}{ + \def\DeclareLucidaFontShape##1##2##3##4##5##6{% + \DeclareFontShape{##1}{##2}{##3}{##4}{% + <-5.5>s*[.98]##5% + <5.5-6.5>s*[.96]##5% + <6.5-7.5>s*[.94]##5% + <7.5-8.5>s*[.92]##5% + <8.5-9.5>s*[.91]##5% + <9.5-10.5>s*[.9]##5% + <10.5-11.5>s*[.89]##5% + <11.5-13>s*[.88]##5% + <13-15.5>s*[.87]##5% + <15.5-18.5>s*[.86]##5% + <18.5-22.5>s*[.85]##5% + <22.5->s*[.84]##5% + }{##6}% + } + }{} + + \normalfont + \tf@ifsuboption{calligraphic}{\tf@rmfontoptions}{ + \DeclareFontShape\encodingdefault\rmdefault{m}{it}% + {<->ssub*hlce/m/it}{} + }{} + + \tf@ifsuboption{handwriting}{\tf@rmfontoptions}{ + \DeclareFontShape\encodingdefault\rmdefault{m}{it}% + {<->ssub*hlcw/m/it}{}% + \DeclareFontShape\encodingdefault\rmdefault{b}{it}% + {<->ssub*hlcw/m/it}{} + }{} + + \tf@ifsuboption{altbullet}{\tf@rmfontoptions}{ + \DeclareTextCommand\textbullet\encodingdefault% + {\UseTextSymbol{OMS}\textbullet} + }{} +} + +\newcommand*\tf@@loadlucidabrtextwithmath{ + \@ifpackageloaded{\tf@@lbpkg}{\relax}{ + % Process options. Note that we don't care whether the user requests these + % through rm or math suboptions -- it's all the same to us. E.g., the user + % can request mathitalic1 in rm suboptions. Equally, no attempt is made to + % check for incompatible user options, e.g., whether the user has + % simultaneously specified expert and noexpert. It's up to users to do the + % right thing (otherwise lucidabr.sty would already be coded against this + % sort of problem). + \def\tf@@lbprocessopt##1{ + \tf@ifsuboption{##1}{\tf@rmfontoptions}{ + \PassOptionsToPackage{##1}{\tf@@lbpkg} + }{ + \tf@ifsuboption{##1}{\tf@mathfontoptions}{ + \PassOptionsToPackage{##1}{\tf@@lbpkg} + }{} + } + } + \ifthenelse{\boolean{tf@@lbrm}}{ + \forcsvlist{\tf@@lbprocessopt} + {expert,noexpert,lucidascale,nolucidascale,lucidasmallscale,% + mathitalic1,mathitalic2,mathitalic3,slantedgreek,% + uprightgreek,vargreek,% these might, or might not, cause trouble + noamssymbols,OT1,T1,LY1,seriftt,% + fax,casual,calligraphic,handwriting,altbullet,% + errorshow,warningshow,nofontinfo} + }{ + \forcsvlist{\tf@@lbprocessopt} + {expert,noexpert,nolucidascale,lucidascale,lucidasmallscale,% + mathitalic1,mathitalic2,mathitalic3,slantedgreek,% + uprightgreek,vargreek,% these might, or might not, cause trouble + noamssymbols,OT1,T1,LY1,errorshow,warningshow,nofontinfo} + } + + \tf@ifsuboption{seriftt}{\tf@rmfontoptions}{\booltrue{tf@@lbseriftt}}{} + \tf@ifsuboption{seriftt}{\tf@mathfontoptions}{\booltrue{tf@@lbseriftt}}{} + + % Allow preloading amsmath (new -- not one of lucida's native package + % options). For examples, see lucida-amsmath.pdf in lucidabr package. + \tf@ifsuboption{amsmath}{\tf@mathfontoptions} + {\tf@usefontpackage{amsmath}}{} + + \tf@usefontpackage{\tf@@lbpkg} + } +} + +\newcommand*\tf@loadlucidabr{ + \ifthenelse{\equal{\tf@rmfont}{lucidabright}}{\booltrue{tf@@lbrm}}{} + \ifthenelse{\equal{\tf@mathfont}{lucidabright}}{\booltrue{tf@@lbmath}}{} + \ifthenelse{\boolean{tf@@lbrm}\AND\equal{\tf@mathfont}{\TF@DEFAULT}} + {\booltrue{tf@@lbmath}}{} + \ifthenelse{\boolean{tf@@lbmath}\AND\equal{\tf@rmfont}{\TF@DEFAULT}} + {\booltrue{tf@@lbrm}}{} + + \ifbool{tf@@lbrm}{\renewcommand*\tf@rmprintname{Lucida Bright}}{} + \ifbool{tf@@lbmath}{\renewcommand*\tf@mathprintname{Lucida Bright}}{} + + \ifbool{tf@@lbmath}{ + \ifbool{tf@@lbrm} + {\def\tf@@lbpkg{lucidabr}} + {\def\tf@@lbpkg{lucbmath}} + \tf@@loadlucidabrtextwithmath + }{ + \tf@@loadlucidabrtextwithoutmath + } + + \ifthenelse{\equal{\tf@sffont}{\TF@DEFAULT}}{\tf@sffont@lucidabright}{} + \ifthenelse{\equal{\tf@ttfont}{\TF@DEFAULT}}{\tf@ttfont@lucidabright}{} + + \ifbool{tf@@lbrm}{\tf@TSencodedosf}{} +} + +% Mathpazo (aka palatino with pazo math fonts) -- shared code +%------------------------------------------------------------ +\newcommand*\tf@loadmathpazo{ + \providebool{tf@mathpazoloaded} + \ifbool{tf@mathpazoloaded}{\relax}{ + \booltrue{tf@mathpazoloaded} + + % ward off possible clash of glyphs + \tf@undefinecommands{\mathdollar} + + \tf@ifsuboption{slantedGreek}{\tf@mathfontoptions} + {\PassOptionsToPackage{slantedGreek}{mathpazo}}{} + \tf@ifsuboption{noBBpl}{\tf@mathfontoptions} + {\PassOptionsToPackage{noBBpl}{mathpazo}}{} + \let\oldoldstylenums\oldstylenums % before mathpazo hijacks this + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@LF}}{ + \tf@usefontpackage[sc]{mathpazo} + }{ + \tf@usefontpackage[sc,osf]{mathpazo} + \tf@define@liningfigures{pplx} + } + \ifthenelse{\NOT\equal{\tf@rmfont}{palatino} + \AND\NOT\equal{\tf@rmfont}{\TF@DEFAULT}}{ + \let\oldstylenums\oldoldstylenums + }{} + \tf@ifsuboption{osf}{\tf@mathfontoptions}{ + % Experimental mathpazo old style figures. Covers + % normal and italic but not bold or bold italic. + % Probably best to avoid. + \DeclareSymbolFont{operators} {OT1}{pplj}{m}{n} + \SetSymbolFont{operators}{bold} {OT1}{pplj}{b}{n} + \DeclareMathAlphabet{\mathit} {OT1}{pplj}{m}{it} + \SetMathAlphabet{\mathit}{bold} {OT1}{pplj}{b}{it} + }{} + } +} + +% TX Fonts (including New TX) -- shared code +%------------------------------------------- +\newcommand*\tf@loadtxfonts{ + % Precondition: at least one of \tf@mathfont and \tf@rmfont equals `txfonts' + \providebool{tf@txfontsloaded} + \ifbool{tf@txfontsloaded}{\relax}{ + \booltrue{tf@txfontsloaded} + + % determine whether we should load (standard) tx or new tx fonts + \tf@newbool{newtxmath}{false} + \tf@newbool{newtxtext}{false} + \ifthenelse{\equal{\tf@mathfont}{txfonts}}{ + \tf@ifsuboption{new}{\tf@mathfontoptions}{\booltrue{newtxmath}}{} + }{ + \ifthenelse{\equal{\tf@mathfont}{\TF@DEFAULT}}{ + \tf@ifsuboption{new}{\tf@rmfontoptions}{\booltrue{newtxmath}}{} + }{} + } + \ifthenelse{\equal{\tf@rmfont}{txfonts}}{ + \tf@ifsuboption{new}{\tf@rmfontoptions}{\booltrue{newtxtext}}{} + }{ + \ifthenelse{\equal{\tf@rmfont}{\TF@DEFAULT}}{ + \tf@ifsuboption{new}{\tf@mathfontoptions}{\booltrue{newtxtext}}{} + }{} + } + + \ifthenelse{\equal{\tf@mathfont}{txfonts}\OR\equal{\tf@mathfont}{\TF@DEFAULT}}{ + \ifbool{newtxmath}{ + \def\tf@@configuretxoptions##1{ + \tf@ifsuboption{##1}{\tf@mathfontoptions}{ + \PassOptionsToPackage{##1}{newtxmath} + }{} + } + \forcsvlist{\tf@@configuretxoptions}{varg,libertine,cmintegrals,% + uprightGreek,cmbraces,varbb,nosymbolsc,amssymbols,noamssymbols} + \tf@usefontpackage{newtxmath} + }{ + \tf@usefontpackage{txfonts} + } + \tf@ifsuboption{ptmxitalics}{\tf@mathfontoptions}{ + % Use ptmx font's quite differently kerned italic/slant math letters. + % See van Bevern's discussion at: + % http://rvb.mytanet.de/times-with-normal-mathcal-and-summation-sign.shtml + \DeclareSymbolFont{letters}{OML}{ztmcm}{m}{it} + }{} + }{} + + \ifthenelse{\equal{\tf@rmfont}{txfonts}\OR\equal{\tf@rmfont}{\TF@DEFAULT}}{ + \ifbool{newtxtext}{ + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@JF}}{ + \tf@usefontpackage[osf]{newtxtext} + \tf@define@liningfigures{ntxr} + }{\tf@usefontpackage{newtxtext}} + }{ + \renewcommand*\rmdefault{txr} + \tf@TSencodedosf + } + }{} + + \ifthenelse{\equal{\tf@sffont}{\TF@DEFAULT}}{\tf@sffont@txfonts}{} + \ifthenelse{\equal{\tf@ttfont}{\TF@DEFAULT}}{\tf@ttfont@txfonts}{} + }{} +} + +% Text figures typeface -- unlike other typeface families, text +% figures configuration is not sensitive to font load ordering +% ============================================================= +\TF@PackageDebugInfo{Configuring text figures load commands...} + +% Configure textfigures method and associated values +%--------------------------------------------------- +% `\tf@osf@method' resolves to one of the following values: +% TF@OSF@LF: normal typesetting, \textstylenums command and textnums +% environment => lining figures +% TF@OSF@JF: normal typesetting, \textstylenums and textnums => old style +% figures sourced from `j' family +% TF@OSF@XF: normal typesetting => lining figures +% \textstylenums and textnums => old style figures sourced from +% substitute font (\tf@textfiguresfont contains the name of the +% substitute font) +% TF@OSF@TS: normal typesetting => lining figures +% \textstylenums and textnums => old style figures sourced from +% TS1 font mappings +% TF@OSF@SC: normal typesetting => lining figures +% \textstylenums and textnums => old style figures sourced from +% SmallCap family +% TF@OSF@NF: use native font -- do nothing + +\newcommand*\tf@osf@method{TF@OSF@NF} + +% Default -- no-op +\newtypeface{\TF@DEFAULT}{\TF@DEFAULTPRINTNAME}{textfigures}{ + \renewcommand*\tf@osf@method{\TF@OSF@NF} +} + +% Lining style text figures +\newtypeface[lf,lsf,lining,liningstyle,liningstylefigures,false] + {liningfigures} + {Lining Style Figures} + {textfigures}{ + \renewcommand*\tf@osf@method{\TF@OSF@LF} +} + +% Old style text figures +\newtypeface[osf,oldstyle,oldfigures,oldstylefigures,true] + {textfigures} + {Old Style Figures} + {textfigures}{ + \renewcommand*\tf@osf@method{\TF@OSF@JF} % \tf@osf@method is often set to + % \TF@OSF@TS or \TF@OSF@SC later on +} + +% Substitute OSF font name (literal) used in text figures font declarations +\newcommand*\tf@substosffont{tf@substosffont} + +% \newtypeface textfigures preamble (see examples, below) +\newcommand*\tf@initialisetextfiguresfont[1]{ + % #1 is the substitute osf font encoding to use (T1 in all likelihood) + \renewcommand*\tf@osf@method{\TF@OSF@XF} + \newcommand*\tf@substosffontencoding{#1} + \let\oldencodingdefault\encodingdefault + \usepackage[\tf@substosffontencoding]{fontenc} + \let\encodingdefault\oldencodingdefault + \newcommand*\tf@s{} + \scaletypeface{textfigures}{\edef\tf@s{[\tf@textfiguresscalefactor]}} + \DeclareFontFamily{\tf@substosffontencoding}{\tf@substosffont}{} + % Redefine \DeclareSizeFunction (restored in \newtypeface, defined + % above). And, no, we can't apply `s*' in \tf@s in this case. + \let\oldDeclareSizeFunction\DeclareSizeFunction + \DeclareSizeFunction{}{\empty@sfcnt\@font@info} +} + +% Substitute OSF \DeclareFontShape helper +\newcommand*\tf@DeclareOsfFontShape[3]{ + \DeclareFontShape{\tf@substosffontencoding}{\tf@substosffont} + {#1}{#2}{ <-> \tf@s #3}{} +} + +% Adobe Minion Pro text figures +\newtypeface{adobeminionpro}{Adobe Minion Pro}{textfigures}{ + \tf@initialisetextfiguresfont{T1} + + % proportional vs tabular OSF (don't do tabular -- it would be bad!) + \edef\tf@@mpsuffix{osf-\tf@substosffontencoding} + \tf@ifsuboption{tabular}{\tf@textfiguresfontoptions}{ + \edef\tf@@mpsuffix{tosf-\tf@substosffontencoding} + }{ + \tf@ifsuboption{tab}{\tf@textfiguresfontoptions}{ + \edef\tf@@mpsuffix{tosf-\tf@substosffontencoding} + }{} + } + \tf@DeclareOsfFontShape{m} {n} {MinionPro-Regular-\tf@@mpsuffix} + \tf@DeclareOsfFontShape{m} {it}{MinionPro-It-\tf@@mpsuffix} + \tf@DeclareOsfFontShape{m} {sl}{MinionPro-It-\tf@@mpsuffix} + \tf@DeclareOsfFontShape{m} {sc}{MinionPro-Regular-\tf@@mpsuffix} + \tf@DeclareOsfFontShape{mb}{n} {MinionPro-Medium-\tf@@mpsuffix} + \tf@DeclareOsfFontShape{mb}{it}{MinionPro-MediumI-\tf@@mpsuffix} + \tf@DeclareOsfFontShape{mb}{sl}{MinionPro-MediumIt-\tf@@mpsuffix} + \tf@DeclareOsfFontShape{b} {n} {MinionPro-Bold-\tf@@mpsuffix} + \tf@DeclareOsfFontShape{b} {it}{MinionPro-BoldIt-\tf@@mpsuffix} + \tf@DeclareOsfFontShape{b} {sl}{MinionPro-BoldIt-\tf@@mpsuffix} + \tf@DeclareOsfFontShape{bx}{n} {MinionPro-Bold-\tf@@mpsuffix} + \tf@DeclareOsfFontShape{bx}{it}{MinionPro-BoldIt-\tf@@mpsuffix} + \tf@DeclareOsfFontShape{bx}{sl}{MinionPro-BoldIt-\tf@@mpsuffix} + \tf@DeclareOsfFontShape{sb}{n} {MinionPro-Semibold-\tf@@mpsuffix} + \tf@DeclareOsfFontShape{sb}{it}{MinionPro-SemiboldIt-\tf@@mpsuffix} + \tf@DeclareOsfFontShape{sb}{sl}{MinionPro-SemiboldIt-\tf@@mpsuffix} +} + +% Day Roman text figures -- here for completeness only +\newtypeface[dayrom]{dayroman}{Day Roman}{textfigures}{ + \tf@initialisetextfiguresfont{T1} + \tf@DeclareOsfFontShape{m}{n}{dayromr8t} +} + +% KP Fonts text figures +\newtypeface[kp,kepler]{kpfonts}{KP Fonts}{textfigures}{ % TODO: condensed + \tf@initialisetextfiguresfont{T1} + \tf@ifsuboption{light}{\tf@textfiguresfontoptions}{ + \tf@DeclareOsfFontShape{m} {n} {jkplosnmn8t} + \tf@DeclareOsfFontShape{m} {it} {jkplosnmit8t} + \tf@DeclareOsfFontShape{m} {sl} {jkplosnmsl8t} + \tf@DeclareOsfFontShape{m} {sc} {jkplosnmsc8t} + \tf@DeclareOsfFontShape{m} {scsl} {jkplosnmscsl8t} + \tf@DeclareOsfFontShape{b} {n} {jkplosnbn8t} + \tf@DeclareOsfFontShape{b} {it} {jkplosnbit8t} + \tf@DeclareOsfFontShape{b} {sl} {jkplosnbsl8t} + \tf@DeclareOsfFontShape{b} {sc} {jkplosnbsc8t} + \tf@DeclareOsfFontShape{b} {scsl} {jkplosnbscsl8t} + \tf@DeclareOsfFontShape{bx}{n} {jkplosnbxn8t} + \tf@DeclareOsfFontShape{bx}{it} {jkplosnbxit8t} + \tf@DeclareOsfFontShape{bx}{sl} {jkplosnbxsl8t} + \tf@DeclareOsfFontShape{bx}{sc} {jkplosnbxsc8t} + \tf@DeclareOsfFontShape{bx}{scsl} {jkplosnbxscsl8t} + }{ + \tf@DeclareOsfFontShape{m} {n} {jkposnmn8t} + \tf@DeclareOsfFontShape{m} {it} {jkposnmit8t} + \tf@DeclareOsfFontShape{m} {sl} {jkposnmsl8t} + \tf@DeclareOsfFontShape{m} {sc} {jkposnmsc8t} + \tf@DeclareOsfFontShape{m} {scsl} {jkposnmscsl8t} + \tf@DeclareOsfFontShape{b} {n} {jkposnbn8t} + \tf@DeclareOsfFontShape{b} {it} {jkposnbit8t} + \tf@DeclareOsfFontShape{b} {sl} {jkposnbsl8t} + \tf@DeclareOsfFontShape{b} {sc} {jkposnbsc8t} + \tf@DeclareOsfFontShape{b} {scsl} {jkposnbscsl8t} + \tf@DeclareOsfFontShape{bx}{n} {jkposnbxn8t} + \tf@DeclareOsfFontShape{bx}{it} {jkposnbxit8t} + \tf@DeclareOsfFontShape{bx}{sl} {jkposnbxsl8t} + \tf@DeclareOsfFontShape{bx}{sc} {jkposnbxsc8t} + \tf@DeclareOsfFontShape{bx}{scsl} {jkposnbxscsl8t} + \tf@DeclareOsfFontShape{l} {n} {jkplosnmn8t} + \tf@DeclareOsfFontShape{l} {it} {jkplosnmit8t} + \tf@DeclareOsfFontShape{l} {sl} {jkplosnmsl8t} + \tf@DeclareOsfFontShape{l} {sc} {jkplosnmsc8t} + \tf@DeclareOsfFontShape{l} {scsl} {jkplosnmscsl8t} + \tf@DeclareOsfFontShape{sb}{n} {jkplosnbn8t} + \tf@DeclareOsfFontShape{sb}{it} {jkplosnbit8t} + \tf@DeclareOsfFontShape{sb}{sl} {jkplosnbsl8t} + \tf@DeclareOsfFontShape{sb}{sc} {jkplosnbsc8t} + \tf@DeclareOsfFontShape{sb}{scsl} {jkplosnbscsl8t} + \tf@DeclareOsfFontShape{sbx}{n} {jkplosnbxn8t} + \tf@DeclareOsfFontShape{sbx}{it} {jkplosnbxit8t} + \tf@DeclareOsfFontShape{sbx}{sl} {jkplosnbxsl8t} + \tf@DeclareOsfFontShape{sbx}{sc} {jkplosnbxsc8t} + \tf@DeclareOsfFontShape{sbx}{scsl}{jkplosnbxscsl8t} + } +} + +% Latin Modern text figures +\newtypeface[lm,lmodern]{latinmodern}{Latin Modern}{textfigures}{ + % This is a bit dodgy since we're referring to TS1 tables regardless of + % our font encoding. Nevertheless, for numerals (and only numerals) + % substitution it should work out well enough. + \tf@initialisetextfiguresfont{T1} + \DeclareFontShape{\tf@substosffontencoding}{\tf@substosffont}{m}{n}{ + <-5.5> \tf@s ts1-lmr5 <5.5-6.5> \tf@s ts1-lmr6 + <6.5-7.5> \tf@s ts1-lmr7 <7.5-8.5> \tf@s ts1-lmr8 + <8.5-9.5> \tf@s ts1-lmr9 <9.5-11> \tf@s ts1-lmr10 + <11-15> \tf@s ts1-lmr12 <15-> \tf@s ts1-lmr17 }{} + \DeclareFontShape{\tf@substosffontencoding}{\tf@substosffont}{m}{it}{ + <-7.5> \tf@s ts1-lmri7 <7.5-8.5> \tf@s ts1-lmri8 + <8.5-9.5> \tf@s ts1-lmri9 <9.5-11> \tf@s ts1-lmri10 + <11-> \tf@s ts1-lmri12 }{} + \DeclareFontShape{\tf@substosffontencoding}{\tf@substosffont}{m}{sl}{ + <-8.5> \tf@s ts1-lmro8 <8.5-9.5> \tf@s ts1-lmro9 + <9.5-11> \tf@s ts1-lmro10 <11-15> \tf@s ts1-lmro12 + <15-> \tf@s ts1-lmro17 }{} + \tf@DeclareOsfFontShape{m}{sc} {ts1-lmcsc10} + \tf@DeclareOsfFontShape{m}{ui} {ts1-lmu10} + \tf@DeclareOsfFontShape{m}{scsl}{ts1-lmcsco10} + \tf@DeclareOsfFontShape{b}{n} {ts1-lmb10} + \tf@DeclareOsfFontShape{b}{it} {ts1-lmbo10} + \tf@DeclareOsfFontShape{b}{sl} {ts1-lmbo10} + \DeclareFontShape{\tf@substosffontencoding}{\tf@substosffont}{bx}{n}{ + <-5.5> \tf@s ts1-lmbx5 <5.5-6.5> \tf@s ts1-lmbx6 + <6.5-7.5> \tf@s ts1-lmbx7 <7.5-8.5> \tf@s ts1-lmbx8 + <8.5-9.5> \tf@s ts1-lmbx9 <9.5-11> \tf@s ts1-lmbx10 + <11-> \tf@s ts1-lmbx12}{} + \tf@DeclareOsfFontShape{bx}{it} {ts1-lmbxi10} + \tf@DeclareOsfFontShape{bx}{sl} {ts1-lmbxo10} +} + +% Libertine text figures -- NB, see comments with libertine (legacy) rm +\newtypeface{libertine}{Libertine}{textfigures}{ + \tf@initialisetextfiguresfont{T1} + %--------------------------------------------------------------------- + % NOTE! read the comments next to libertine in the Roman fonts section + %--------------------------------------------------------------------- + % ***proportional*** (not tabular) old style figures + \tf@DeclareOsfFontShape{m}{ic} {fxlric-\tf@substosffontencoding os} + \tf@DeclareOsfFontShape{m}{it} {fxlri-\tf@substosffontencoding os} + \tf@DeclareOsfFontShape{m}{n} {fxlr-\tf@substosffontencoding os} + \tf@DeclareOsfFontShape{m}{sc} {fxlrc-\tf@substosffontencoding os} + \tf@DeclareOsfFontShape{m}{sl} {fxlro-\tf@substosffontencoding os} + \tf@DeclareOsfFontShape{b}{ic} {fxlbic-\tf@substosffontencoding os} + \tf@DeclareOsfFontShape{b}{it} {fxlbi-\tf@substosffontencoding os} + \tf@DeclareOsfFontShape{b}{n} {fxlz-\tf@substosffontencoding os} + \tf@DeclareOsfFontShape{b}{sc} {fxlbc-\tf@substosffontencoding os} + \tf@DeclareOsfFontShape{b}{sl} {fxlbo-\tf@substosffontencoding os} + \tf@DeclareOsfFontShape{bx}{ic} {fxlbic-\tf@substosffontencoding os} + \tf@DeclareOsfFontShape{bx}{it} {fxlbi-\tf@substosffontencoding os} + \tf@DeclareOsfFontShape{bx}{n} {fxlz-\tf@substosffontencoding os} + \tf@DeclareOsfFontShape{bx}{sc} {fxlbc-\tf@substosffontencoding os} + \tf@DeclareOsfFontShape{bx}{sl} {fxlbo-\tf@substosffontencoding os} + \tf@DeclareOsfFontShape{d}{it} {fxldro-\tf@substosffontencoding os} + \tf@DeclareOsfFontShape{d}{n} {fxldr-\tf@substosffontencoding os} + \tf@DeclareOsfFontShape{d}{sc} {fxldrc-\tf@substosffontencoding os} + \tf@DeclareOsfFontShape{d}{sl} {fxldro-\tf@substosffontencoding os} + \tf@DeclareOsfFontShape{z}{ic} {fxlzic-\tf@substosffontencoding os} + \tf@DeclareOsfFontShape{z}{it} {fxlzi-\tf@substosffontencoding os} + \tf@DeclareOsfFontShape{z}{n} {fxlz-\tf@substosffontencoding os} + \tf@DeclareOsfFontShape{z}{sc} {fxlzc-\tf@substosffontencoding os} + \tf@DeclareOsfFontShape{z}{sl} {fxlzo-\tf@substosffontencoding os} +} + +% Lucida Bright text figures +\newtypeface[lucidabr,lucida]{lucidabright}{Lucida Bright}{textfigures}{ + \tf@initialisetextfiguresfont{T1} + \tf@DeclareOsfFontShape{m}{n} {hlhr8c} + \tf@DeclareOsfFontShape{m}{it} {hlhri8c} + \tf@DeclareOsfFontShape{m}{sl} {hlhro8c} + \tf@DeclareOsfFontShape{m}{sc} {hlhr8c} + \tf@DeclareOsfFontShape{b}{n} {hlhb8c} + \tf@DeclareOsfFontShape{b}{it} {hlhbi8c} + \tf@DeclareOsfFontShape{b}{sl} {hlhbi8c} + \tf@DeclareOsfFontShape{b}{sc} {hlhb8c} + \tf@DeclareOsfFontShape{bx}{n} {hlhb8c} + \tf@DeclareOsfFontShape{bx}{it} {hlhbi8c} + \tf@DeclareOsfFontShape{bx}{sl} {hlhbi8c} + \tf@DeclareOsfFontShape{bx}{sc} {hlhb8c} +} + +% Palatino text figures +\newtypeface{palatino}{Palatino}{textfigures}{ + \tf@initialisetextfiguresfont{T1} + \tf@DeclareOsfFontShape{m} {it} {pplri9d} + \tf@DeclareOsfFontShape{m} {n} {pplr9d} + \tf@DeclareOsfFontShape{m} {sc} {pplrc9d} + \tf@DeclareOsfFontShape{m} {sl} {pplri9d} + \tf@DeclareOsfFontShape{b} {it} {pplbi9d} + \tf@DeclareOsfFontShape{b} {n} {pplb9d} + \tf@DeclareOsfFontShape{b} {sl} {pplbi9d} + \tf@DeclareOsfFontShape{bx}{it} {pplbi9d} + \tf@DeclareOsfFontShape{bx}{n} {pplb9d} + \tf@DeclareOsfFontShape{bx}{sl} {pplbi9d} +} + +% Times Roman text figures (txfonts) +\newtypeface{times}{Times Roman}{textfigures}{ + \tf@initialisetextfiguresfont{T1} + \tf@DeclareOsfFontShape{m}{n} {tcxr} + \tf@DeclareOsfFontShape{m}{sc} {tcxr} + \tf@DeclareOsfFontShape{m}{sl} {tcxsl} + \tf@DeclareOsfFontShape{m}{it} {tcxi} + \tf@DeclareOsfFontShape{m}{ui} {tcxi} + \tf@DeclareOsfFontShape{b}{n} {tcxb} + \tf@DeclareOsfFontShape{b}{sc} {tcxb} + \tf@DeclareOsfFontShape{b}{sl} {tcxbsl} + \tf@DeclareOsfFontShape{b}{it} {tcxbi} + \tf@DeclareOsfFontShape{b}{ui} {tcxbi} + \tf@DeclareOsfFontShape{bx}{n} {tcxb} + \tf@DeclareOsfFontShape{bx}{sc} {tcxb} + \tf@DeclareOsfFontShape{bx}{sl} {tcxbsl} + \tf@DeclareOsfFontShape{bx}{it} {tcxbi} + \tf@DeclareOsfFontShape{bx}{ui} {tcxbi} +} + +% Symbols typeface -- highly sensitive to font load ordering, particularly +% to math -> symbols / symbols -> math font load order +% ======================================================================= +\TF@PackageDebugInfo{Configuring symbols load commands...} + +% Default -- no-op +\newtypeface{\TF@DEFAULT}{}{symbols}{ + \ifthenelse{\equal{\tf@symbolsprintname}{undefined}}{ + \renewcommand*\tf@symbolsprintname{\TF@DEFAULTPRINTNAME} + }{} +} + +% AMS symbols +\newtypeface[ams]{amssymb}{}{symbols}{ + \ifthenelse{\equal{\tf@rmfont}{adobeminionpro} + \AND\equal{\tf@mathfont}{\TF@DEFAULT}}{ + \TF@PackageWarningNoLine{% + Package option `symbolstypeface=\tf@symbolsfontname' conflicts + \MessageBreak with option combination:\MessageBreak + \space\space`typeface=\tf@rmfontname', and\MessageBreak + \space\space`mathtypeface=\tf@mathfontname'.\MessageBreak + Option `symbolstypeface=\tf@symbolsfontname' ignored} + \renewcommand*\tf@symbolsprintname{\TF@DEFAULTPRINTNAME} + }{ + \ifthenelse{\equal{\tf@mathfont}{adobeminionpro} + \OR\equal{\tf@mathfont}{mathdesign}}{ + \TF@PackageWarningNoLine{% + Package option `mathtypeface=\tf@mathfontname'\MessageBreak + conflicts with `symbolstypeface=\tf@symbolsfontname'.\MessageBreak + Option `symbolstypeface=\tf@symbolsfontname' ignored} + \renewcommand*\tf@symbolsprintname{\TF@DEFAULTPRINTNAME} + }{ + \tf@usefontpackage{amssymb} + \renewcommand*\tf@symbolsprintname{AMS Symbols} + \tf@ifsuboption{nofixmath}{\tf@symbolsfontoptions}{ + }{ + \usepackage{fixmath} % Italic uppercase Greek. May be overridden by + % some maths packages later in the load stream + } + } + } +} + +% FD Symbol +\newtypeface[fd]{fdsymbol}{FD Symbol}{symbols}{ + % bypass a few commonly troublesome namespace collisions + \tf@undefinecommands{\mid,\surd} + + \newcommand*\tf@fdopt@normalweight{Book} + \newcommand*\tf@fdopt@boldweight{Medium} + \newcommand*\tf@fdopt@largedelims{false} + + \tf@ifsuboption{normalweightRegular}{\tf@symbolsfontoptions}{ + \renewcommand*\tf@fdopt@normalweight{Regular} + }{ + \tf@ifsuboption{normalweightAuto}{\tf@symbolsfontoptions}{ + \renewcommand*\tf@fdopt@normalweight{auto} + }{} + } + + \tf@ifsuboption{boldweightMedium}{\tf@symbolsfontoptions}{ + \renewcommand*\tf@fdopt@boldweight{Regular} + }{ + \tf@ifsuboption{boldweightAuto}{\tf@symbolsfontoptions}{ + \renewcommand*\tf@fdopt@boldweight{auto} + }{} + } + + \tf@ifsuboption{largedelims}{\tf@symbolsfontoptions}{ + \renewcommand*\tf@fdopt@largedelims{true} + }{} + + % FD Symbol loads AMS Math. Preload amsmath here to ensure + % we can load it without package options clashes. This + % reverses the usual symbols/math loading order. + \ifthenelse{\equal{\tf@mathfont}{amsfonts}}{ + \tf@mathfont@amsfonts + }{} + + \tf@usefontpackage[normalweight=\tf@fdopt@normalweight, + boldweight=\tf@fdopt@boldweight, + scale=1, + largedelims=\tf@fdopt@largedelims]{fdsymbol} +} + +% Mathabx. Standard mathabx (ported from mf) is a bitmap/raster font, and +% therefore is not scalable out-of-the-box. Accordingly, you might see +% several font size rescaling warnings. Additionally, mathabx does not +% always play peacefully with other packages, potentially leading to +% symbol already defined issues. Still, it offers a good number of math +% symbols not easily found elsewhere. +\newtypeface[abx]{mathabx}{Math abx}{symbols}{ + \tf@usefontpackage{mathabx} +} + +% Adobe Minion Pro compatible symbols +\newtypeface[mn]{mnsymbol}{MnSymbol}{symbols}{ + \tf@undefinecommands{\mathcal} + + % MnSymbol loads AMS Math and textcomp. Preload amsmath here + % to ensure we load it without options clashes. This reverses the + % usual symbols/math loading order. + \ifthenelse{\equal{\tf@mathfont}{amsfonts}}{ + \tf@mathfont@amsfonts + }{} + % We don't provide MnSymbol cmsy and abx package calligraphic font + % options here since they tend to be too fine grained, too unlikely + % to produce noticeable typographic differences and too problematic + % for ordinary users. Advanced users will almost certainly not want + % to select these options for those same reasons. + \tf@usefontpackage{MnSymbol} +} + +% Adobe Myriad Pro compatible symbols +\newtypeface[md]{mdsymbol}{MdSymbol}{symbols}{ + \tf@ifsuboption{Regular}{\tf@symbolsfontoptions} + {\PassOptionsToPackage{normalweight=Regular}{mdsymbol}}{} + \tf@ifsuboption{regular}{\tf@symbolsfontoptions} + {\PassOptionsToPackage{normalweight=Regular}{mdsymbol}}{} + \tf@ifsuboption{Light}{\tf@symbolsfontoptions} + {\PassOptionsToPackage{normalweight=Light}{mdsymbol}}{} + \tf@ifsuboption{light}{\tf@symbolsfontoptions} + {\PassOptionsToPackage{normalweight=Light}{mdsymbol}}{} + \tf@ifsuboption{autolight}{\tf@symbolsfontoptions} + {\PassOptionsToPackage{normalweight=autolight}{mdsymbol}}{} + \tf@ifsuboption{autoregular}{\tf@symbolsfontoptions} + {\PassOptionsToPackage{normalweight=autoregular}{mdsymbol}}{} + + \tf@ifsuboption{Semibold}{\tf@symbolsfontoptions} + {\PassOptionsToPackage{boldweight=Semibold}{mdsymbol}}{} + \tf@ifsuboption{semibold}{\tf@symbolsfontoptions} + {\PassOptionsToPackage{boldweight=Semibold}{mdsymbol}}{} + \tf@ifsuboption{Bold}{\tf@symbolsfontoptions} + {\PassOptionsToPackage{boldweight=Bold}{mdsymbol}}{} + \tf@ifsuboption{bold}{\tf@symbolsfontoptions} + {\PassOptionsToPackage{boldweight=Bold}{mdsymbol}}{} + \tf@ifsuboption{autosemibold}{\tf@symbolsfontoptions} + {\PassOptionsToPackage{boldweight=autosemibold}{mdsymbol}}{} + + \tf@ifsuboption{onlysansmath}{\tf@symbolsfontoptions} + {\PassOptionsToPackage{onlysansmath=true}{mdsymbol}}{} + \tf@ifsuboption{retainmissing}{\tf@symbolsfontoptions} + {\PassOptionsToPackage{retainmissing=true}{mdsymbol}}{} + \tf@ifsuboption{largedelims}{\tf@symbolsfontoptions} + {\PassOptionsToPackage{largedelims=true}{mdsymbol}}{} + + \tf@ifsuboption{scale}{\tf@symbolsfontoptions} + {\PassOptionsToPackage{scale=\tf@nextsuboption}{mdsymbol}}{} + + % MdSymbol loads AMS Math. Preload amsmath here to ensure + % we can load it without package options clashes. This + % reverses the usual symbols/math loading order. + \ifthenelse{\equal{\tf@mathfont}{amsfonts}}{ + \tf@mathfont@amsfonts + }{} + + \tf@usefontpackage{mdsymbol} +} + +% Math typeface -- highly sensitive to font load ordering, particularly +% to math -> symbols / symbols -> math font load order +% ===================================================================== +\TF@PackageDebugInfo{Configuring math load commands...} + +% Default -- no-op +\newtypeface{\TF@DEFAULT}{}{math}{ + \ifthenelse{\equal{\tf@mathprintname}{undefined}}{ + \renewcommand*\tf@mathprintname{\TF@DEFAULTPRINTNAME} + }{} +} + +% Math -- AMS Math +\newtypeface[ams,amsmath]{amsfonts}{AMS Math}{math}{ + \@ifpackageloaded{amsmath}{\relax}{ + % avoid a bunch of possible symbols namespace collisions + \tf@undefinecommands{ + \iint,\iiint,\dddot,\ddddot, + \overleftrightarrow,\underleftrightarrow, + \underrightarrow,\underleftarrow, + } + \tf@ifsuboption{tbtags}{\tf@mathfontoptions} + {\PassOptionsToPackage{tbtags}{amsmath}}{} + \tf@ifsuboption{nosumlimits}{\tf@mathfontoptions} + {\PassOptionsToPackage{nosumlimits}{amsmath}}{} + \tf@ifsuboption{intlimits}{\tf@mathfontoptions} + {\PassOptionsToPackage{intlimits}{amsmath}}{} + \tf@ifsuboption{nonamelimits}{\tf@mathfontoptions} + {\PassOptionsToPackage{nonamelimits}{amsmath}}{} + \tf@usefontpackage{amsmath} + } + \tf@ifsuboption{donotfixamsmathbugs}{\tf@mathfontoptions} + {}{\usepackage{mathtools}} +} + +% Math -- Antykwa Torunska +\newtypeface[anttor,torunska]{antykwatorunska}{}{math}{ + \tf@loadantykwatorunska +} + +% Math -- Arev Sans (Bitsream Vera Sans tuned for maths) +\newtypeface[arev]{arevmath}{Arev Math}{math}{ + \tf@ifsuboption{origletters}{\tf@mathfontoptions} + {\PassOptionsToPackage{origletters}{arevmath}}{} + \tf@ifsuboption{vara}{\tf@mathfontoptions} + {\PassOptionsToPackage{vara}{arevmath}}{} + \tf@ifsuboption{vari}{\tf@mathfontoptions} + {\PassOptionsToPackage{vari}{arevmath}}{} + \tf@ifsuboption{varI}{\tf@mathfontoptions} + {\PassOptionsToPackage{varI}{arevmath}}{} + \tf@ifsuboption{varf}{\tf@mathfontoptions} + {\PassOptionsToPackage{varf}{arevmath}}{} + \tf@ifsuboption{oldf}{\tf@mathfontoptions} + {\PassOptionsToPackage{oldf}{arevmath}}{} + \tf@ifsuboption{varl}{\tf@mathfontoptions} + {\PassOptionsToPackage{varl}{arevmath}}{} + \tf@ifsuboption{varu}{\tf@mathfontoptions} + {\PassOptionsToPackage{varu}{arevmath}}{} + \tf@ifsuboption{varv}{\tf@mathfontoptions} + {\PassOptionsToPackage{varv}{arevmath}}{} + \tf@ifsuboption{varw}{\tf@mathfontoptions} + {\PassOptionsToPackage{varw}{arevmath}}{} + \tf@ifsuboption{varGamma}{\tf@mathfontoptions} + {\PassOptionsToPackage{varGamma}{arevmath}}{} + \tf@ifsuboption{varXi}{\tf@mathfontoptions} + {\PassOptionsToPackage{varXi}{arevmath}}{} + \tf@ifsuboption{varPi}{\tf@mathfontoptions} + {\PassOptionsToPackage{varPi}{arevmath}}{} + \tf@ifsuboption{varSigma}{\tf@mathfontoptions} + {\PassOptionsToPackage{varSigma}{arevmath}}{} + \tf@ifsuboption{varPhi}{\tf@mathfontoptions} + {\PassOptionsToPackage{varPhi}{arevmath}}{} + \tf@usefontpackage{arevmath} + \ifthenelse{\equal{\tf@sffont}{\TF@DEFAULT}}{\tf@sffont@arevsans}{} +} + +% Math -- CM Bright +\newtypeface{cmbright}{CM Bright}{math}{ + \tf@loadcmbright +} + +% Math -- Concrete +\newtypeface{concrete}{Concrete Math}{math}{ + \tf@loadconcrete +} + +% Math -- Euler +\newtypeface{euler}{Euler}{math}{ + \tf@ifsuboption{small}{\tf@mathfontoptions} + {\PassOptionsToPackage{small}{eulervm}}{} + \tf@ifsuboption{euler-digits}{\tf@mathfontoptions} + {\PassOptionsToPackage{euler-digits}{eulervm}}{} + \tf@ifsuboption{euler-hat-accent}{\tf@mathfontoptions} + {\PassOptionsToPackage{euler-hat-accent}{eulervm}}{} + \tf@ifsuboption{T1}{\tf@mathfontoptions} + {\PassOptionsToPackage{T1}{eulervm}}{} + \tf@ifsuboption{OT1}{\tf@mathfontoptions} + {\PassOptionsToPackage{OT1}{eulervm}}{} + \tf@ifsuboption{LY1}{\tf@mathfontoptions} + {\PassOptionsToPackage{LY1}{eulervm}}{} + \tf@ifsuboption{icomma}{\tf@mathfontoptions} + {\PassOptionsToPackage{icomma}{eulervm}}{} + \tf@usefontpackage{eulervm} +} + +% Math -- European Modern +%------------------------ +% To obtain: svn checkout files from: +% `http://yytex.googlecode.com/svn/trunk/fonts/em' +% From there, you're on your own! Hint: compile the .ins file. +% FYI, European Modern is a CM clone/extension. Blurb from the readme.txt: +% "The European Modern (EM) font set consists of 57 text fonts that are +% vastly extended versions of Computer Modern (CM) text fonts. Each EM +% text font contains 310 glyphs compared to the 128 in CM text fonts (of +% which eleven are upright Greek letters). Each EM text font has over 90 +% accented characters, including the 58 `standard' ones found in most +% fonts in Type 1 format." +% For what it's worth, European Modern tt was used for typesetting keywords +% in The Latex Companion 2nd ed. Look there for that. +\newtypeface[em]{europeanmodern}{European Modern}{math}{ + \tf@ifsuboption{T1}{\tf@mathfontoptions}{ + \PassOptionsToPackage{T1}{em}}{} + \tf@ifsuboption{LY1}{\tf@mathfontoptions}{ + \PassOptionsToPackage{LY1}{em}}{} + \tf@ifsuboption{LM1}{\tf@mathfontoptions}{ + \PassOptionsToPackage{LM1}{em}}{} + \tf@usefontpackage{em} + \ifthenelse{\equal{\tf@rmfont}{\TF@DEFAULT}}{ + \renewcommand*\rmdefault{cmr} % remapped by em.sty + \tf@rmfont@europeanmodern % housekeeping, e.g., sets rm print name + }{} + \ifthenelse{\equal{\tf@sffont}{\TF@DEFAULT}}{ + \renewcommand*\sfdefault{cmss}% remapped by em.sty + \tf@sffont@europeanmodern % housekeeping, e.g., sets sf print name + }{} + \ifthenelse{\equal{\tf@ttfont}{\TF@DEFAULT}}{ + \renewcommand*\ttdefault{cmtt}% remapped by em.sty + \tf@ttfont@europeanmodern % housekeeping, e.g., sets tt print name + }{} +} + +% Math -- Fourier +\newcommand*\tf@fouriermathfont{} +\newtypeface{fourier}{Fourier}{math}{ + % undefine a few problem symbols that might have + % sneaked in via a previously loaded symbols font + \tf@undefinecommands{\hslash,\complement,\hbar} + + \def\tf@fouriermathfont{adobeutopia} + \ifthenelse{\equal{\tf@rmfont}{newcenturyschoolbook}} + {\def\tf@fouriermathfont{newcenturyschoolbook}}{} + \def\tf@@configurefourieroptions##1{ + \tf@ifsuboption{##1}{\tf@mathfontoptions} + {\def\tf@fouriermathfont{newcenturyschoolbook}}{} + } + \forcsvlist{\tf@@configurefourieroptions}{nc,newcentury,newcenturyschoolbook} + + \def\tf@@configurefourieroptions##1{ + \tf@ifsuboption{##1}{\tf@mathfontoptions} + {\def\tf@fouriermathfont{adobeutopia}}{}% not redundant if \rmdefault==nc + } + \forcsvlist{\tf@@configurefourieroptions}{utopia,adobeutopia} + + \def\tf@@configurefourieroptions##1{ + \tf@ifsuboption{##1}{\tf@mathfontoptions}{ + \ifthenelse{\equal{\tf@fouriermathfont}{adobeutopia}}{ + % NB, user must ensure utopia expert fonts are properly installed. + % Otherwise LaTeX will compile but fail to construct the output file, + % e.g., complaining about missing `put..x.pfb' font file. + \PassOptionsToPackage{##1}{fourier} + }{ + \TF@PackageWarningNoLine{% + Suboption `##1' in package option\MessageBreak + `mathtypeface=\tf@mathfontname'\MessageBreak + will be ignored while `newcenturyschoolbook'\MessageBreak + is in effect} + } + }{} + } + \forcsvlist{\tf@@configurefourieroptions} + {upright,widespace,expert,oldstyle,fulloldstyle} + + \ifthenelse{\equal{\tf@fouriermathfont}{newcenturyschoolbook}}{ + \tf@usefontpackage{fouriernc} + }{ + \tf@usefontpackage{fourier} % loads [T1]{fontenc} and textcomp + \renewcommand*\rmdefault{fut\textfamilyextension} + \ifthenelse{\NOT\equal{\textfamilyextension}{s}}{ + \tf@define@liningfigures{futs} % see comment about expert fonts, above + }{} + } +} + +% Math -- GFS Artemisia +\tf@newbool{tf@@gfsmatheuler}{false} +\newtypeface[artemisia]{gfsartemisia}{GFS Artemisia}{math}{ + % Unlike GFS Didot, GFS Artemisia does not set up math to any + % worthwhile extent. It's only included here for completeness's sake. + \ifthenelse{\equal{\tf@rmfont}{gfsartemisia}}{ + \tf@ifsuboption{euler}{\tf@rmfontoptions}{\booltrue{tf@@gfsmatheuler}}{} + }{} + \tf@ifsuboption{euler}{\tf@mathfontoptions}{\booltrue{tf@@gfsmatheuler}}{} + \ifbool{tf@@gfsmatheuler}{ + \tf@usefontpackage{gfsartemisia-euler} + \xdef\tf@rmprintname{\tf@mathprintname\ (Euler)} + }{ + \tf@usefontpackage{gfsartemisia} % math symbols from txfonts + } + \ifthenelse{\equal{\tf@rmfont}{\TF@DEFAULT}}{\tf@rmfont@gfsartemisia}{} +} + +% Math -- GFS Bodoni +%............................................................................ +% NB, if you run into problems when using T1 font encoding, replace the line: +% \DeclareFontFamily{T1}{bodoni} % <-- missing {} +% with: +% \DeclareFontFamily{T1}{bodoni}{} % <-- reinstated {} +% in file t1bodoni.fd +%............................................................................ +\newtypeface[bodoni]{gfsbodoni}{GFS Bodoni}{math}{ + % Unlike GFS Didot, GFS Bodoni does not set up math to any + % worthwhile extent. It's only included here for completeness's sake. + \tf@usefontpackage{gfsbodoni} + \ifthenelse{\equal{\tf@rmfont}{\TF@DEFAULT}}{\tf@rmfont@gfsbodoni}{} +} + +% Math -- GFS Didot +\newtypeface[didot]{gfsdidot}{GFS Didot}{math}{ + \tf@usefontpackage{gfsdidot} + \ifthenelse{\equal{\tf@rmfont}{\TF@DEFAULT}}{\tf@rmfont@gfsdidot}{} +} + +% Math -- GFS Neohellenic +\newtypeface[neohellenic]{gfsneohellenic}{GFS Neohellenic}{math}{ + % Unlike GFS Didot, except for its oddly shaped digits, GFS + % Neohellenic does not set up math to any worthwhile extent. It's + % only included here for completeness's sake. + \tf@usefontpackage{gfsneohellenic} + \ifthenelse{\equal{\tf@rmfont}{\TF@DEFAULT}}{\tf@rmfont@gfsneohellenic}{} +} + +% Math -- Iwona. NB, the Iwona package sets \rmdefault to Iwona. Specify +% another font in your typeface option if this behaviour is not desired. +\newtypeface{iwona}{Iwona}{math}{ + \newcommand*\tf@iwopt@light{} + \newcommand*\tf@iwopt@condensed{} + \tf@ifsuboption{light}{\tf@mathfontoptions}{ + \renewcommand*\tf@iwopt@light{light} + \xdef\tf@mathprintname{\tf@mathprintname\ Light} + }{} + \tf@ifsuboption{condensed}{\tf@mathfontoptions}{ + \renewcommand*\tf@iwopt@condensed{condensed} + \xdef\tf@mathprintname{\tf@mathprintname\ Condensed} + }{} + \tf@usefontpackage[math,\tf@iwopt@light,\tf@iwopt@condensed]{iwona} +} + +% Math -- Kerkis +\newtypeface{kerkis}{Kerkis}{math}{ + \tf@usefontpackage{kmath} % kmath on its own loads txfonts + \tf@usefontpackage{kerkis} % loads kerkis serif and sans, plus courier mono + \ifthenelse{\equal{\tf@rmfont}{\TF@DEFAULT}}{\tf@rmfont@kerkis}{} +} + +% Math -- Kurier. NB, the Kurier package sets \rmdefault to Kurier. Specify +% another font in your typeface option if this behaviour is not desired. +\newtypeface{kurier}{Kurier}{math}{ + \newcommand*\tf@kropt@light{} + \newcommand*\tf@kropt@condensed{} + \tf@ifsuboption{light}{\tf@mathfontoptions}{ + \renewcommand*\tf@kropt@light{light} + \xdef\tf@mathprintname{\tf@mathprintname\ Light} + }{} + \tf@ifsuboption{condensed}{\tf@mathfontoptions}{ + \renewcommand*\tf@kropt@condensed{condensed} + \xdef\tf@mathprintname{\tf@mathprintname\ Condensed} + }{} + \tf@usefontpackage[math,\tf@kropt@light,\tf@kropt@condensed]{kurier} +} + +% Math -- Kp-Fonts +\newtypeface[kp,kepler]{kpfonts}{}{math}{ + \tf@loadkpfonts +} + +% Math -- Latin Modern +\newtypeface[lm,lmodern]{latinmodern}{Latin Modern}{math}{ + \tf@usefontpackage{lmodern} +} + +% Bigelow and Holmes Lucida Bright (purchase from CTAN) +\newtypeface[lucidabr,lucida]{lucidabright}{Lucida Bright}{math}{ + \tf@loadlucidabr +} + +% Math -- LX Fonts. Extension of Computer Modern Sans Serif Quotation mainly +% as a math enhancement for overhead slides, e.g., with beamer package. +\newtypeface[lx]{lxfonts}{LX Fonts}{math}{ + \tf@usefontpackage{lxfonts} + \ifthenelse{\equal{\tf@symbolsfont}{\TF@DEFAULT}}{ % LX Fonts overrides some + \renewcommand*\tf@symbolsprintname{LX Fonts} % but not all symbols + }{} + \renewcommand*\tf@sfprintname{\tf@rmprintname} + \renewcommand*\tf@ttprintname{\tf@rmprintname}% depends on font encoding T1/OT1 +} + +% Math Design +\newcommand*\tf@mdrmfont{} +\newtypeface{mathdesign}{Math Design}{math}{ + \tf@ifsuboption{expert}{\tf@mathfontoptions} + {\PassOptionsToPackage{expert}{mathdesign}}{} + \tf@ifsuboption{uppercase}{\tf@mathfontoptions}{ + \ifthenelse{\equal{\tf@nextsuboption}{upright}} + {\PassOptionsToPackage{uppercase=upright}{mathdesign}}{} + \ifthenelse{\equal{\tf@nextsuboption}{italicized}} + {\PassOptionsToPackage{uppercase=italicized}{mathdesign}}{} + }{} + \tf@ifsuboption{greekuppercase}{\tf@mathfontoptions}{ + \ifthenelse{\equal{\tf@nextsuboption}{upright}} + {\PassOptionsToPackage{greekuppercase=upright}{mathdesign}}{} + \ifthenelse{\equal{\tf@nextsuboption}{italicized}} + {\PassOptionsToPackage{greekuppercase=italicized}{mathdesign}}{} + }{} + \tf@ifsuboption{greeklowercase}{\tf@mathfontoptions}{ + \ifthenelse{\equal{\tf@nextsuboption}{upright}} + {\PassOptionsToPackage{greeklowercase=upright}{mathdesign}}{} + \ifthenelse{\equal{\tf@nextsuboption}{italicized}} + {\PassOptionsToPackage{greeklowercase=italicized}{mathdesign}}{} + }{} + + \def\tf@mdrmfont{charter}% default; available on all PSNFSS-compliant systems + \ifthenelse{\equal{\tf@rmfont}{urwgaramond}}{\def\tf@mdrmfont{garamond}}{} + \ifthenelse{\equal{\tf@rmfont}{adobeutopia}}{\def\tf@mdrmfont{utopia}}{} + \ifthenelse{\equal{\tf@rmfont}{bitstreamcharter}}{\def\tf@mdrmfont{charter}}{} + \tf@ifsuboption{urwgaramond}{\tf@mathfontoptions}{\def\tf@mdrmfont{garamond}}{} + \tf@ifsuboption{garamond}{\tf@mathfontoptions}{\def\tf@mdrmfont{garamond}}{} + \tf@ifsuboption{adobeutopia}{\tf@mathfontoptions}{\def\tf@mdrmfont{utopia}}{} + \tf@ifsuboption{utopia}{\tf@mathfontoptions}{\def\tf@mdrmfont{utopia}}{} + \tf@ifsuboption{bitstreamcharter}{\tf@mathfontoptions}{\def\tf@mdrmfont{charter}}{} + \tf@ifsuboption{charter}{\tf@mathfontoptions}{\def\tf@mdrmfont{charter}}{} + + \let\oldscdefault\scdefault + \tf@usefontpackage[\tf@mdrmfont,sfscaled=false,ttscaled=false]{mathdesign} + + % Of the three rm fonts accepted by mathdesign (charter, garamond and + % utopia), utopia alone provides old style figures, and this only through + % utopia's smallcaps collection (see below). However, mathdesign hijacks + % smallcaps for its own ends. Rather than 'unhijacking' smallcaps back + % from mathdesign, potentially upsetting anyone who relies on mathdesign's + % smallcaps behaviour, as a design decision, we turn textnums off instead. + % + % NOTE: mathdesign redefines \scdefault in order to provide faked smallcaps + % whenever expert is not in force. This creates problems should the + % user load a non-mathdesign rm font. In which case, we try to + % recover smallcaps as best we can, noting that users should access + % mathdesign (maths mode) smallcaps through its \fscshape command. + % + % Also please note: Native URW Garamond does not provide smallcaps. + \ifthenelse{ + \(\equal{\tf@rmfont}{urwgaramond}\AND\equal{\tf@mdrmfont}{garamond}\)\OR + \(\equal{\tf@rmfont}{adobeutopia}\AND\equal{\tf@mdrmfont}{utopia}\)\OR + \(\equal{\tf@rmfont}{bitstreamcharter}\AND\equal{\tf@mdrmfont}{charter}\)} + {\TF@NativeOSFMathError} + {\let\scdefault\oldscdefault} +} + +% Math -- Mathpazo (aka palatino with pazo math fonts) +\newtypeface[pazo]{mathpazo}{Pazo}{math}{ + \tf@loadmathpazo +} + +% Math -- Math Time Pro 2 +% Michael Spivak's MathTime Pro2 fonts are essential should you plan on using +% Times (or Gyre Termes) body text fonts. Do not for one instant dream of +% using AMS fonts (although you may still need a symbols font, depending on +% your work, for which amssymb or mnsymbol might do). A free (Lite) subset of +% MathTime Pro2 can be downloaded from www.pctex.com (useful for those with +% limited or occasional math requirements for their work). The cost for the +% full set is not especially great compared to the benefits received. +% Trust me. +\newcommand\tf@premtpro{ + % prevent the clash of glyphs (hmm, nice name for a band) + \tf@undefinecommands{ + \barwedge,\centerdot,\circledS,\coloneq,\complement, + \dagger,\ddagger,\divideontimes,\dotplus,\doublebarwedge, + \hbar,\hslash,\mathparagraph,\mathsection,\mathsterling, + \ulcorner,\urcorner,\llcorner,\lrcorner, + \thickapprox,\thicksim,\veebar, + } +} + +\newtypeface[mtpro]{mathtimepro}{MathTime 2 Professional}{math}{ + \tf@ifsuboption{amssymbols}{\tf@mathfontoptions} + {\PassOptionsToPackage{amssymbols}{mtpro2}}{} + \tf@ifsuboption{noamssymbols}{\tf@mathfontoptions} + {\PassOptionsToPackage{noamssymbols}{mtpro2}}{} + \tf@ifsuboption{slantedGreek}{\tf@mathfontoptions} + {\PassOptionsToPackage{slantedGreek}{mtpro2}}{} + \tf@ifsuboption{uprightGreek}{\tf@mathfontoptions} + {\PassOptionsToPackage{uprightGreek}{mtpro2}}{} + \tf@ifsuboption{slantedoperators}{\tf@mathfontoptions} + {\PassOptionsToPackage{slantedoperators}{mtpro2}}{} + \tf@ifsuboption{uprightoperators}{\tf@mathfontoptions} + {\PassOptionsToPackage{uprightoperators}{mtpro2}}{} + % Option subscriptcorrection makes the underscore character '_' active + % which can break other packages. E.g., url typesets \url{a-b} as 'a-_b'. + \tf@ifsuboption{subscriptcorrection}{\tf@mathfontoptions} + {\PassOptionsToPackage{subscriptcorrection}{mtpro2}}{} + \tf@ifsuboption{nosubscriptcorrection}{\tf@mathfontoptions} + {\PassOptionsToPackage{nosubscriptcorrection}{mtpro2}}{} + \tf@ifsuboption{zswash}{\tf@mathfontoptions} + {\PassOptionsToPackage{zswash}{mtpro2}}{} + \tf@ifsuboption{nozswash}{\tf@mathfontoptions} + {\PassOptionsToPackage{nozswash}{mtpro2}}{} + \tf@ifsuboption{curlybraces}{\tf@mathfontoptions} + {\PassOptionsToPackage{curlybraces}{mtpro2}}{} + \tf@ifsuboption{straightbraces}{\tf@mathfontoptions} + {\PassOptionsToPackage{straightbraces}{mtpro2}}{} + \tf@ifsuboption{morphedbraces}{\tf@mathfontoptions} + {\PassOptionsToPackage{morphedbraces}{mtpro2}}{} + \tf@ifsuboption{cmcal}{\tf@mathfontoptions} + {\PassOptionsToPackage{cmcal}{mtpro2}}{} + \tf@ifsuboption{lucidacal}{\tf@mathfontoptions} + {\PassOptionsToPackage{lucidacal}{mtpro2}}{} + \tf@ifsuboption{eucal}{\tf@mathfontoptions} + {\PassOptionsToPackage{eucal}{mtpro2}}{} + \tf@ifsuboption{mtpluscal}{\tf@mathfontoptions} + {\PassOptionsToPackage{mtpluscal}{mtpro2}}{} + \tf@ifsuboption{mtpcal}{\tf@mathfontoptions} + {\PassOptionsToPackage{mtpcal}{mtpro2}}{} + \tf@ifsuboption{mtpccal}{\tf@mathfontoptions} + {\PassOptionsToPackage{mtpccal}{mtpro2}}{} + \tf@ifsuboption{lucidascr}{\tf@mathfontoptions} + {\PassOptionsToPackage{lucidascr}{mtpro2}}{} + \tf@ifsuboption{mtplusscr}{\tf@mathfontoptions} + {\PassOptionsToPackage{mtplusscr}{mtpro2}}{} + \tf@ifsuboption{mtpscr}{\tf@mathfontoptions} + {\PassOptionsToPackage{mtpscr}{mtpro2}}{} + \tf@ifsuboption{eufrak}{\tf@mathfontoptions} + {\PassOptionsToPackage{eufrak}{mtpro2}}{} + \tf@ifsuboption{mtpfrak}{\tf@mathfontoptions} + {\PassOptionsToPackage{mtpfrak}{mtpro2}}{} + \tf@ifsuboption{compatiblegreek}{\tf@mathfontoptions} + {\PassOptionsToPackage{compatiblegreek}{mtpro2}}{} + \tf@ifsuboption{amsbb}{\tf@mathfontoptions} + {\PassOptionsToPackage{amsbb}{mtpro2}}{} + \tf@ifsuboption{mtpbb}{\tf@mathfontoptions} + {\PassOptionsToPackage{mtpbb}{mtpro2}}{} + \tf@ifsuboption{mtpbbd}{\tf@mathfontoptions} + {\PassOptionsToPackage{mtpbbd}{mtpro2}}{} + \tf@ifsuboption{mtphrb}{\tf@mathfontoptions} + {\PassOptionsToPackage{mtphrb}{mtpro2}}{} + \tf@ifsuboption{mtphrd}{\tf@mathfontoptions} + {\PassOptionsToPackage{mtphrd}{mtpro2}}{} + \tf@ifsuboption{mtpbbi}{\tf@mathfontoptions} + {\PassOptionsToPackage{mtpbbi}{mtpro2}}{} + \tf@ifsuboption{mtphbi}{\tf@mathfontoptions} + {\PassOptionsToPackage{mtphbi}{mtpro2}}{} + \tf@ifsuboption{errorshow}{\tf@mathfontoptions} + {\PassOptionsToPackage{errorshow}{mtpro2}}{} + \tf@ifsuboption{warningshow}{\tf@mathfontoptions} + {\PassOptionsToPackage{warningshow}{mtpro2}}{} + \tf@ifsuboption{nofontinfo}{\tf@mathfontoptions} + {\PassOptionsToPackage{nofontinfo}{mtpro2}}{} + \tf@ifsuboption{lite}{\tf@mathfontoptions}{ % NB, 'lite', not 'light' + \tf@premtpro + \tf@usefontpackage[lite]{mtpro2} + \xdef\tf@rmprintname{\tf@mathprintname\ Lite} + }{ + \tf@undefinecommands{\Bbbk} % prevent the clash of glyphs + \tf@premtpro + \tf@usefontpackage[complete]{mtpro2} + } +} + +% Math -- Adobe Minion Pro +\newtypeface{adobeminionpro}{Adobe Minion Pro}{math}{ + \tf@loadadobeminionpro +} + +% Math -- MathPTMX +\newtypeface[ptmx]{mathptmx}{Math PTMX}{math}{ + \tf@usefontpackage{mathptmx} + \ifthenelse{\equal{\tf@rmfont}{\TF@DEFAULT}}{ + \tf@rmfont@times + }{} +} + +% Math -- PXFonts +\newtypeface[px]{pxfonts}{PX Fonts}{math}{ + \tf@usefontpackage{pxfonts} +} + +% Math -- TXFonts +\newtypeface[tx]{txfonts}{TX Fonts}{math}{ + \tf@loadtxfonts +} + +% Roman family typeface -- somewhat sensitive to font load +% ordering, particularly if loaded via font packages rather +% than by directly setting \rmdefault +% ========================================================= +\TF@PackageDebugInfo{Configuring rm load commands...} + +% Default -- no-op +\newtypeface{\TF@DEFAULT}{}{rm}{ + \ifthenelse{\equal{\tf@rmprintname}{undefined}}{ + \renewcommand*\tf@rmprintname{\TF@DEFAULTPRINTNAME} + \TF@NativeOSFError + }{} +} + +% ADF Baskervald +\newtypeface[baskervald]{adfbaskervald}{ADF Baskervald}{rm}{ + \tf@ifsuboption{lig}{\tf@rmfontoptions} + {\renewcommand*\rmdefault{ybvw}} + {\renewcommand*\rmdefault{ybv}} + \DeclareTextSymbol{\zeroslash}{TS1}{225} + \DeclareTextSymbolDefault{\zeroslash}{TS1} + \TF@NativeOSFError + \tf@pdfglyphcorrection{Baskervald} +} + +% ADF Berenis -- sets font encoding to LY1 -- might have +% consequences for sf/tt/math typeface choices +\newtypeface[berenis]{adfberenis}{ADF Berenis}{rm}{ + \tf@ifsuboption{tab}{\tf@rmfontoptions} % default is proportional figures + {\PassOptionsToPackage{tab}{berenis}}{} % otherwise, use tabular numbers + \tf@ifsuboption{lig}{\tf@rmfontoptions} + {\PassOptionsToPackage{lig}{berenis}}{} % oldstyle extra ligatures + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@JF}}{ + \PassOptionsToPackage{osf}{berenis} + \tf@ifsuboption{tab}{\tf@rmfontoptions} + {\tf@define@liningfigures{ybd}} + {\tf@define@liningfigures{ybd2}} + }{ + \PassOptionsToPackage{lf}{berenis} + } + \tf@usefontpackage[lm]{berenis} + % ADF Berenis (without lm above) loads latin modern + \ifthenelse{\equal{\tf@sffont}{\TF@DEFAULT}}{\tf@sffont@latinmodern}{} + \ifthenelse{\equal{\tf@ttfont}{\TF@DEFAULT}}{\tf@ttfont@latinmodern}{} +} + +% ADF Electrum +\newtypeface[electrum]{adfelectrum}{ADF Electrum}{rm}{ + \tf@ifsuboption{lig}{\tf@rmfontoptions} + {\PassOptionsToPackage{lig}{electrum}}{} % oldstyle extra ligatures + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@JF}}{ + \PassOptionsToPackage{osf}{electrum} + \tf@define@liningfigures{yes} + }{ + \PassOptionsToPackage{lf}{electrum} + } + \tf@usefontpackage{electrum} +} + +% ADF Romande +\newtypeface[romande]{adfromande}{ADF Romande}{rm}{ + \tf@ifsuboption{alt}{\tf@rmfontoptions} + {\PassOptionsToPackage{alt}{romande}}{} + \tf@usefontpackage{romande} + \TF@NativeOSFError % Romande's figures are a sort of hybrid LF/OSF +} + +% ADF Venturis -- including ADF Venturis 2 and ADF Venturis Old +\newtypeface[venturis]{adfventuris}{ADF Venturis}{rm}{ + \tf@newbool{tf@rm@venturisii}{false} + \tf@newbool{tf@rm@venturisold}{false} + + \tf@ifsuboption{2}{\tf@rmfontoptions}{\booltrue{tf@rm@venturisii}}{} + \tf@ifsuboption{old}{\tf@rmfontoptions}{\booltrue{tf@rm@venturisold}}{} + + \ifthenelse{\boolean{tf@rm@venturisii}\AND\boolean{tf@rm@venturisold}}{ + \TF@PackageError{Incompatible typeface suboptions:\MessageBreak + \space\space`typeface=\tf@rmfontname'\MessageBreak + Removed `old' suboption}{} + \renewcommand*\tf@rmfontname{\tf@rmfont:2} + \renewcommand*\tf@rmfontoptions{2} + \boolfalse{tf@rm@venturisold} + }{} + \ifthenelse{\boolean{tf@rm@venturisii}}{ + \tf@usefontpackage{venturis2} + \renewcommand*\tf@rmprintname{ADF Venturis 2} + \TF@NativeOSFError + % ADF Venturis loads venturis sans + \ifthenelse{\equal{\tf@sffont}{\TF@DEFAULT}}{\tf@sffont@adfventuris}{} + }{ + \ifthenelse{\boolean{tf@rm@venturisold}}{ + \tf@usefontpackage{venturisold} + \renewcommand*\tf@rmprintname{ADF Venturis Old} + \TF@NativeOSFError + }{ + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@JF}}{ + \tf@usefontpackage[osf]{venturis} + \tf@define@liningfigures{yvt} + }{ + \tf@usefontpackage[lf]{venturis} + } + % ADF Venturis loads venturis sans + \ifthenelse{\equal{\tf@sffont}{\TF@DEFAULT}}{\tf@sffont@adfventuris}{} + } + } +} + +% Adobe Minion Pro +\newtypeface[minionpro]{adobeminionpro}{Adobe Minion Pro}{rm}{ + \tf@loadadobeminionpro +} + +% Adobe Utopia +\newtypeface[utopia]{adobeutopia}{Adobe Utopia}{rm}{ + \ifthenelse{\equal{\tf@mathfont}{mathdesign} + \AND\equal{\tf@mdrmfont}{utopia}}{ + % \rmdefault was configured in \tf@mathfont@mathdesign + \renewcommand*\tf@rmprintname{Math Design Utopia} + }{ + \ifthenelse{\equal{\tf@mathfont}{fourier} + \AND\equal{\tf@fouriermathfont}{adobeutopia}}{ + % \rmdefault was configured in \tf@mathfont@fourier + }{ + \renewcommand*\rmdefault{put} + \tf@SCencodedosf + } + } +} + +% AE -- "Almost European" Computer Modern +\newtypeface{ae}{AE}{rm}{ + \tf@ifsuboption{slides}{\tf@rmfontoptions}{ + \renewcommand*\rmdefault{laess} % ``sans roman'' with slides + \renewcommand*\tf@rmprintname{AE Sans} + }{ + \renewcommand*\rmdefault{aer} + } + \tf@TSencodedosf + \ifthenelse{\equal{\tf@sffont}{\TF@DEFAULT}}{\tf@sffont@ae}{} + \ifthenelse{\equal{\tf@ttfont}{\TF@DEFAULT}}{\tf@ttfont@ae}{} +} + +% Antykwa Poltawskiego +\newtypeface[antpol,poltawski]{antykwapoltawski}{Antykwa P\'o\l tawskiego}{rm}{ + \tf@ifsuboption{light}{\tf@rmfontoptions}{ + \renewcommand*\rmdefault{antpl} + \xdef\tf@rmprintname{\tf@rmprintname\ Light} + }{ + \renewcommand*\rmdefault{antp} + } + \tf@SCencodedosf +} + +% Antykwa Torunska +\newtypeface[anttor,torunska]{antykwatorunska}{}{rm}{ + \tf@loadantykwatorunska +} + +% Augie +\newtypeface{augie}{Augie}{rm}{ + \renewcommand*\rmdefault{augie} + \TF@NativeOSFError +} + +% Auriocus Kalligraphicus -- decorative script +% Provides the fonts: Auriocus Kalligraphicus, Lukas Svatba (plus +% Amici variant) and Jana Skrivana, accessed via the \Fontauri, +% \Fontlukas, \Fontskrivan and \Fontamici commands +\newtypeface[auriocus,kalligraphicus]{auriocuskalligraphicus} + {Auriocus Kalligraphicus}{rm}{ + \tf@ifsuboption{backslant}{\tf@rmfontoptions} + {\tf@usefontpackage[backslant]{aurical}} + {\tf@usefontpackage{aurical}} + \TF@NativeLFError % rare! + \renewcommand*\rmdefault{AuriocusKalligraphicus} +} + +% Bera Serif +\newtypeface[bera]{beraserif}{Bera Serif}{rm}{ + \tf@usefontpackage{beraserif} + \TF@NativeOSFError +} + +% Bitstream Charter +\newtypeface[charter]{bitstreamcharter}{Bitstream Charter}{rm}{ + \ifthenelse{\equal{\tf@mathfont}{mathdesign} + \AND\equal{\tf@mdrmfont}{charter}}{ + % \rmdefault was configured in \tf@mathfont@mathdesign + \renewcommand*\tf@rmprintname{Math Design Charter} + }{ + \renewcommand*\rmdefault{bch} + } + \TF@NativeOSFError +} + +% Computer Modern (the `fix-cm' proxies -- font encoding dependent) +\newtypeface[cm,cmr]{computermodern}{Computer Modern}{rm}{ + \@ifpackageloaded{fix-cm}{\relax}{ + %-- NB, from `fixltx2e' documentation (which we ignore) ----------------- + % The package should be loaded before \documentclass, using the command + % \RequirePackage{fix-cm}, rather than the normal \usepackage. Rationale: + % If the package is loaded in the preamble, a preceding package or even + % the code of the document class may have used any of the CM fonts + % already. However, the definitions of those fonts, that are already in + % use, cannot be changed any more. + % + % Rationale for our not observing this guideline: we don't have + % programmatic control over the user's code writing. The best we can + % do is load `fix-cm' here then issue some advice about the matter. + %------------------------------------------------------------------------ + \usepackage{fix-cm} + \TF@PackageWarningNoLine{% + If you must set typeface to Computer Modern, please\MessageBreak + include \string\RequirePackage{fix-cm}\space before the\MessageBreak + \string\documentclass\space line in your code. See `fixltx2e'\MessageBreak + package documentation for an explanation. Doing so\MessageBreak + will make this warning go away. (Note that it is\MessageBreak + \string\RequirePackage{fix-cm}, not \string\usepackage{fix-cm}.)% + } + } + \renewcommand*\rmdefault{cmr} + \tf@TSencodedosf +} + +% CM Bright (sans serif as a Roman font) +\newtypeface{cmbright}{CM Bright}{rm}{ + \tf@loadcmbright +} + +% CM Dunhill +\newtypeface{cmdunhill}{CM Dunhill}{rm}{ + \renewcommand*\rmdefault{cmdh} + \tf@TSencodedosf +} + +% CM Fibonacci +\newtypeface{cmfibonacci}{CM Fibonacci}{rm}{ + \renewcommand*\rmdefault{cmfib} + \tf@TSencodedosf +} + +% Concrete +\newtypeface{concrete}{Concrete}{rm}{ + \tf@loadconcrete +} + +% Day Roman +\newtypeface[dayroman]{dayrom}{Day Roman}{rm}{ + \tf@ifsuboption{s}{\tf@rmfontoptions}{ + % with `long s' and additional c-t ligature + \renewcommand*\rmdefault{dayroms} + \xdef\tf@rmprintname{\tf@rmprintname\ S} + }{ + \renewcommand*\rmdefault{dayrom} + } + \TF@NativeLFError % rare! +} + +% DejaVu +\newtypeface{dejavu}{DejaVu}{rm}{ + % NB, scaling DejaVu does not affect baselineskip + \tf@newbool{tf@dejavu@scaled}{false} + \tf@ifsuboption{scaled}{\tf@rmfontoptions} + {\booltrue{tf@dejavu@scaled}} + {\tf@ifsuboption{scale}{\tf@rmfontoptions}{\booltrue{tf@dejavu@scaled}}{}} + \ifbool{tf@dejavu@scaled}{ + \ifthenelse{\ispositiverealnumber{\tf@nextsuboption}} + {\xdef\tf@rmscale{\tf@nextsuboption}} + {\renewcommand*\tf@rmscale{0.95}} % DejaVu package default + }{} + + \newcommand*\tf@dejavu@package{DejaVuSerif} + \tf@ifsuboption{condensed}{\tf@rmfontoptions}{ + \renewcommand*\tf@dejavu@package{DejaVuSerifCondensed} + \xdef\tf@rmprintname{\tf@rmprintname\ Condensed} + }{} + \ifbool{tf@dejavu@scaled} + {\PassOptionsToPackage{scaled=\tf@rmscale}{\tf@dejavu@package}}{} + \tf@usefontpackage{\tf@dejavu@package} + \TF@NativeOSFError +} + +% Droid +\newtypeface{droid}{Droid}{rm}{ + \renewcommand*\rmdefault{fdr} + \TF@NativeOSFError +} + +% % Epigrafica -- not yet ready for prime time +% \newtypeface{epigrafica}{Epigrafica}{rm}{ +% \tf@usefontpackage{epigrafica} +% \tf@TSencodedosf +% } + +% European Modern +% European Modern presents a problem by encapsulating its font declarations +% alongside math declarations within the style file rather than in separate +% fd files. Given our default math -> rm -> sf -> tt font loading order, we'd +% be in trouble if the user wanted, say, sf European Modern together with some +% arbitrary non European Modern math. To sidestep this, we extract and +% execute only the font declarations from the European Modern package. +\newtypeface[em]{europeanmodern}{European Modern}{rm}{ + % TODO: errmsg non-T1 encoding + \ifthenelse{\equal{\tf@mathfont}{europeanmodern}}{ + % our europeanmodern math font handler has already done the required work + }{ + \expandafter\let\csname T1/cmr/m/n/10\endcsname\@undefined + \global\defaulthyphenchar=127 + \DeclareFontFamily{T1}{cmr}{} + \DeclareFontShape{T1}{cmr}{m}{n}{ + <-6> emr5 <6-7> emr6 <7-8> emr7 <8-9> emr8 + <9-10> emr9 <10-12> emr10 <12-17> emr12 <17-> emr17 }{} + \DeclareFontShape{T1}{cmr}{m}{sl}{ + <-9> emsl8 <9-10> emsl9 <10-12> emsl10 <12-> emsl12 }{} + \DeclareFontShape{T1}{cmr}{m}{it}{ + <-8> emti7 <8-9> emti8 <9-10> emti9 <10-12> emti10 <12-> emti12}{} + \DeclareFontShape{T1}{cmr}{m}{sc}{ + <-9> emcsc8 <9-10> emcsc9 <10-> emcsc10}{} + \DeclareFontShape{T1}{cmr}{m}{ui}{<-> emu10}{} + \DeclareFontShape{T1}{cmr}{b}{n} {<-> emb10}{} + \DeclareFontShape{T1}{cmr}{bx}{n}{ + <-6> embx5 <6-7> embx6 <7-8> embx7 <8-9> embx8 + <9-10> embx9 <10-12> embx10 <12-> embx12}{} + \DeclareFontShape{T1}{cmr}{bx}{sl}{<-> embxsl10}{} + \DeclareFontShape{T1}{cmr}{bx}{it}{<-> embxti10}{} + \DeclareFontShape{T1}{cmr}{bx}{ui}{<-> emu10}{} + \renewcommand*\rmdefault{cmr} + } + \tf@TSencodedosf +} + + +% GFS Artemisia +\newtypeface[artemisia]{gfsartemisia}{GFS Artemisia}{rm}{ + \ifthenelse{\equal{\tf@mathfont}{\TF@DEFAULT}}{\tf@mathfont@gfsartemisia}{} + \ifthenelse{\equal{\tf@mathfont}{gfsartemisia}}{ + \tf@ifsuboption{euler}{\tf@mathfontoptions}{\booltrue{tf@@gfsmatheuler}}{} + }{} + \tf@ifsuboption{euler}{\tf@rmfontoptions}{\booltrue{tf@@gfsmatheuler}}{} + \ifbool{tf@@gfsmatheuler}{ + \renewcommand*\rmdefault{artemisiaeuler} + \xdef\tf@rmprintname{\tf@rmprintname\ (Euler)} + }{ + \renewcommand*\rmdefault{artemisia} + } + \tf@SCencodedosf + % GFS Artemisia loads txfonts, which sets \sfdefault and \ttdefault + \ifthenelse{\equal{\tf@sffont}{\TF@DEFAULT}}{\tf@sffont@txfonts}{} + \ifthenelse{\equal{\tf@ttfont}{\TF@DEFAULT}}{\tf@ttfont@txfonts}{} +} + +% GFS Bodoni +% ---------------------------------------------------- +% See the comment with math gfsbodoni, if you run into +% problems when using T1 font encoding +% ---------------------------------------------------- +\newtypeface[bodoni]{gfsbodoni}{GFS Bodoni}{rm}{ + \ifthenelse{\equal{\tf@mathfont}{\TF@DEFAULT}}{\tf@mathfont@gfsbodoni}{} + \renewcommand*\rmdefault{bodoni} + \tf@SCencodedosf +} + +% GFS Didot +\newtypeface[didot]{gfsdidot}{GFS Didot}{rm}{ + \ifthenelse{\equal{\tf@mathfont}{\TF@DEFAULT}}{\tf@mathfont@gfsdidot}{} + \renewcommand*\rmdefault{udidot} + \tf@SCencodedosf + % GFS Didot loads pxfonts, which sets \sfdefault and \ttdefault + \ifthenelse{\equal{\tf@sffont}{\TF@DEFAULT}}{\tf@sffont@pxfonts}{} + \ifthenelse{\equal{\tf@ttfont}{\TF@DEFAULT}}{\tf@ttfont@pxfonts}{} +} + +% GFS Neohellenic +\newtypeface[neohellenic]{gfsneohellenic}{GFS Neohellenic}{rm}{ + \renewcommand*\rmdefault{neohellenic} + \tf@ifsuboption{symbols}{\tf@rmfontoptions}{ + \DeclareSymbolFont{letters}{OML}{neohellenic}{m}{it} + \ifthenelse{\equal{\tf@symbolsfont}{\TF@DEFAULT}}{ + \renewcommand*\tf@symbolsprintname{GFS Neohellenic} + }{} + }{} + \ifthenelse{\equal{\tf@mathfont}{\TF@DEFAULT}}{\tf@mathfont@gfsneohellenic}{} + \tf@SCencodedosf + % GFS Neohellenic loads sets \sfdefault + \ifthenelse{\equal{\tf@sffont}{\TF@DEFAULT}}{\tf@sffont@gfsneohellenic}{} +} + +% Gyre Bonum +\newtypeface[bonum,tgbonum]{gyrebonum}{Gyre Bonum}{rm}{ + \tf@usefontpackage{tgbonum} + \tf@TSencodedosf +} + +% Gyre Pagella +\newtypeface[pagella,tgpagella]{gyrepagella}{Gyre Pagella}{rm}{ + \tf@usefontpackage{tgpagella} + \tf@TSencodedosf +} + +% Gyre Schola +\newtypeface[schola,tgschola]{gyreschola}{Gyre Schola}{rm}{ + \tf@usefontpackage{tgschola} + \tf@TSencodedosf +} + +% Gyre Termes +\newtypeface[termes,tgtermes]{gyretermes}{Gyre Termes}{rm}{ + \tf@usefontpackage{tgtermes} + \tf@TSencodedosf +} + +% Iwona +\newtypeface{iwona}{Iwona}{rm}{ + \renewcommand*\rmdefault{iwona} + \tf@ifsuboption{light}{\tf@rmfontoptions}{ + \xdef\rmdefault{\rmdefault l} + \xdef\tf@rmprintname{\tf@rmprintname\ Light} + }{} + \tf@ifsuboption{condensed}{\tf@rmfontoptions}{ + \xdef\rmdefault{\rmdefault c} + \xdef\tf@rmprintname{\tf@rmprintname\ Condensed} + }{} + \tf@TSencodedosf +} + +% Journal d'Analyse Mathematique expanded Times Roman font. +% NB, while JAM Times generates a more spacious and consequently rather +% attractive rendition of Times Roman, it cooperates poorly with (non-Belleek) +% maths and symbols fonts, leading to many compile time warnings, especially +% the innocuous but annoying 'LaTeX Font Warning: Font shape `xxx' will be +% scaled' (even when compiling jamtimes' own mathsample.tex file). +\newtypeface[jam]{jamtimes}{JAM Times}{rm}{ + \tf@usefontpackage[scaled=1,sfscaled=1,amsfontsscaled=1]{jamtimes} + \ifthenelse{\equal{\tf@sffont}{\TF@DEFAULT}}{\tf@sffont@helvetica}{} + \ifthenelse{\equal{\tf@ttfont}{\TF@DEFAULT}}{\tf@ttfont@courier}{} + \TF@NativeOSFError +} + +% Kurier +\newtypeface{kurier}{Kurier}{rm}{ + \renewcommand*\rmdefault{kurier} + \tf@ifsuboption{light}{\tf@rmfontoptions}{ + \xdef\rmdefault{\rmdefault l} + \xdef\tf@rmprintname{\tf@rmprintname\ Light} + }{} + \tf@ifsuboption{condensed}{\tf@rmfontoptions}{ + \xdef\rmdefault{\rmdefault c} + \xdef\tf@rmprintname{\tf@rmprintname\ Condensed} + }{} + \tf@TSencodedosf +} + +% Kerkis (the latin parts are essentially URW Bookman, +% of which, also consider Gyre Bonum) +\newtypeface{kerkis}{Kerkis}{rm}{ + \ifthenelse{\equal{\tf@mathfont}{\TF@DEFAULT}}{\tf@mathfont@kerkis}{} + \renewcommand*\rmdefault{mak} + \ifthenelse{\equal{\tf@sffont}{\TF@DEFAULT}}{\tf@sffont@kerkis}{} + \ifthenelse{\equal{\tf@ttfont}{\TF@DEFAULT}}{\tf@ttfont@courier}{} + \tf@TSencodedosf +} + +% Kp-Fonts +\newtypeface[kp,kepler]{kpfonts}{}{rm}{ + \tf@loadkpfonts +} + +% Latin Modern +\newtypeface[lm,lmodern]{latinmodern}{Latin Modern}{rm}{ + \renewcommand*\rmdefault{lmr} + % lm doesn't supply bold smallcaps, provide an + % option to source them from cm instead + \tf@ifsuboption{boldsc}{\tf@rmfontoptions}{ + \normalfont + \DeclareFontShape{T1}{lmr}{bx}{sc} % NB, T1 only % TODO: other lm encodings + {<->ssub*cmr/bx/sc}{} % Note, no scaling (should be v. close) + }{} + \tf@TSencodedosf +} + +% Libertine +%------------------------------------------------------------------------------ +% NOTE! Around December 2011, the package author deprecated type1 libertine +% fonts in favour of otf format. To use type1 libertine (this might be wrong +% -- be sure to read the the latest libertine documentation if in any doubt): +% i. if you also want to access libertine otf, +% a. install the latest version of the libertine package, +% b. rename (or delete) the new libertine.sty (dummy) file, +% c. then re-texhash your system. +% ii. uninstall the libertine package, install the libertine-legacy package +% (containing the type1 font files as well as the version of the +% libertine.sty file that we want to use). +%------------------------------------------------------------------------------ +% NB, loads in biolinum (sf) font with matching OsF configuration. This will +% only be noticeable if (a) the `sanstypeface' option is implicitly or +% explicitly set to default, or (b), in the rare event of configuring option +% `fontloadorder=...sf...rm...' +% If case (a), you can override the matching OsF behaviour by explicitly +% setting option `sanstypeface=biolinum' --> lining figures, or +% setting option `sanstypeface=biolinum:osf' --> OsF. The joy. +\newtypeface{libertine}{Libertine}{rm}{ + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@JF}}{ + \PassOptionsToPackage{osf}{libertine} + \tf@define@liningfigures{fxl} + }{} + \tf@usefontpackage{libertine} + \tf@pdfglyphcorrection{Libertine} + \renewcommand*\tf@sfprintname{Biolinum} % included in libertine package +} + +% Bigelow and Holmes Lucida Bright (purchase from CTAN) +\newtypeface[lucidabr,lucida]{lucidabright}{Lucida Bright}{rm}{ + \tf@loadlucidabr +} + +% New Century Schoolbook +\newtypeface[nc,newcentury]{newcenturyschoolbook}{New Century Schoolbook}{rm}{ + \ifthenelse{\equal{\tf@mathfont}{fourier} + \AND\equal{\tf@fouriermathfont}{newcenturyschoolbook}}{ + % \rmdefault was configured in \tf@mathfont@fourier + }{ + \tf@usefontpackage{newcent} % loads pnc, pag, pcr + } + \TF@NativeOSFError +} + +% Palatino +\newtypeface{palatino}{Palatino}{rm}{ + \ifthenelse{\equal{\tf@mathfont}{\TF@DEFAULT}}{ + \tf@loadmathpazo + }{ + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@JF}}{ + \renewcommand*\rmdefault{pplj} + \tf@define@liningfigures{pplx} + }{ + \renewcommand*\rmdefault{pplx} + } + \tf@define@oldstylenums@cmd{pplj} + } +} + +% Paratype PT Serif +\newtypeface[pt,paratype]{ptserif}{PT Serif}{rm}{ + \tf@usefontpackage{PTSerif} + \TF@NativeOSFError + \ifthenelse{\equal{\tf@sffont}{\TF@DEFAULT}}{\tf@sffont@ptsans}{} + % don't take this approach if tt is not specified since PTMono + % is unlikely to be installed. If it is and that's what's + % wanted for tt, then users can explicitly say so by including + % monotypeface=ptmono among their package options. +} + +% PXFonts +\newtypeface[px]{pxfonts}{PX Fonts}{rm}{ + \ifthenelse{\equal{\tf@mathfont}{\TF@DEFAULT}} + {\tf@usefontpackage{pxfonts}} + {\renewcommand*\rmdefault{pxr}} + \tf@TSencodedosf + % PX Fonts sets \sfdefault and \ttdefault + \ifthenelse{\equal{\tf@sffont}{\TF@DEFAULT}}{\tf@sffont@pxfonts}{} + \ifthenelse{\equal{\tf@ttfont}{\TF@DEFAULT}}{\tf@ttfont@pxfonts}{} +} + +% Times Roman (faked smallcaps & oldstyle figures only if txfonts gets loaded) +\newtypeface{times}{Times Roman}{rm}{ + \ifthenelse{\equal{\tf@mathfont}{\TF@DEFAULT} + \OR\equal{\tf@mathfont}{amsfonts}}{ + \tf@usefontpackage[varg]{txfonts} + \tf@TSencodedosf + }{ + \renewcommand*\rmdefault{ptm} + \TF@NativeOSFMathError + } +} + +% TXFonts +\newtypeface[tx]{txfonts}{TX Fonts}{rm}{ + \tf@loadtxfonts +} + +% Uncial -- for 6th to the 10th century manuscripts +% NB, requires B1 font encoding (i.e., you also need to have +% installed: b1enc.def, b1cmr.fd, and maybe TeXB1.enc) +\newtypeface{uncial}{Artificial Uncial}{rm}{ + \tf@usefontpackage{allauncl} + \TF@NativeOSFError +} + +% URW Antiqua +\newtypeface[antiqua]{urwantiqua}{URW Antiqua}{rm}{ + \renewcommand*\rmdefault{uaq} + \TF@NativeOSFError +} + +% URW Bookman +\newtypeface[bookman]{urwbookman}{URW Bookman}{rm}{ + \tf@usefontpackage{bookman} + \TF@NativeOSFError +} + +% URW Garamond -- NB, does not natively provide smallcaps +\newtypeface[garamond]{urwgaramond}{URW Garamond}{rm}{ + \ifthenelse{\equal{\tf@mathfont}{mathdesign} + \AND\equal{\tf@mdrmfont}{garamond}}{ + % \rmdefault was configured in \tf@mathfont@mathdesign + \renewcommand*\tf@rmprintname{Math Design Garamond} + }{ + \renewcommand*\rmdefault{ugm} + } + \TF@NativeOSFError +} + +% URW Nimbus +\newtypeface[nimbus]{urwnimbus}{URW Nimbus}{rm}{ + \renewcommand*\rmdefault{unm} + \tf@TSencodedosf +} + +% Zapf Chancery +\newtypeface[chancery,zapf]{zapfchancery}{Zapf Chancery}{rm}{ + \renewcommand*\rmdefault{pzc} + \TF@NativeOSFError +} + +% Sans serif fonts -- somewhat sensitive to font load ordering, +% particularly if loaded via a font package in the code below +% ============================================================= +\TF@PackageDebugInfo{Configuring sf load commands...} + +% Default -- no-op +\newtypeface{\TF@DEFAULT}{}{sf}{ + \ifthenelse{\equal{\tf@sfprintname}{undefined}}{ + \renewcommand*\tf@sfprintname{\TF@DEFAULTPRINTNAME} + }{} +} + +\newtypeface[libris]{adflibris}{ADF Libris}{sf}{ + % requires reworked .fd file to accommodate load time scaling + \RequirePackage{nfssext-cfr}% see libris doc for \swashstyle & \textswash + \renewcommand*\sfdefault{yly} + \renewcommand*\tf@sfprintname{ADF Libris} +} + +\newtypeface[venturis]{adfventuris}{ADF Venturis Sans}{sf}{ + % requires reworked .fd file to accommodate load time scaling + \tf@newbool{tf@@venturisii}{false} + \ifthenelse{\equal{\tf@rmfont}{adfventuris}}{ + \tf@ifsuboption{2}{\tf@rmfontoptions}{\booltrue{tf@@venturisii}}{} + }{} + \tf@ifsuboption{2}{\tf@sffontoptions}{\booltrue{tf@@venturisii}}{} + \ifbool{tf@@venturisii}{ + \renewcommand*\sfdefault{yv3} + \renewcommand*\tf@sfprintname{ADF Venturis 2 Sans} + }{ + \renewcommand*\sfdefault{yv1} + } +} + +\newtypeface{ae}{AE Sans}{sf}{ + % requires reworked .fd file to accommodate load time scaling + \renewcommand*\sfdefault{aess} + \ifthenelse{\equal{\tf@rmfont}{ae}}{ + \tf@ifsuboption{slides}{\tf@rmfontoptions} + {\renewcommand*\sfdefault{laess}}{} + }{} + \ifthenelse{\equal{\tf@ttfont}{ae}}{ + \tf@ifsuboption{slides}{\tf@ttfontoptions} + {\renewcommand*\sfdefault{laess}}{} + }{} + \tf@ifsuboption{slides}{\tf@sffontoptions} + {\renewcommand*\sfdefault{laess}}{} +} + +\newtypeface[arev]{arevsans}{Arev Sans}{sf}{ + \ifthenelse{\equal{\tf@mathfont}{\TF@DEFAULT}}{\tf@mathfont@arevmath}{} + % requires reworked .fd file to accommodate load time scaling + \renewcommand*\sfdefault{fav} +} + +\newtypeface{augie}{Augie}{sf}{ + % requires reworked .fd file to accommodate load time scaling + \renewcommand*\sfdefault{augie} +} + +\newtypeface{avantgarde}{Avant Garde}{sf}{ + % requires reworked .fd file to accommodate load time scaling + \tf@usefontpackage{avant} +} + +\newtypeface[bera]{berasans}{Bitstream Vera Sans}{sf}{ + \scaletypeface{sf}{\PassOptionsToPackage{scaled=\tf@sfscalefactor}{berasans}} + \tf@usefontpackage{berasans} +} + +\newtypeface{cantarell}{Cantarell}{sf}{ + \scaletypeface{sf}{\PassOptionsToPackage{scale=\tf@sfscalefactor}{cantarell}} + \tf@usefontpackage[defaultsans]{cantarell} +} + +% Biolinum aka Libertine sans +%------------------------------------------------------------------------------ +% NOTE: read the comments with libertine in the roman fonts section +%------------------------------------------------------------------------------ +% NB1, the biolinum ex font metrics in all tested versions of libertine (as of +% writing, from v5.1.2 2011/06/06) is faulty. The bug report, again, as of +% writing is still open (see http://sourceforge.net/tracker/?func=detail& +% aid=3397220&group_id=89513&atid=590374). Consequently, ex based scaling +% produces incorrect results. The easiest way out is to avoid setting typeface +% option sanstypeface=ex. Try sanstypeface=xxx, where xxx is uppercase, +% lowercase, figures or a floating point number instead. Alternatively, until +% the bug is fixed, advanced users can hack their biolinum font description +% (*fxb*.fd) files. Add this code: +% \fontdimen5\font=\fontcharht\font`\x +% to the last parameter in each \DeclareFontShape command in all *fxb*.fd +% files. E.g., +% \DeclareFontShape{T1}{fxb}{m}{n}{ <-> \fxl@@scale fxbr-t1} +% {\fontdimen5\font=\fontcharht\font`\x} +% +% NB2, biolinum and libertine SHARE the same loadtime scaling command (the +% horror!). Consequently, there's a good risk that scaling one will +% inadvertently scale the other, the risk depending on the order in which (i.e., +% when) LaTeX reads the respective rm/libertine and sf/biolinum .fd files. +\newtypeface[libertine]{biolinum}{Biolinum}{sf}{ + \tf@ifsuboption{osf}{\tf@sffontoptions}{ + % Oddly enough for sans, biolinum has an OSF variant (and its quite nice!) + \renewcommand*\sfdefault{fxbj} + \xdef\tf@sfprintname{\tf@sfprintname\ OSF} + }{ + \renewcommand*\sfdefault{fxb} + } + \scaletypeface{sf}{\xdef\fxl@scale{\tf@sfscalefactor}} + % TODO: pdfglyphcorrection is probably unnecessary here + \tf@pdfglyphcorrection{Biolinum} +} + +\newtypeface{cmbright}{CM Bright Sans}{sf}{ + \tf@loadcmbright +} + +\newtypeface{comfortaa}{Comfortaa}{sf}{ + \scaletypeface{sf}{\PassOptionsToPackage{scale=\tf@sfscalefactor}{comfortaa}} + \tf@usefontpackage{comfortaa} + \renewcommand*\sfdefault{fco} +} + +\newtypeface[cm,cms]{computermodern}{Computer Modern Sans}{sf}{ + % Warning: CM Sans Quotation is a rather dubious font. Bold, italic, slant + % fontsizes do not match normal fontsize. No smallcaps. Best avoid. + % + % requires reworked .fd file to accommodate load time scaling + \tf@ifsuboption{quotation}{\tf@sffontoptions}{ + \renewcommand*\sfdefault{lcmss} + }{ + \renewcommand*\sfdefault{cmss} + } +} + +\newtypeface{cyklop}{Cyklop}{sf}{ + % requires reworked .fd file to accommodate load time scaling + \renewcommand*\sfdefault{cyklop} +} + +\newtypeface{dejavu}{DejaVu Sans}{sf}{ + \tf@ifsuboption{condensed}{\tf@sffontoptions}{ + \scaletypeface{sf} + {\PassOptionsToPackage{scaled=\tf@sfscalefactor}{DejaVuSansCondensed}} + \tf@usefontpackage{DejaVuSansCondensed} + \xdef\tf@sfprintname{\tf@sfprintname\ Condensed} + }{ + \scaletypeface{sf} + {\PassOptionsToPackage{scaled=\tf@sfscalefactor}{DejaVuSans}} + \tf@usefontpackage{DejaVuSans} + } +} + +\newtypeface{droid}{Droid Sans}{sf}{ + \scaletypeface{sf}{\def\droid@fds@scale{s*[\tf@sfscalefactor]}} + \renewcommand*\sfdefault{fds} +} + +\newtypeface[em]{europeanmodern}{European Modern Sans}{sf}{ + % TODO: errmsg non-T1 encoding + % TODO: we can source sf osf from TS1 + % See comments with rm \newtypeface declaration + \ifthenelse{\equal{\tf@mathfont}{europeanmodern}}{ + % our europeanmodern math font handler has already done the needed work + }{ + \DeclareFontFamily{T1}{emss}{} + \DeclareFontShape{T1}{emss}{m}{n} { + <-9> emss8 <9-10> emss9 <10-12> emss10 <12-17> emss12 <17-> emss17}{} + \DeclareFontShape{T1}{emss}{m}{sl} { + <-9> emssi8 <9-10> emssi9 <10-12> emssi10 <12-17> emssi12 <17-> emssi17}{} + \DeclareFontShape{T1}{emss}{sbc}{n}{<-> emssdc10}{} + \DeclareFontShape{T1}{emss}{bx}{n} {<-> emssbx10}{} + \DeclareFontShape{T1}{emss}{m}{it} { + <-9> emssi8 <9-10> emssi9 <10-12> emssi10 <12-17> emssi12 <17-> emssi17}{} + \DeclareFontShape{T1}{emss}{m}{sc} { + <-9> emcsc8 <9-10> emcsc9 <10-> emcsc10}{} + \DeclareFontShape{T1}{emss}{m}{ui} {<-> emu10}{} + \DeclareFontShape{T1}{emss}{bx}{ui}{<-> emu10}{} + \renewcommand*\sfdefault{emss} + } +} + +\newtypeface[neohellenic]{gfsneohellenic}{GFS Neohellenic}{sf}{ + % requires reworked .fd file to accommodate load time scaling + % NB, .fd file contains scaling paraphernalia, however fixes scale to 1.225! + \renewcommand*\sfdefault{neohellenic} + \tf@ifsuboption{symbols}{\tf@sffontoptions}{ + \DeclareSymbolFont{letters}{OML}{neohellenic}{m}{it} + \ifthenelse{\equal{\tf@symbolsfont}{\TF@DEFAULT}}{ + \renewcommand*\tf@symbolsprintname{GFS Neohellenic} + }{} + }{} +} + +\newtypeface[adventor,tgadventor]{gyreadventor}{Gyre Adventor}{sf}{ + \scaletypeface{sf}{\PassOptionsToPackage{scale=\tf@sfscalefactor}{tgadventor}} + \tf@usefontpackage{tgadventor} +} + +\newtypeface[heros,tgheros]{gyreheros}{Gyre Heros}{sf}{ + \scaletypeface{sf}{\PassOptionsToPackage{scale=\tf@sfscalefactor}{tgheros}} + \tf@usefontpackage{tgheros} +} + +\newtypeface[helv,helvet]{helvetica}{Helvetica}{sf}{ + \scaletypeface{sf}{\PassOptionsToPackage{scaled=\tf@sfscalefactor}{helvet}} + \tf@usefontpackage{helvet} +} + +\newtypeface{iwona}{Iwona}{sf}{ + % requires reworked .fd file to accommodate load time scaling + \renewcommand*\sfdefault{iwona} + + \tf@ifsuboption{light}{\tf@sffontoptions}{ + \xdef\sfdefault{\sfdefault l} + \xdef\tf@sfprintname{\tf@sfprintname\ Light} + }{} + \tf@ifsuboption{condensed}{\tf@sffontoptions}{ + \xdef\sfdefault{\sfdefault c} + \xdef\tf@sfprintname{\tf@sfprintname\ Condensed} + }{} +} + +\newtypeface[kp,kepler]{kpfonts}{KP Fonts Sans}{sf}{ + % requires reworked .fd file to accommodate load time scaling + \tf@ifsuboption{osf}{\tf@sffontoptions}{ + % Oddly enough for a sans font, KP has an OSF variant + \renewcommand*\sfdefault{jkpssosn} + \xdef\tf@sfprintname{\tf@sfprintname\ OSF} + }{ + \renewcommand*\sfdefault{jkpss} + } +} + +\newtypeface{kerkis}{Kerkis Sans}{sf}{ + \renewcommand*\sfdefault{maksf} + % <enc>maksf.fd hard codes its scale factor. This code rolls that back. + \providecommand*\tf@kerkismagicnumber{0.90} % change if <enc>maksf.fd changes + \g@addto@macro\tf@empty@sfcnt@hook{% + % Rewind 0.90 fixed scale factor in .fd file + \ifthenelse{\boolean{tf@@sffamily} + \AND\NOT\equal{\tf@sfscalemethod}{\TF@NO@SCALE}}{% + \@tempdima=\tf@sfscalefactor\p@% + \@tempdima=\tf@kerkismagicnumber\@tempdima% + \edef\optional@arg{\strip@pt\@tempdima}% + \global\booltrue{tf@sfscaledatloadtime}% + }{}% + } +} + +\newtypeface{kurier}{Kurier Sans}{sf}{ + % requires reworked .fd file to accommodate load time scaling + \renewcommand*\sfdefault{kurier} + \tf@ifsuboption{light}{\tf@sffontoptions}{ + \xdef\sfdefault{\sfdefault l} + \xdef\tf@sfprintname{\tf@sfprintname\ Light} + }{} + \tf@ifsuboption{condensed}{\tf@sffontoptions}{ + \xdef\sfdefault{\sfdefault c} + \xdef\tf@sfprintname{\tf@sfprintname\ Condensed} + }{} +} + +\newtypeface[lm,lmodern]{latinmodern}{Latin Modern Sans}{sf}{ + % requires reworked .fd file to accommodate load time scaling + \tf@ifsuboption{extended}{\tf@sffontoptions}{ + \renewcommand*\sfdefault{lmssq} + \xdef\tf@sfprintname{\tf@sfprintname\ Extended} + }{ + \renewcommand*\sfdefault{lmss} + } +} + +\newtypeface{lato}{Lato}{sf}{ + \scaletypeface{sf}{\PassOptionsToPackage{scale=\tf@sfscalefactor}{lato}} + \tf@usefontpackage[defaultsans]{lato} +} + +\newtypeface[lucidabr,lucida]{lucidabright}{Lucida Bright Sans}{sf}{ + % requires reworked .fd file to accommodate load time scaling + % (unfortunately, redefining \DeclareLucidaFontShape won't work + % effortlessly since it is shared between rm, sf and tt fonts) + \renewcommand*\sfdefault{hls} +} + +\newtypeface{opensans}{Open Sans}{sf}{ + \scaletypeface{sf}{\PassOptionsToPackage{scale=\tf@sfscalefactor}{opensans}} + \tf@ifsuboption{osf}{\tf@sffontoptions}{ + \PassOptionsToPackage{osfigures}{opensans} + }{} + \tf@usefontpackage[defaultsans]{opensans}[2011/11/11] +} + +\newtypeface[pt,paratype]{ptsans}{PT Sans}{sf}{ + \scaletypeface{sf}{\PassOptionsToPackage{scaled=\tf@sfscalefactor}{PTSans}} + \tf@usefontpackage{PTSans} +} + +\newtypeface[px]{pxfonts}{PX Fonts Sans}{sf}{ + % requires reworked .fd file to accommodate load time scaling + \renewcommand*\sfdefault{pxss} +} + +\newtypeface[tx]{txfonts}{TX Fonts Sans}{sf}{ +%% NOTE: for users that want to use newtx's sf fonts definitions, +%% copy this macro to typeface.cfg, uncommenting the commented text +%% below. However, please check that it functions as intended before +%% relying it in earnest. Particularly check italic and bold shape +%% scaling to roman-relative size (sf scale options ex, uppercase, +%% lowercase, figures and implicit/default). +% +% \tf@newbool{newtx}{false} +% \ifthenelse{\equal{\tf@sffont}{\TF@DEFAULT}}{ +% \ifthenelse{\equal{\tf@rmfont}{txfonts}}{ +% \tf@ifsuboption{new}{\tf@rmfontoptions}{\booltrue{newtx}}{} +% }{} +% \ifthenelse{\equal{\tf@mathfont}{txfonts}}{ +% \tf@ifsuboption{new}{\tf@mathfontoptions}{\booltrue{newtx}}{} +% }{} +% }{ +% \tf@ifsuboption{new}{\tf@sffontoptions}{\booltrue{newtx}}{} +% } +% +% \ifbool{newtx}{ +% % Michael Sharpe's newtx +% \scaletypeface{sf}{\xdef\ntx@helvscaled{s*[\tf@sfscalefactor]}} +% \renewcommand*\sfdefault{ntxss} +% }{ + \renewcommand*\sfdefault{txss} + % <enc>txss.fd hard codes its scale factor. This code rolls that back. + \providecommand*\tf@txfontsmagicnumber{0.95}% change if <enc>txss.fd changes + \g@addto@macro\tf@empty@sfcnt@hook{% + % Rewind 0.95 fixed scale factor in .fd file + \ifthenelse{\boolean{tf@@sffamily} + \AND\NOT\equal{\tf@sfscalemethod}{\TF@NO@SCALE}}{% + \@tempdima=\tf@sfscalefactor\p@% + \@tempdima=\tf@txfontsmagicnumber\@tempdima% + \edef\optional@arg{\strip@pt\@tempdima}% + \global\booltrue{tf@sfscaledatloadtime}% + }{}% + } +% } +} + +\newtypeface[arial]{urwarial}{URW Arial}{sf}{ + \scaletypeface{sf}{\PassOptionsToPackage{scaled=\tf@sfscalefactor}{uarial}} + \tf@usefontpackage{uarial} +} + +\newtypeface[classico,optima]{urwclassico}{URW Classico}{sf}{ + % requires reworked .fd file to accommodate load time scaling + \renewcommand*\sfdefault{uop} +} + +\newtypeface[grotesq]{urwgrotesq}{URW Grotesq}{sf}{ + % requires reworked .fd file to accommodate load time scaling + \renewcommand*\sfdefault{ugq} +} + +\newtypeface[nimbus]{urwnimbus}{URW Nimbus Sans}{sf}{ + % requires reworked .fd file to accommodate load time scaling + \renewcommand*\sfdefault{unms} +} + +% Typewriter fonts -- somewhat sensitive to font load ordering, +% particularly if loaded via a font package in the code below +% ============================================================ +\TF@PackageDebugInfo{Configuring tt load commands...} + +% Default -- no-op +\newtypeface{\TF@DEFAULT}{}{tt}{ + \ifthenelse{\equal{\tf@ttprintname}{undefined}}{ + \renewcommand*\tf@ttprintname{\TF@DEFAULTPRINTNAME} + }{} +} + +\newtypeface{ae}{AE Mono}{tt}{ + % requires reworked .fd file to accommodate load time scaling + \renewcommand*\ttdefault{aett} + \ifthenelse{\equal{\tf@rmfont}{ae}}{ + \tf@ifsuboption{slides}{\tf@rmfontoptions} + {\renewcommand*\ttdefault{laett}}{} + }{} + \ifthenelse{\equal{\tf@sffont}{ae}}{ + \tf@ifsuboption{slides}{\tf@sffontoptions} + {\renewcommand*\ttdefault{laett}}{} + }{} + \tf@ifsuboption{slides}{\tf@ttfontoptions} + {\renewcommand*\ttdefault{laett}}{} +} + +\newtypeface[bera]{beramono}{Bitstream Vera Mono}{tt}{ + \scaletypeface{tt}{\PassOptionsToPackage{scaled=\tf@ttscalefactor}{beramono}} + \tf@usefontpackage{beramono} % contains no font load order side effects +} + +\newtypeface{cmbright}{Computer Modern Mono Light}{tt}{ + \tf@loadcmbright % contains math/symbols font load order side effects +} + +\newtypeface[cm,cmt]{computermodern}{}{tt}{ + % requires reworked .fd files to accommodate load time scaling + \tf@ifsuboption{light}{\tf@ttfontoptions}{ + \renewcommand*\ttdefault{cmtl} + \renewcommand*\tf@ttprintname{Computer Modern Mono Light} + }{ + \tf@ifsuboption{proportional}{\tf@ttfontoptions}{ + \renewcommand*\ttdefault{cmvtt} + \renewcommand*\tf@ttprintname{Computer Modern Mono Proportional} + }{ + \tf@ifsuboption{L}{\tf@ttfontoptions}{ + \ifthenelse{\equal{\tf@fontencoding}{T1}}{ + \DeclareFontFamily{T1}{lcmtt}{\hyphenchar\font\m@ne} + \DeclareFontShape{T1}{lcmtt}{m}{n}{<->ecltt8}{} + \DeclareFontShape{T1}{lcmtt}{m}{In}{<->iecltt8}{} + \DeclareFontShape{T1}{lcmtt}{m}{it}{<->ecit1000}{} + }{ + \ifthenelse{\equal{\tf@fontencoding}{OT1}}{ + \DeclareFontFamily{OT1}{lcmtt}{\hyphenchar\font\m@ne} + \DeclareFontShape{OT1}{lcmtt}{m}{n}{<-> cmtt8}{} + \DeclareFontShape{OT1}{lcmtt}{m}{In}{<->icmtt8}{} + \DeclareFontShape{OT1}{lcmtt}{m}{it}{<->cmitt10}{} + } + }{ + %\TF@PackageWarningNoLine{...} + } + \renewcommand*\ttdefault{lcmtt} + \renewcommand*\tf@ttprintname{Computer Modern Mono L} + }{ + \renewcommand*\ttdefault{cmtt} + \renewcommand*\tf@ttprintname{Computer Modern Mono} + } + } + } +} + +\newtypeface{courier}{Courier}{tt}{ + \scaletypeface{tt}{\PassOptionsToPackage{scaled=\tf@ttscalefactor}{couriers}} + \tf@usefontpackage{couriers} +} + +\newtypeface{dejavu}{DejaVu Mono}{tt}{ + \scaletypeface{tt} + {\PassOptionsToPackage{scaled=\tf@ttscalefactor}{DejaVuSansMono}} + \tf@usefontpackage{DejaVuSansMono} +} + +\newtypeface{droid}{Droid Mono}{tt}{ + \scaletypeface{tt}{\def\droid@fdm@scale{s*[\tf@ttscalefactor]}} + \renewcommand*\ttdefault{fdm} +} + +\newtypeface[cursor,tgcursor]{gyrecursor}{Gyre Cursor}{tt}{ + \scaletypeface{tt}{\PassOptionsToPackage{scale=\tf@ttscalefactor}{tgcursor}} + \tf@usefontpackage{tgcursor} +} + +\newtypeface[em]{europeanmodern}{European Modern Mono}{tt}{ + % TODO: errmsg non-T1 encoding + % TODO: we can source tt osf from TS1 + % See comments with rm \newtypeface declaration + \ifthenelse{\equal{\tf@mathfont}{europeanmodern}}{ + % our europeanmodern math font handler has already done the required work + }{ + \DeclareFontFamily{T1}{cmtt}{\hyphenchar \font\m@ne} + \DeclareFontShape{T1}{cmtt}{m}{n}{ + <-9> emtt8 <9-10> emtt9 <10-12> emtt10 <12-> emtt12}{} + \DeclareFontShape{T1}{cmtt}{m}{it} {<-> emitt10}{} + \DeclareFontShape{T1}{cmtt}{m}{sl} {<-> emsltt10}{} + \DeclareFontShape{T1}{cmtt}{m}{ui} {<-> emitt10}{} + \DeclareFontShape{T1}{cmtt}{bx}{n} { + <-9> emtt8 <9-10> emtt9 <10-12> emtt10 <12-> emtt12}{} + \DeclareFontShape{T1}{cmtt}{bx}{it}{<-> emitt10}{} + \DeclareFontShape{T1}{cmtt}{bx}{ui}{<-> emitt10}{} + \renewcommand*\ttdefault{cmtt} + } +} + +\newtypeface{inconsolata}{Inconsolata}{tt}{ + \scaletypeface{tt}{\def\fifour@scaled{s*[\tf@ttscalefactor]}} + \renewcommand*\ttdefault{fi4} +} + +\newtypeface[kp,kepler]{kpfonts}{KP Fonts Mono}{tt}{ + % requires reworked .fd file to accommodate load time scaling + \tf@ifsuboption{osf}{\tf@ttfontoptions} + {\renewcommand*\ttdefault{jkpttosn}} % KP mono has an OSF variant + {\renewcommand*\ttdefault{jkptt}} +} + +\newtypeface[lm,lmodern]{latinmodern}{Latin Modern Mono}{tt}{ + % requires reworked .fd file to accommodate load time scaling + \tf@ifsuboption{proportional}{\tf@ttfontoptions}{ + \renewcommand*\ttdefault{lmvtt} + \xdef\tf@ttprintname{\tf@ttprintname\ Proportional} + \renewcommand*\tf@ttprintname{Latin Modern Mono Proportional} + }{ + \renewcommand*\ttdefault{lmtt} + } +} + +\newtypeface[lucidabr,lucida]{lucidabright}{Lucida Bright Mono}{tt}{ + % We follow lucidabr (see \tf@loadlucidabr, above) by defaulting + % to sans tt unless serif tt is specified. This breaks with the + % sans vs serif tt pattern established with other tt fonts throughout + % this package (which default to serif tt unless `sans' option is provided). + % Note also that we require reworked .fd file to accommodate load time + % scaling (unfortunately, redefining \DeclareLucidaFontShape won't work + % without knottiness since it is common to rm, sf and tt fonts). + \tf@ifsuboption{serif}{\tf@ttfontoptions}{\booltrue{tf@@lbseriftt}}{} + \tf@ifsuboption{seriftt}{\tf@ttfontoptions}{\booltrue{tf@@lbseriftt}}{} + \tf@ifsuboption{sans}{\tf@ttfontoptions}{ + \ifbool{tf@@lbseriftt}{ + \TF@PackageWarningNoLine{% + Incompatible suboptions `sans' and `seriftt' (or\MessageBreak + `serif'). Check for conflicts in your `typeface',\MessageBreak + `mathtypeface' and `monotypeface' package options} + }{} + }{} + \ifbool{tf@@lbseriftt}{ + \renewcommand*\ttdefault{hlct} + }{ + \renewcommand*\ttdefault{hlst} + \renewcommand*\tf@ttprintname{Lucida Bright Sans Mono} + } +} + +\newtypeface[luxi]{luximono}{Luxi Mono}{tt}{ + \scaletypeface{tt}{\PassOptionsToPackage{scaled=\tf@ttscalefactor}{luximono}} + % While the luximono package is available via MiKTeX package manager, it is + % not through TeXLive package manager where instead you'll need to download + % and install by hand + \tf@usefontpackage{luximono} +} + +\newtypeface[pt,paratype]{ptmono}{PT Mono}{tt}{ + % PT Mono is not installed with the paratype package and must + % consequently be manually installed using the truetype variant + % (instructions in paratype's docs) + \scaletypeface{tt}{\PassOptionsToPackage{scaled=\tf@ttscalefactor}{PTSans}} + \tf@usefontpackage{PTMono} +} + +\newtypeface[px]{pxfonts}{PX Fonts Mono}{tt}{ + % requires reworked .fd file to accommodate load time scaling + \renewcommand*\ttdefault{pxtt} +} + +\newtypeface[tx]{txfonts}{TX Fonts Mono}{tt}{ + % requires reworked .fd file to accommodate load time scaling + \renewcommand*\ttdefault{txtt} +} + +%== End \newtypeface font definitions ========================================= + +% Unpack and validate typeface font options +%------------------------------------------ +% Typeface name options (typeface/rm, sanstypeface/sf, monotypeface/tt, +% mathtypeface/math, symbolstypeface/sym and textfigures) can include +% colon-separated lists of suboptions, e.g., +% typeface=iwona:light, +% sanstypeface=kepler:light:osf, +% monotypeface=latinmodern:proportional +% textfigures=kepler:light:scale:ex:spacing:-20:lkern:-20:rkern:-10 +% At this stage, each user supplied <fontname[:option]*> string has already +% been set up in \tf@XXfontname, where XX is rm, sf, tt, math, symbols or +% textfigures. We store the <fontname> part in \tf@XXfont and the <[:option]*> +% part in \tf@XXfontoptions (discarding the first colon), then validate +% that \tf@XXfont is a legitimate font name, complaining otherwise. +%...................................................................... +\tf@newbool{tf@valid@fontname}{false} + +\newcommand*\tf@unpackfontname[2]{% + % split & save the string in #1 into \tf@#2font and \tf@#2fontoptions, where + % #1 is the <fontname(:option)*> user-supplied option string, and + % #2 is one of textfigures, symbols, math, rm, sf, or tt + \expandafter\tf@@unpackfontname\expandafter{#1}{#2}% +} + +\newcommand*\tf@@unpackfontname[2]{% + \tf@split@fontname #2:#1\@empty:\@empty\relax% +} + +\def\tf@split@fontname#1:#2:#3\@empty#4\relax{% % split and save to: + \expandafter\def\csname tf@#1font\endcsname{#2}% % eg, \tf@rmfont + \expandafter\def\csname tf@#1fontoptions\endcsname{#3}% eg, \tf@rmfontoptions +} + +\newcommand*\tf@parsefontname[1]{ + % #1 is one of textfigures, symbols, math, rm, sf, or tt + \edef\tf@@fontname{\csname tf@#1fontname\endcsname} + \tf@unpackfontname{\tf@@fontname}{#1} + + % check that the fontname part we saved in \tf@#1font matches one + % of the entries in the \tf@#1typefacechoices comma separated list + \boolfalse{tf@valid@fontname} + \edef\tf@@font{\csname tf@#1font\endcsname} + \renewcommand*\do[1]{ % refer etoolbox package + \ifthenelse{\equal{\tf@@font}{##1}} + {\booltrue{tf@valid@fontname}\listbreak} + {} + } + \edef\tf@@typefacechoices{\csname tf@#1typefacechoices\endcsname} + \expandafter\docsvlist\expandafter{\tf@@typefacechoices} + + \ifthenelse{\NOT\boolean{tf@valid@fontname}}{ + \ifthenelse{\equal{rm}{#1}}{ + \edef\tf@@XXtypeface{typeface} + \edef\tf@@XXdefaultfont{\TF@DEFAULTRMFONT}}{} + \ifthenelse{\equal{sf}{#1}}{ + \edef\tf@@XXtypeface{sanstypeface} + \edef\tf@@XXdefaultfont{\TF@DEFAULTSFFONT}}{} + \ifthenelse{\equal{tt}{#1}}{ + \edef\tf@@XXtypeface{monotypeface} + \edef\tf@@XXdefaultfont{\TF@DEFAULTTTFONT}}{} + \ifthenelse{\equal{math}{#1}}{ + \edef\tf@@XXtypeface{mathtypeface} + \edef\tf@@XXdefaultfont{\TF@DEFAULTMATHFONT}}{} + \ifthenelse{\equal{symbols}{#1}}{ + \edef\tf@@XXtypeface{symbolstypeface} + \edef\tf@@XXdefaultfont{\TF@DEFAULTSYMBOLSFONT}}{} + \ifthenelse{\equal{textfigures}{#1}}{ + \edef\tf@@XXtypeface{textfigures} + \edef\tf@@XXdefaultfont{\TF@DEFAULTTEXTFIGURESFONT}}{} + % NB, no allowance is made in the following error message that the user + % might have used one of the options aliases, e.g., instead of + % typeface=..., s/he wrote rm=... Hopefully if the user is smart enough + % to use options aliases, s/he's smart enough to interpret the error. + \TF@PackageError{% + Package option `\tf@@XXtypeface=\tf@@fontname' is\MessageBreak + invalid. Setting `\tf@@XXtypeface=\tf@@XXdefaultfont'}{} + \expandafter\xdef\csname tf@#1fontname\endcsname{\tf@@XXdefaultfont} + \expandafter\xdef\csname tf@#1font\endcsname{\tf@@XXdefaultfont} + \expandafter\xdef\csname tf@rmfontdefaultstatus\endcsname{\TF@IMPLICITDEFAULT} + }{} +} +\forcsvlist{\tf@parsefontname}{rm,sf,tt,math,symbols,textfigures} + +% Configure sf, tt, math and textfigures font scaling +% =================================================== +% Options include: ex, lowercase, uppercase, figures, true (synonym for ex), +% false, or a literal constant (e.g., 0.82), allowing authors to match the +% ex-height, the baseline ascender height of lowercase letters, the ascender +% height of uppercase letters, or the ascender height of figures for the +% target fonts with respect to the \rmdefault (reference) font size. Special +% values 0, false, 1, 1.0, etc. all produce unity, that is, no scaling. +%--------------------------------------------------------------------------- + +% Typeface family scale command names, e.g., ex, 0.98, false, uppercase,... +\newcommand*\tf@rmscale{\TF@UNSCALED} +\newcommand*\tf@sfscale{\TF@UNSCALED} +\newcommand*\tf@ttscale{\TF@UNSCALED} +\newcommand*\tf@mathscale{\TF@UNSCALED} +\newcommand*\tf@textfiguresscale{\TF@UNSCALED} + +% Typeface family scale factors (+ve real numbers only) +\newcommand*\tf@sfscalefactor{\TF@UNSCALED} +\newcommand*\tf@ttscalefactor{\TF@UNSCALED} +\newcommand*\tf@mathscalefactor{\TF@UNSCALED} +\newcommand*\tf@textfiguresscalefactor{\TF@UNSCALED} + +% Track whether user explicitly defines scale or whether we implicitly set it +\tf@newbool{tf@sfscaleimplicit}{true} +\tf@newbool{tf@ttscaleimplicit}{true} +\tf@newbool{tf@mathscaleimplicit}{true} +\tf@newbool{tf@textfiguresscaleimplicit}{true} + +% Determine target font scaling methods +%-------------------------------------- +\newcommand*\tf@sfscalemethod{\TF@ER@SCALE} +\newcommand*\tf@ttscalemethod{\TF@ER@SCALE} +\newcommand*\tf@mathscalemethod{\TF@ER@SCALE} +\newcommand*\tf@textfiguresscalemethod{\TF@ER@SCALE} + +\tf@newbool{tf@sfscaledatloadtime}{false} +\tf@newbool{tf@ttscaledatloadtime}{false} +\tf@newbool{tf@mathscaledatloadtime}{false} +\tf@newbool{tf@textfiguresscaledatloadtime}{false} + +% Validate and set the math font family (0..15) for use with rm-relative +% font scaling (used in \tf@initialise@fontscaling and in printinfo) +\newcommand*\tf@mathfontfamily{0} % default + +\tf@ifsuboption{fam}{\tf@mathfontoptions}{ + \xdef\tf@mathfontfamily{\tf@nextsuboption} + \def\tf@@temp{fam} +}{} + +\tf@ifsuboption{family}{\tf@mathfontoptions}{ + \xdef\tf@mathfontfamily{\tf@nextsuboption} + \def\tf@@temp{family} +}{} + +\ifthenelse{\NOT\ispositiveinteger{\tf@mathfontfamily} + \OR\(\tf@mathfontfamily > 15\)}{ + \ifthenelse{\equal{\tf@mathfontfamily}{}}{\def\tf@mathfontfamily{<nil>}}{} + \TF@PackageError{% + Invalid `\tf@@temp:nn' suboption argument in package\MessageBreak + option `mathtypeface=\tf@mathfontname'.\MessageBreak + Integer `nn' must be between 0 and 15\MessageBreak + (not `\tf@mathfontfamily'). Setting math font family = 0% + }{} + \renewcommand*\tf@mathfontfamily{0} +}{} + +% Determine sf, tt, math and textfigures font scaling methods +\newcommand*\tf@configure@fontscalingmethod[1]{ + \ifthenelse{\NOT\equal{#1}{sf} + \AND\NOT\equal{#1}{tt} + \AND\NOT\equal{#1}{math} + \AND\NOT\equal{#1}{textfigures}}{ + \TF@PackageError{Internal error in \TF@PACKAGENAME.sty\MessageBreak + Illegal parameter [#1]\MessageBreak + in \string\tf@configure@fontscalingmethod}{} + }{ + \begingroup + \edef\tf@@scalemethod{\TF@ER@SCALE} + \edef\tf@@scalefactor{\TF@UNSCALED} + \edef\tf@@fontoptions{\csname tf@#1fontoptions\endcsname} + + \tf@ifsuboption{scale}{\tf@@fontoptions}{ + \ifthenelse{\equal{\tf@nextsuboption}{false}} + {\edef\tf@@scalemethod{\TF@NO@SCALE}}{} + \ifthenelse{\equal{\tf@nextsuboption}{true}} + {\edef\tf@@scalemethod{\TF@EX@SCALE}}{} + \ifthenelse{\equal{\tf@nextsuboption}{ex}} + {\edef\tf@@scalemethod{\TF@EX@SCALE}}{} + \ifthenelse{\equal{\tf@nextsuboption}{lowercase}} + {\edef\tf@@scalemethod{\TF@LC@SCALE}}{} + \ifthenelse{\equal{\tf@nextsuboption}{lc}} + {\edef\tf@@scalemethod{\TF@LC@SCALE}}{} + \ifthenelse{\equal{\tf@nextsuboption}{uppercase}} + {\edef\tf@@scalemethod{\TF@UC@SCALE}}{} + \ifthenelse{\equal{\tf@nextsuboption}{uc}} + {\edef\tf@@scalemethod{\TF@UC@SCALE}}{} + \ifthenelse{\equal{\tf@nextsuboption}{figures}} + {\edef\tf@@scalemethod{\TF@FG@SCALE}}{} + \ifthenelse{\equal{\tf@nextsuboption}{fig}} + {\edef\tf@@scalemethod{\TF@FG@SCALE}}{} + \ifthenelse{\ispositiverealnumber{\tf@nextsuboption}}{ + % Test "normalised" numbers, i.e., test 0 instead of 0.00, + % 1 instead of 001, ... + \edef\tf@@scalefactor{\strip@pt\dimexpr\tf@nextsuboption pt\relax} + \ifthenelse{\equal{\tf@@scalefactor}{0} + \OR\equal{\tf@@scalefactor}{1}}{ + \edef\tf@@scalemethod{\TF@NO@SCALE} + }{ + \edef\tf@@scalemethod{\TF@FX@SCALE} + \expandafter\xdef\csname tf@#1scalefactor\endcsname{\tf@@scalefactor} + } + }{} + }{ + \edef\tf@@scalemethod{\TF@EX@SCALE} % default: scale to rm ex height + } + + % Error handling + \ifthenelse{\equal{\tf@@scalemethod}{\TF@ER@SCALE}}{ + \TF@PackageError{% + Invalid `scale:nnn' suboption argument in\MessageBreak + #1 parameters `\csname tf@#1fontname\endcsname'}{} + }{ + \ifthenelse{\equal{#1}{textfigures}}{ + \ifthenelse{\equal{\tf@nextsuboption}{lowercase}} + {\edef\tf@@scalemethod{\TF@ER@SCALE}}{} + \ifthenelse{\equal{\tf@nextsuboption}{lc}} + {\edef\tf@@scalemethod{\TF@ER@SCALE}}{} + \ifthenelse{\equal{\tf@nextsuboption}{uppercase}} + {\edef\tf@@scalemethod{\TF@ER@SCALE}}{} + \ifthenelse{\equal{\tf@nextsuboption}{uc}} + {\edef\tf@@scalemethod{\TF@ER@SCALE}}{} + \ifthenelse{\equal{\tf@nextsuboption}{figures}} + {\edef\tf@@scalemethod{\TF@ER@SCALE}}{} + \ifthenelse{\equal{\tf@nextsuboption}{fig}} + {\edef\tf@@scalemethod{\TF@ER@SCALE}}{} + \ifthenelse{\equal{\tf@@scalemethod}{\TF@ER@SCALE}}{ + \TF@PackageError{% + Invalid `scale:\tf@nextsuboption' suboption argument in\MessageBreak + option `textfigures=\tf@textfiguresfontname'}{} + }{} + }{} + } + + % Initialise \tf@#1scalefactor if we can at this stage (generally not yet + % possible if \tf@@scalemethod == \TF@EX@SCALE, \TF@LC@SCALE, etc.) + \ifthenelse{\equal{\tf@@scalemethod}{\TF@NO@SCALE}}{ + \expandafter\xdef\csname tf@#1scalefactor\endcsname{\TF@UNSCALED} + }{ + \ifthenelse{\equal{\tf@@scalemethod}{\TF@FX@SCALE}}{ + \expandafter\xdef\csname tf@#1scalefactor\endcsname + {\strip@pt\dimexpr\tf@nextsuboption pt\relax} + }{} + } + + % We can apply fixed (constant literal) value scaling with rm-relative + % scaling if we managed to save the computed scale factor in the aux file + % during the previous run and user options haven't changed significantly + % since then. + \ifthenelse{\equal{\tf@fontencoding}{\tf@aux@fontencoding} + \AND\equal{\tf@rmfontname}{\tf@aux@rmfontname} + \AND\equal{\csname tf@#1fontname\endcsname} + {\csname tf@aux@#1fontname\endcsname} + \AND\NOT\equal{\csname tf@aux@#1scalefactor\endcsname}{}}{ + \expandafter\xdef\csname tf@#1scalefactor\endcsname + {\csname tf@aux@#1scalefactor\endcsname} + \edef\tf@@scalefactor{\csname tf@#1scalefactor\endcsname} + \edef\tf@@scalefactor{\strip@pt\dimexpr\tf@@scalefactor pt\relax} + \ifthenelse{\equal{\tf@@scalefactor}{1}} + {\edef\tf@@scalemethod{\TF@NO@SCALE}} + {\edef\tf@@scalemethod{\TF@FX@SCALE}} + }{} + \expandafter\xdef\csname tf@#1scalemethod\endcsname{\tf@@scalemethod} + \TF@PackageInfo{#1 scale method = \csname tf@#1scalemethod\endcsname} + \endgroup + } +} +\forcsvlist{\tf@configure@fontscalingmethod}{sf,tt,math,textfigures} + +% Initialise sf, tt, math and textfigures font scale factors +%----------------------------------------------------------- +\newcommand*\tf@initialise@fontscaling[1]{ + % This macro assumes that \tf@configure@fontscalingmethod{#1} has already + % been executed, i.e., that \tf@#1scalemethod is properly configured + \ifthenelse{\NOT\equal{#1}{sf} + \AND\NOT\equal{#1}{tt} + \AND\NOT\equal{#1}{math} + \AND\NOT\equal{#1}{textfigures}}{ + \TF@PackageError{Internal error in \TF@PACKAGENAME.sty\MessageBreak + Illegal parameter [#1]\MessageBreak + in \string\tf@initialise@fontscaling}{} + }{ + \edef\tf@@scalemethod{\csname tf@#1scalemethod\endcsname} + + \ifthenelse{\equal{\tf@@scalemethod}{\TF@ER@SCALE}}{ + % User error. Error message was raised when detected. Do nothing here. + }{ + \ifthenelse{\equal{\tf@@scalemethod}{\TF@NO@SCALE}}{ + % By this stage, \tf@#1scalefactor has already been set to \TF@UNSCALED + %--- Aux file ----------------------------------------------------------- + \tf@writeauxfile{\string\newcommand*% + \string\tf@aux@#1scalefactor{\TF@UNSCALED}} + %------------------------------------------------------------------------ + }{ + \ifthenelse{\equal{\tf@@scalemethod}{\TF@FX@SCALE}}{ + % By this stage, \tf@#1scalefactor has already been set to + % the correct fixed value + %--- Aux file ----------------------------------------------------------- + \tf@writeauxfile{\string\newcommand*\string\tf@aux@#1scalefactor{% + \csname tf@#1scalefactor\endcsname}} + %------------------------------------------------------------------------ + }{ + \begingroup + \expandafter\xdef\csname tf@#1scalefactor\endcsname{\TF@UNSCALED} + + \edef\tf@@lc{bdfhklt} + \edef\tf@@uc{WXY} + \edef\tf@@fig{08} + + % For reference font (rm) relative scaling purposes, select (and + % therefore load) an exceedingly unlikely user fontsize close to + % \normalsize font size + \normalsize + \edef\tf@@temp{\strip@pt\dimexpr\f@size pt + 0.027182pt\relax}% + \fontsize{\tf@@temp}{\f@baselineskip} + + \usefont{\encodingdefault}{\rmdefault}{m}{n} + \ifthenelse{\equal{\tf@@scalemethod}{\TF@EX@SCALE}} + {\@tempdima=\fontdimen5\font}{} + % note that with many fonts, lc, uc & fig scaling methods + % are not particularly reliable + \ifthenelse{\equal{\tf@@scalemethod}{\TF@LC@SCALE}} + {\setbox0=\hbox{\tf@@lc}\@tempdima=\ht0}{} + \ifthenelse{\equal{\tf@@scalemethod}{\TF@UC@SCALE}} + {\setbox0=\hbox{\tf@@uc}\@tempdima=\ht0}{} + % note that we scale to rm font figures size, even if a + % substitute osf is in force + \ifthenelse{\equal{\tf@@scalemethod}{\TF@FG@SCALE}} + {\setbox0=\hbox{\tf@@fig}\@tempdima=\ht0}{} + + \ifthenelse{\equal{#1}{textfigures}}{ + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@XF}} + {\usefont{\tf@substosffontencoding}{\tf@substosffont}{m}{n}} + {\usefont{\encodingdefault}{\rmdefault}{m}{n}} % redundant + }{ + \ifthenelse{\equal{#1}{math}}{ + % handled below + }{ + % sf and tt + \usefont{\encodingdefault}{\csname #1default\endcsname}{m}{n} + } + } + + \ifthenelse{\equal{#1}{math}}{ + \ifthenelse{\equal{\tf@@scalemethod}{\TF@EX@SCALE}}{ + \setbox0=\hbox{$x$} % to ensure font is selected + \@tempdimb=\fontdimen5\textfont\tf@mathfontfamily + \tf@ifsuboption{ex}{\tf@mathfontoptions}{ + \ifthenelse{\equal{\tf@nextsuboption}{alt}}{ + \@tempdimb=\ht0 + }{} + }{} + }{} + % lc, uc and fig math scaling are ridiculously unreliable + \ifthenelse{\equal{\tf@@scalemethod}{\TF@LC@SCALE}} + {\setbox0=\hbox{$\tf@@lc$}\@tempdimb=\ht0}{} + \ifthenelse{\equal{\tf@@scalemethod}{\TF@UC@SCALE}} + {\setbox0=\hbox{$\tf@@uc$}\@tempdimb=\ht0}{} + \ifthenelse{\equal{\tf@@scalemethod}{\TF@FG@SCALE}} + {\setbox0=\hbox{$\tf@@fig$}\@tempdimb=\ht0}{} + }{ + \ifthenelse{\equal{\tf@@scalemethod}{\TF@EX@SCALE}} + {\@tempdimb=\fontdimen5\font}{} + \ifthenelse{\equal{\tf@@scalemethod}{\TF@LC@SCALE}} + {\setbox0=\hbox{\tf@@lc}\@tempdimb=\ht0}{} + \ifthenelse{\equal{\tf@@scalemethod}{\TF@UC@SCALE}} + {\setbox0=\hbox{\tf@@uc}\@tempdimb=\ht0}{} + \ifthenelse{\equal{\tf@@scalemethod}{\TF@FG@SCALE}} + {\setbox0=\hbox{\tf@@fig}\@tempdimb=\ht0}{} + } + + \edef\tf@@scalefactor + {\strip@pt\dimexpr \p@ * \@tempdima / \@tempdimb\relax} + + \ifbool{tf@#1scaledatloadtime}{ + \TF@PackageError{% + INTERNAL PACKAGE ERROR: flag `tf@#1scaledatloadtime'\MessageBreak + tested true in command `\tf@initialise@fontscaling',\MessageBreak + Please report this error to the package maintainer}{} + }{ + % Font wasn't scaled at load time, most likely because we haven't + % configured the font for load time scaling and/or we haven't + % saved the scale factor and reloaded it from the aux file yet. + \expandafter\xdef\csname tf@#1scalefactor\endcsname{\tf@@scalefactor} + %--- Aux file --------------------------------------------------------- + \tf@writeauxfile{\string\newcommand*\string\tf@aux@#1scalefactor{% + \csname tf@#1scalefactor\endcsname}} + %---------------------------------------------------------------------- + \ifthenelse{\NOT\equal{\csname tf@#1scalemethod\endcsname}{\TF@FX@SCALE}}{ + \ifthenelse{\equal{#1}{sf}\OR\equal{#1}{tt}}{ + % math and (generally) text figures do not require + % two pass font scaling + \tf@notifyauxfiledirty{#1} + }{} + }{} + } + \endgroup + }}} + } + \TF@PackageInfo{#1 scale factor = \csname tf@#1scalefactor\endcsname} +} + +% Initialise math size declarations +%---------------------------------- +\newcommand*\tf@initialise@mathsizes{ + \newcommand*\tf@@scalemathfont[1]{ + \begingroup + \csname ##1\endcsname + \let\oldf@size\f@size + \dimen@\f@size\p@ + \@tempdima\tf@mathscalefactor\dimen@ + \edef\f@size{\strip@pt\@tempdima} + \calculate@math@sizes + \csname S@\f@size\endcsname + \let\f@size\oldf@size + + \expandafter\xdef\csname S@@tf\f@size\endcsname{\tf@size} + \expandafter\xdef\csname S@@sf\f@size\endcsname{\sf@size} + \expandafter\xdef\csname S@@ssf\f@size\endcsname{\ssf@size} + + \expandafter\gdef\csname S@\f@size\endcsname{% + \xdef\tf@size{\csname S@@tf\f@size\endcsname}% + \xdef\sf@size{\csname S@@sf\f@size\endcsname}% + \xdef\ssf@size{\csname S@@ssf\f@size\endcsname}% + \TF@PackageDebugInfoNoLine{Math size \string\S@\f@size: % + [\f@size][\tf@size][\sf@size][\ssf@size]}% + } + \endgroup + } + \forcsvlist{\tf@@scalemathfont} + {tiny,scriptsize,footnotesize,small,normalsize,large,Large,LARGE,huge,Huge} + \ifthenelse{\classloaded{memoir}}{ + \forcsvlist{\tf@@scalemathfont}{miniscule,HUGE} + }{} + \booltrue{tf@mathscaledatloadtime} +} + +% Text figures spacing (tracking). User configurable by setting `spacing:nnn' +% suboption in `textfigures' package option. E.g., +% textfigures=kpfonts:light:spacing:-20 +% nnn may be any integer from -1000 to 1000. Given value n, the substitute +% text figures font will be kerned nnn/1000em. Requires the microtype package +% -- complains if not already loaded. +%---------------------------------------------------------------------------- +\newcommand*\tf@textfiguresspacing{0} +\tf@newbool{tf@textfiguresspacingimplicit}{true} + +\newcommand*\tf@initialise@textfiguresfontspacing{ + \tf@ifsuboption{spacing}{\tf@textfiguresfontoptions}{ + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@XF}}{ + \ifthenelse{\isinteger{\tf@nextsuboption} + \AND\(\tf@nextsuboption > -1001\) + \AND\(\tf@nextsuboption < 1001\)}{ + \xdef\tf@textfiguresspacing{\tf@nextsuboption} + \boolfalse{tf@textfiguresspacingimplicit} + }{ + \TF@PackageError{% + Invalid `spacing:nnn' suboption argument in your\MessageBreak + package option `textfigures=\tf@textfiguresfontname'.\MessageBreak + Integer `nnn' must be between -1000 and 1000}{} + } + }{ + \TF@PackageError{% + Ignoring package suboption `spacing:nnn' in\MessageBreak + `textfigures=\tf@textfiguresfontname'}{} + } + }{} + + % set textfigures=...:spacing:1... suboption to take the <true> branch + % (microtype won't apply outer kerning if spacing == 0, we just follow + % along with that) + \ifthenelse{\NOT\equal{\tf@textfiguresspacing}{0}}{ + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@XF}}{ + \@ifpackageloaded{microtype}{ + \tf@ifsuboption{lkern}{\tf@textfiguresfontoptions}{ + \ifthenelse{\isinteger{\tf@nextsuboption}}{ + \edef\tf@MTtrackingL{\tf@nextsuboption} + }{ + \TF@PackageError{% + Invalid `lkern:\tf@nextsuboption' suboption value\MessageBreak + (`\tf@nextsuboption' should be an integer)}{} + } + }{ + \numdef\tf@MTtrackingL{\tf@textfiguresspacing} + } + \tf@ifsuboption{rkern}{\tf@textfiguresfontoptions}{ + \ifthenelse{\isinteger{\tf@nextsuboption}}{ + \edef\tf@MTtrackingR{\tf@nextsuboption} + }{ + \TF@PackageError{% + Invalid `rkern:\tf@nextsuboption' suboption value\MessageBreak + (`\tf@nextsuboption' should be an integer)}{} + } + }{ + \numdef\tf@MTtrackingR{\tf@textfiguresspacing} + } + \SetTracking[outer kerning={\tf@MTtrackingL,\tf@MTtrackingR}] + {encoding=*, family=\tf@substosffont} + {\tf@textfiguresspacing} + }{ + \TF@PackageError{% + The microtype package must be loaded before\MessageBreak + loading the typeface package if suboption\MessageBreak + `spacing:nnn' in `textfigures=\tf@textfiguresfontname'\MessageBreak + is to have any effect. Ignoring suboption `spacing'}{} + \renewcommand*\tf@textfiguresspacing{0} + } + }{} + }{} + %--- Aux file --------------------------------------------------------------- + \tf@writeauxfile{\string\newcommand*\string\tf@aux@textfiguresspacing{% + \tf@textfiguresspacing}} + %---------------------------------------------------------------------------- +} + +% Load remaining Required Packages +% ================================ +\TF@PackageDebugInfo{Loading remaining required packages...} + +\RequirePackage{scalefnt} +\usepackage{anyfontsize} + +\ifbool{tf@debug}{ + \@ifpackageloaded{xcolor}{\relax} % colour font substitutions when debugging + {\RequirePackage[dvipsnames,svgnames,x11names]{xcolor}} +} + +% More housekeeping: additional configuration if debugging +%--------------------------------------------------------- +\ifbool{tf@debug}{ + \TF@PackageDebugInfo{Configuring extra debug routines...} + \listfiles % list the names of files read during this job run +}{} + +% Encodings management +%--------------------- +\TF@PackageDebugInfo{Configuring encodings...} + +\newcommand*\tf@@loadencpackage[2]{ + % #1 package name (e.g., inputenc) + % #2 typeface option name (e.g., \tf@inputencoding) + \edef\tf@@packagename{#1} + \edef\tf@@optionname{\csname tf@#2\endcsname} + \edef\tf@@optionstring{\csname tf@#2string\endcsname} + \ifthenelse{\equal{\tf@@optionname}{\TF@DONTLOAD} + \OR\equal{\tf@@optionname}{\TF@IGNORE}}{ + \relax + }{ + \ifthenelse{\NOT\packageloaded{\tf@@packagename}}{ + \TF@PackageDebugInfo{Loading `#1' with parameters [\tf@@optionname]} + \usepackage[\tf@@optionname]{\tf@@packagename} + }{ + \TF@PackageWarningNoLine{% + The `#1' package is already loaded. Please\MessageBreak + check that its load-time options correspond with\MessageBreak + your needs. Package option `#2=\tf@@optionstring'\MessageBreak + ignored. (Set `#2=\TF@DONTLOAD' to make\MessageBreak + this warning go away)} + } + } +} +\tf@@loadencpackage{inputenc}{inputencoding} +\tf@@loadencpackage{textcomp}{textcomp} +\ifbool{pdf}{ + \tf@@loadencpackage{cmap}{cmap} +}{} + +% Even with cmap loaded, some pdf readers (notably including Adobe Acrobat) +% are unable to search for or copy ligatures and oldstyle nums from +% certain fonts. This macro provides a fix that often works. It depends +% on the availability of `glyphtounicode.tex' in your TEXMF tree. +% It is not guaranteed to work always since other factors might intervene, +% e.g., an odd fontencoding (try T1 instead), the actual pdf reader being +% used to view the document, which way the wind is blowing, etc. +\newcommand*\tf@pdfglyphcorrection[1]{ + \ifbool{pdf}{ + \IfFileExists{glyphtounicode}{ + \TF@PackageInfoNoLine{% + Correction applied to fix #1 font\MessageBreak + ligatures and old style figures search\MessageBreak + and copy problems. It might or might\MessageBreak + not work, depending on your pdf reader} + \input{glyphtounicode} + \pdfglyphtounicode{f_f}{FB00} + \pdfglyphtounicode{f_i}{FB01} + \pdfglyphtounicode{f_l}{FB02} + \pdfglyphtounicode{f_f_i}{FB03} + \pdfglyphtounicode{f_f_l}{FB04} + \pdfgentounicode=1 + }{ + \TF@PackageInfoNoLine{% + `glyphtounicode.tex' not found. Correction to\MessageBreak + #1 font ligatures and old style figures search\MessageBreak + and copy problem has not been applied} + } + }{} +} + +\ifthenelse{\equal{\tf@fontencoding}{\TF@DONTLOAD} + \OR\equal{\tf@fontencoding}{\TF@IGNORE}}{ + % Sneaky fontenc disappears itself from LaTeX's loaded packages + % record. Check for the existence of \@ifl@ter@@ rather than trying + % \@ifpackageloaded{fontenc} + \ifthenelse{\isundefined{\@ifl@ter@@}}{ + \TF@PackageInfoNoLine{% + The `fontenc' package does not appear to be loaded,\MessageBreak + yet you have elected not to load it at this time.\MessageBreak + Are you certain that this is a good idea?} + }{} +}{ + \TF@PackageDebugInfo{Loading `fontenc' with parameters [\tf@fontencoding]} + \usepackage[\tf@fontencoding]{fontenc} + \TF@PackageDebugInfo{\string\encodingdefault=\encodingdefault} +} + +% Namespace initialisation +% ======================== +\TF@PackageDebugInfo{Initialising namespaces...} + +% Rationalise typeface options namespace (typeface aliases) +\tf@rationalisefontnames % constructed by \newtypeface commands + +% Zero out the font name strings +\newcommand*\tf@rmprintname{undefined} +\newcommand*\tf@sfprintname{undefined} +\newcommand*\tf@ttprintname{undefined} +\newcommand*\tf@mathprintname{undefined} +\newcommand*\tf@symbolsprintname{undefined} +\newcommand*\tf@textfiguresprintname{undefined} + +% Zero out the self-registered macro names saved whenever a font is loaded +% (see the \newtypeface command, above, to see how these are constructed) +\newcommand*\tf@rmfontloadcommand{undefined} +\newcommand*\tf@sffontloadcommand{undefined} +\newcommand*\tf@ttfontloadcommand{undefined} +\newcommand*\tf@mathfontloadcommand{undefined} +\newcommand*\tf@symbolsfontloadcommand{undefined} +\newcommand*\tf@textfiguresfontloadcommand{undefined} + +% Discard any previously defined math symbols fonts, more or less +\let\glb@currsize\relax + +% Text figures management +% ======================= +% Lowercase (text) numerals -- you almost certainly won't use these unless +% your font natively provides old style figures. If it does, then all you need +% do is to include `textfigures' in your package options. If your selected +% font includes old style figures, to turn them on throughout your document +% (except if set in the `liningnums' environment). If your font does not +% natively provide old style figures, specifying `textfigures=xxx' (where xxx +% is `palatino`, `adobeminionpro' or any other font configured for this) will +% attempt to use the old style figures from the xxx font instead. The catch is +% that to use the (non-native) substitute text figures font, you have to place +% your numbers in a `textstylenums` environment, e.g., +% \begin{textstylenums}1234\end{textstylenums} +% or pass them to the `\textstylenums' command. Unlike LaTeX's standard +% `\oldstylenums' command, you can include some punctuation characters +% alongside figures, e.g., you can include `$', hyphen, en dash, em dash, +% full stop, comma, etc., depending on the font. However, since the success of +% this is font-dependant, you probably should avoid this writing style. +% +% WARNING: DO NOT ATTEMPT TO USE \begin{textstylenums}....\end{textstylenums} +% OR \textstylenums IN MATHS ENVIRONMENTS! IT WILL END IN TEARS! +% +% Note that if a substitute font is specified, `textnums' substitutes one font +% family for another, whereas `oldstylenums' does not (it uses the old style +% figures from the currently selected font if they are available, or typesets +% little black rectangles otherwise). Converting your document to use the +% `textnums' environment or `\textstylenums' command needn't require much +% effort if you write a wildcard based search and replace routine in your +% document editor to automate this for you (making sure to avoid numbers in +% TeX command parameters, etc). +%------------------------------------------------------------------------------ +\TF@PackageDebugInfo{Initialising textfigures commands...} + +% Useful author-level boolean expressions that can be used in +% \ifthenelse tests. E.g., \ifthenelse{\NOT\isliningnums}{...}{...} +\def\isliningnums{\equal{\tf@osf@method}{\TF@OSF@LF}} + +% Provide the default (stub) version of liningnums environment that (when +% fleshed out on a per font basis in the font commands below) switches to +% lining (uppercase) figures whenever the environment is in effect. +\tf@newbool{tf@liningnums}{false} % TODO: should we make this nestable? +\newenvironment{liningnums} + {\booltrue{tf@liningnums}} + {\boolfalse{tf@liningnums}} +\newcommand*\tf@resetliningnumsenvironment{ + \renewenvironment{liningnums} + {\booltrue{tf@liningnums}} + {\boolfalse{tf@liningnums}} +} + +% Helper routine to redefine liningnums environment when using native osf +\newcommand*\tf@define@liningfigures[1]{ + % #1 is the font family name for lining figures, e.g., pplx (vs pplj) + \renewenvironment{liningnums}{% + \notbool{tf@suppressfiguressubstitution}{% + \ifbool{tf@debug}{\color{\TF@DEBUG@COLOUR@LININGNUMS}}{}% + \fontfamily{#1}\selectfont% + }{}% + }{% + \boolfalse{tf@liningnums}% + } +} + +% Helper routine to define the \oldstylenums command for selected font families +\newcommand*\tf@define@oldstylenums@cmd[1]{ + % #1 is the font family name for old style figures, e.g., pplj (vs pplx) + \renewcommand\oldstylenums[1]{{\fontfamily{#1}\selectfont ##1}} +} + +% Access old style figures via TS1 font encoding +\newcommand*\tf@TSencodedosf{ + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@JF} + \OR\equal{\tf@osf@method}{\TF@OSF@SC}}{ + \renewcommand*\tf@osf@method{\TF@OSF@TS} + \tf@resetliningnumsenvironment + }{} +} + +% Access old style figures by switching to small caps +\newcommand*\tf@SCencodedosf{ + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@JF} + \OR\equal{\tf@osf@method}{\TF@OSF@TS}}{ + \renewcommand*\tf@osf@method{\TF@OSF@SC} + \tf@resetliningnumsenvironment + }{} +} + +% Advise users that their selected font does not support old style figures +\newcommand\TF@NativeOSFError{ + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@JF}}{ + \TF@PackageError{Option `typeface=\tf@rmfontname' does not\MessageBreak + support `textfigures=\tf@textfiguresfontname'.\MessageBreak + Setting `textfigures=false'}{} + \renewcommand*\tf@osf@method{\TF@OSF@LF} + \tf@resetliningnumsenvironment + \renewcommand*\tf@textfiguresfontname{false} + }{} +} + +% Advise users that the selected font ONLY supports old style figures (rare!) +\newcommand\TF@NativeLFError{ + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@LF}}{ + \TF@PackageError{Option `typeface=\tf@rmfont' does not\MessageBreak + support `textfigures=\tf@textfiguresfontname' (default).\MessageBreak + Setting `textfigures=oldstylefigures'}{} + \renewcommand*\tf@osf@method{\TF@OSF@JF} + \tf@resetliningnumsenvironment + \renewcommand*\tf@textfiguresfontname{oldstylefigures} + }{} +} + +% Advise users that their selected math font kills support for old style figures +\newcommand\TF@NativeOSFMathError{ + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@JF}}{ + \TF@PackageError{Option `typeface=\tf@rmfontname' does not\MessageBreak + support combining `mathtypeface=\tf@mathfontname'\MessageBreak + and `textfigures=\tf@textfiguresfontname'.\MessageBreak + Setting `textfigures=false'}{} + \renewcommand*\tf@osf@method{\TF@OSF@LF} + \tf@resetliningnumsenvironment + \renewcommand*\tf@textfiguresfontname{false} + }{} +} + +% Set up our INTERNAL \tf@textstylenums declaration and the +% AUTHOR textnums environment and \textstylenums command +%---------------------------------------------------------- +\newcommand*\tf@initialise@textfiguresfontcommands{ + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@TS}}{ + % Access old style figures via TS1 font encoding + \newcommand*\tf@textstylenums{% + \ifthenelse{\NOT\boolean{tf@liningnums} + \AND\NOT\boolean{tf@suppressfiguressubstitution}}{% + \ifbool{tf@debug}{\color{\TF@DEBUG@COLOUR@TS}}{}% + \fontencoding{TS1}\selectfont% + }{}% + } + }{ + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@SC}}{ + % Access old style figures via small caps + \newcommand*\tf@textstylenums{% + \ifthenelse{\NOT\boolean{tf@liningnums} + \AND\NOT\boolean{tf@suppressfiguressubstitution}}{% + \ifbool{tf@debug}{\color{\TF@DEBUG@COLOUR@SC}}{}% + \scshape% + }{}% + } + }{ + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@XF}}{ + % Access old style figures via substitute font + \providecommand*\lsstyle{} % create no-op if microtype isn't loaded + \newcommand*\tf@textstylenums{% + \ifthenelse{\NOT\boolean{tf@liningnums} + \AND\NOT\boolean{tf@suppressfiguressubstitution}}{% + \ifthenelse{\NOT\equal{\tf@textfiguresspacing}{0} + \AND\value{tf@enable@textnumspacing} = 0}% + {\lsstyle}{}% % microtype-based text figures spacing + \ifbool{tf@debug}{\color{\TF@DEBUG@COLOUR@XF}}{}% + \notbool{tf@textfiguresscaledatloadtime} + {\scalefont{\tf@textfiguresscalefactor}}{}% + \fontencoding{\tf@substosffontencoding}% + \fontfamily{\tf@substosffont}% + \selectfont% + }{}% + } + }{ + % Otherwise, access old style figures natively (i.e., deliver + % whatever the loaded font provides, which is either text + % figures or not) + \newcommand*\tf@textstylenums{% + \ifthenelse{\NOT\boolean{tf@liningnums} + \AND\NOT\boolean{tf@suppressfiguressubstitution}}{% + \ifbool{tf@debug}{\color{\TF@DEBUG@COLOUR@JF}}{}% + }{}% + } + }}} + \robustify{\tf@textstylenums} + + % Define AUTHOR-LEVEL textnums environment + %----------------------------------------- + \newenvironment{textnums}{% + \tf@textstylenums% + }{} + + % ... and AUTHOR-LEVEL \textstylenums (syn: \tsf) command + %-------------------------------------------------------- + \newcommand\textstylenums[1]{% + \begingroup% + \begin{textnums}##1\end{textnums}% + \endgroup% + } + + \newcommand\tsf[1]{% + \begingroup% + \begin{textnums}##1\end{textnums}% + \endgroup% + } + + % ... and AUTHOR-LEVEL \liningstylenums (syn: \lsf) command + %---------------------------------------------------------- + \newcommand\liningstylenums[1]{% + \begingroup% + \begin{liningnums}##1\end{liningnums}% + \endgroup% + } + + \newcommand\lsf[1]{% + \begingroup% + \begin{liningnums}##1\end{liningnums}% + \endgroup% + } + + % AUTHOR-LEVEL commands to enable/disable textnums letterspacing + % (uses a counter for reentrancy) + \newcounter{tf@enable@textnumspacing} + \newcommand*\enabletextnumspacing{\addtocounter{tf@enable@textnumspacing}{1}} + \newcommand*\disabletextnumspacing{\addtocounter{tf@enable@textnumspacing}{-1}} + \newcommand*\reenabletextnumspacing{\setcounter{tf@enable@textnumspacing}{0}} + \reenabletextnumspacing +} + +% Typeface selection +% ================== +\TF@PackageDebugInfo{Loading typefaces in load order [\tf@fontloadorder] ...} + +% Font loading commands are (generally) processed in this order: +% textfigures, symbols, math, roman, sans serif, teletype +% +% Where possible, fonts are loaded using std packages (\tf@usefontpackage{...}), +% otherwise they are loaded via direct commands (\renewcommand\rmdefault{...}). +% Many packages load "matching" fonts, e.g., one might load courier tt +% alongside the rm font that it specifies. The typeface package attempts to +% reverse this when it can in order to ensure that when users specify +% particular fonts, that is in fact what they get, rather than, for example, +% getting the "matching" font decided by a font package author some long time ago. +% +% Note that when loading multiple font packages one after the other, glyph +% definitions can potentially collide. When this happens, later loaded +% glyphs can (often silently) override earlier definitions or in other case +% simply trigger errors. You should (must) always thoroughly check your output +% pdf document to ensure that the body text, math, symbols and (potential) text +% figures substitution fonts work together to produce desired results. Not all +% combinations will produce satisfactory output. +% +% The "textfigures, symbols, math, roman, sans serif, teletype" font +% load order should not be wholly relied upon. To obviate the "clash of +% glyphs" problem as best we can, this package will, for example, load the +% roman font family before loading math where a particular math package +% requires the standard load ordering to change. We might even, in extreme +% cases, load the roman font, then math, then to counteract a certain side +% effect, reload roman to re-establish its original configuration. Specific +% behavioural rules for individual situations are set out in the code above. +% Bottom line, however: we try to achieve the combination of typefaces as the +% end-user most likely intended. +%------------------------------------------------------------------------------ +% Construct and execute font load commands macro in specified font load order +\newcommand*\tf@loadfonts{} +\renewcommand*\do[1]{ + \ifcsdef{beforeloading#1} + {\g@addto@macro{\tf@loadfonts}{\csname beforeloading#1\endcsname}}{} + \g@addto@macro{\tf@loadfonts}{\csname tf@load#1typeface\endcsname} + \ifcsdef{afterloading#1} + {\g@addto@macro{\tf@loadfonts}{\csname afterloading#1\endcsname}}{} +} +\expandafter\tf@doColonSeparatedList\expandafter{\tf@fontloadorder} +\tf@loadfonts + +% After loading fonts, set up font scaling ... +\forcsvlist{\tf@initialise@fontscaling}{sf,tt,math,textfigures} + +% ... and math size declarations ... +\tf@initialise@mathsizes + +% ... and textfigures font spacing ... +\tf@initialise@textfiguresfontspacing + +% ... and text figures author-level commands +\tf@initialise@textfiguresfontcommands + +% Finally, hook our work into LaTeX's font selection machinery +% ============================================================ + +\TF@PackageDebugInfo{Hooking font scaling into LaTeX commands ...} + +% Guard against the (presumably exceedingly unlikely) event where sf and +% tt are 1) the same font, yet 2) are being scaled by different amounts +\tf@newbool{tf@@sfttscaleconflict}{false} +\ifthenelse{\equal{\tf@sfdefault}{\tf@ttdefault}}{ + \@tempdima=\tf@sfscalefactor\p@ + \@tempdimb=\tf@ttscalefactor\p@ + \ifthenelse{\NOT\lengthtest{\@tempdima = \@tempdimb}}{ + \booltrue{tf@@sfttscaleconflict} + \TF@PackageError{% + Requested sans serif and teletypewriter fonts are\MessageBreak + identical except for differing scale factors\MessageBreak + [sf=\tf@sfscalefactor, tt=\tf@ttscalefactor].\MessageBreak + **** This isn't going to work. Please help\MessageBreak + **** me out. I don't know what to do}{} + \global\boolfalse{tf@sfscaledatloadtime} + \global\boolfalse{tf@ttscaledatloadtime} + }{} +}{} + +\def\empty@sfcnt#1{% + % Subclass LaTeX's default font size function, inserting sf/tt % TODO: confirm this works with lua, xetex + % scale factors into \optional@arg if it is empty at the time + \def\tf@@sizeinfofunction{#1}% + \tf@newbool{tf@@sffamily}{false}% + \tf@newbool{tf@@ttfamily}{false}% + \ifdefstrequal{\tf@sfdefault}{\f@family}{\booltrue{tf@@sffamily}}{}% + \ifdefstrequal{\tf@ttdefault}{\f@family}{\booltrue{tf@@ttfamily}}{}% + % + % Last chance for font load functions to affect load-time scaling + \tf@empty@sfcnt@hook% + % + % So long as it's empty, set \optional@arg to appropriate scale factor + \ifthenelse{\equal{\optional@arg}{}\AND\NOT\boolean{tf@@sfttscaleconflict}}{% + \ifthenelse{\boolean{tf@@sffamily} + \AND\NOT\equal{\tf@sfscalemethod}{\TF@NO@SCALE}}{% + \edef\optional@arg{\tf@sfscalefactor}% + \def\tf@@sizeinfofunction{\@font@info}% + \xdef\tf@sfscalemethod{\TF@FX@SCALE}% + \global\booltrue{tf@sfscaledatloadtime}% + \TF@PackageInfo{% + Scaling sf font `\curr@fontshape' (\tf@sfscalefactor*\f@size pt)}% + }{}% + \ifthenelse{\boolean{tf@@ttfamily} + \AND\NOT\equal{\tf@ttscalemethod}{\TF@NO@SCALE}}{% + \edef\optional@arg{\tf@ttscalefactor}% + \def\tf@@sizeinfofunction{\@font@info}% + \xdef\tf@ttscalemethod{\TF@FX@SCALE}% + \global\booltrue{tf@ttscaledatloadtime}% + \TF@PackageInfo{% + Scaling tt font `\curr@fontshape' (\tf@ttscalefactor*\f@size pt)}% + }{}% + }{}% + % + \@tempdimb \f@size\p@% + \ifx\optional@arg\@empty% + \else% + \@tempdimb \optional@arg\@tempdimb% + \tf@@sizeinfofunction{Font\space shape\space `\curr@fontshape'\space + will\space be\MessageBreak + scaled\space to\space size\space \the\@tempdimb}% + \fi% + \edef\external@font{\mandatory@arg\space at\the\@tempdimb}% +} + +\tf@newbool{tf@suppressfiguressubstitution}{false} +\newcommand*\enablefiguressubstitution{% + \boolfalse{tf@suppressfiguressubstitution}% +} +\newcommand*\disablefiguressubstitution{% + \booltrue{tf@suppressfiguressubstitution}% +} + +\let\tf@oldrmfamily\rmfamily +\renewrobustcmd\rmfamily{% + \enablefiguressubstitution% % we enable text figures substitution + \tf@oldrmfamily% % even if user has changed \rmdefault + \ifbool{tf@debug}{\color{\TF@DEBUG@COLOUR@RM}}{}% +} + +\let\tf@oldsffamily\sffamily +\renewrobustcmd\sffamily{% + \disablefiguressubstitution% + \tf@oldsffamily% + \ifbool{tf@debug}{\color{\TF@DEBUG@COLOUR@SF}}{}% +} + +\let\tf@oldttfamily\ttfamily +\renewrobustcmd\ttfamily{% + \disablefiguressubstitution% + \tf@oldttfamily% + \ifbool{tf@debug}{\color{\TF@DEBUG@COLOUR@TT}}{}% +} + +% Provide AUTHOR level read-only access to several internal values +%----------------------------------------------------------------- +\xdef\rmprintname{\tf@rmprintname} +\xdef\sfprintname{\tf@sfprintname} +\xdef\ttprintname{\tf@ttprintname} +\xdef\mathprintname{\tf@mathprintname} +\xdef\symbolsprintname{\tf@symbolsprintname} +\xdef\textfiguresprintname{\tf@textfiguresprintname} + +% Package info and typeface testing commands +% ========================================== + +\ifbool{tf@printinfo}{ + \TF@PackageDebugInfo{Configuring print info commands...} + + \@ifpackageloaded{array}{\relax}{\usepackage{array}} + \everymath=\expandafter{% + \the\everymath% + \ifbool{tf@debug}{\color{\TF@DEBUG@COLOUR@MATH}}{}% + } + + \providecommand*\tfabc{abcdefghijklmnopqrstuvwxyz} + \providecommand*\tfABC{ABCDEFGHIJKLMNOPQRSTUVWXYZ} + \providecommand*\tfdigits{0123456789} + \providecommand*\tftext{abcdefghijklmnopqrstuvwxyz % + ct st th ff fi fj fl ffi ffl ft ij \ae\ \oe\ \"o\ \~e\ wavaw % + {\large large} {\footnotesize footnotesize}} + \providecommand*\tfTEXT{ABCDEFGHIJKLMNOPQRSTUVWXYZ % + Ct St Th Ff Fi Fj Fl Ffi Ffl IJ \AE\ \OE\ \"O\ \~E\ WAVAW} + \providecommand*\tfpunctuation{\$ \% . , : ; ? \& ! \# = ( \_ ) + - -- ---} + + \newcommand\tfprintinfopage{% + \pagestyle{empty}% + \raggedbottom% + \tfprintpackageoptions% + \tfprintinfo% + \tfprinttext{rm}% + \tfprinttext{sf}% + \tfprinttext{tt}% + \tfprintfigures{rm}% + \tfprinttextalphabets% + } + + \newcommand*\tf@@printfontname[1]{% % helper command + \ifthenelse{ + \equal{\csname tf@#1fontdefaultstatus\endcsname}{\TF@IMPLICITDEFAULT}}{% + <\TF@DEFAULT> \tf@@printfontname@@helper{#1}% + }{% + \ifthenelse{ + \equal{\csname tf@#1fontdefaultstatus\endcsname}{\TF@EXPLICITDEFAULT}}{% + \TF@DEFAULT\space\tf@@printfontname@@helper{#1}% + }{% + \ifthenelse{ + \equal{\csname tf@#1fontdefaultstatus\endcsname}{\TF@EXPLICITOTHER}}{% + \csname tf@#1fontname\endcsname% + }{}}} + } + + \newcommand*\tf@@printfontname@@helper[1]{% % helper of helper command + \ifthenelse{\NOT\equal{\csname tf@#1fontname\endcsname}{\TF@DEFAULT}} + {(\csname tf@#1fontname\endcsname\space-- see `\TF@CONFIGFILE')} + {}% + } + + \newcommand\tfprintpackageoptions{{% + \rmfamily\selectfont\noindent% + \texttt{typeface}\ package options:\par\noindent% + \begin{tabular}{@{} + >{\ttfamily}l + >{\ttfamily}l@{\hspace{2.5em}} + >{\ttfamily}l + >{\ttfamily}l@{}} +%------------------------------------------------------------------------------ + typeface & \tf@@printfontname{rm} & + fontencoding & + \ifthenelse{\equal{\tf@fontencodingdefaultstatus}{\TF@IMPLICITDEFAULT}}{% + <\TF@DEFAULT> (\TF@DEFAULTFONTENCODING)% + }{% + \tf@fontencodingstring\space% + \ifthenelse{\equal{\tf@fontencodingdefaultstatus}{\TF@EXPLICITDEFAULT} + \OR\value{tf@fontencodingsuboptionscount} > 1}{% + (\tf@fontencodingprimary)% + }{}% + } \\ +%------------------------------------------------------------------------------ + textfigures & \tf@@printfontname{textfigures}% + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@TS}} + {(TS1)} + {\ifthenelse{\equal{\tf@osf@method}{\TF@OSF@SC}} + {(smallcaps)} + {}% + } & + inputencoding & + \ifthenelse{\equal{\tf@inputencodingdefaultstatus}{\TF@IMPLICITDEFAULT}}{% + <\TF@DEFAULT> (\TF@DEFAULTINPUTENCODING)% + }{% + \tf@inputencodingstring\space% + \ifthenelse{\equal{\tf@inputencodingdefaultstatus}{\TF@EXPLICITDEFAULT}}{% + (\tf@inputencoding)% + }{}% + } \\ +%------------------------------------------------------------------------------ + sanstypeface & \tf@@printfontname{sf} & + textcomp & + \ifthenelse{\equal{\tf@textcompdefaultstatus}{\TF@IMPLICITDEFAULT}}{% + <\TF@DEFAULT> (\TF@DEFAULTTEXTCOMP)% + }{% + \tf@textcompstring\space% + \ifthenelse{\equal{\tf@textcompdefaultstatus}{\TF@EXPLICITDEFAULT}}{% + (\tf@textcomp)% + }{}% + } \\ +%------------------------------------------------------------------------------ + monotypeface & \tf@@printfontname{tt} & + fontloadorder & \ifbool{tf@fontloadorderimplicit}{<}{}% + \ifthenelse{\equal{\tf@fontloadorder}{\TF@DEFAULTFONTLOADORDER}} + {\TF@DEFAULT} + {\tf@fontloadorder}% + \ifbool{tf@fontloadorderimplicit}{>}{} \\ +%------------------------------------------------------------------------------ + mathtypeface & \tf@@printfontname{math} & + printinfo & \ifbool{tf@printinfoimplicit}{<}{}% + \ifbool{tf@printinfo}{true}{false}% + \ifbool{tf@printinfoimplicit}{>}{} \\ +%------------------------------------------------------------------------------ + symbolstypeface & \tf@@printfontname{symbols} & + debug & \ifbool{tf@debugimplicit}{<}{}% + \ifbool{tf@debug}{true}{false}% + \ifbool{tf@debugimplicit}{>}{} \\ +%------------------------------------------------------------------------------ + \end{tabular}% + \par\medskip% + }} + + \newcommand\tfprintinfo{{% + \noindent% + \begin{tabular}{@{}lllrrrl@{}} + \ttfamily Family & \ttfamily Typeface & \ttfamily \TeX\ Name & + \ttfamily em size & \ttfamily ex size & + \ttfamily scale & \ttfamily scale time \\ + \rmfamily Roman & + \rmfamily \tf@rmprintname & + \rmfamily \fontname\the\font & + \rmfamily \tf@roundvi@pt{\the\fontdimen6\font} & + \rmfamily \tf@roundvi@pt{\the\fontdimen5\font} & + \rmfamily \tf@roundvi{1}% + \ifthenelse{\NOT\equal{\tf@rmscale}{\TF@UNSCALED}} + { [$\times$\tf@roundvi{\tf@rmscale}]}{} & + \rmfamily not scaled + \\ + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@XF}}{% + \rmfamily Text figures & + \rmfamily \tf@textfiguresprintname & + % NB, the following group will print gobbledegook if the + % \tf@substosffont typeface doesn't properly map non-numeral chars to + % standard print glyphs (e.g., see using textfigures=latinmodern) + \begingroup% + \ifbool{tf@debug}{\color{\TF@DEBUG@COLOUR@XFNAME}}{}% + \notbool{tf@textfiguresscaledatloadtime}{% + \scalefont{\tf@textfiguresscalefactor}% + }{}% + \fontencoding{\tf@substosffontencoding}% + \fontfamily{\tf@substosffont}\selectfont\fontname\the\font% + \endgroup & + \rmfamily \begin{textnums}\tf@roundvi{\strip@pt\fontdimen6\font}\end{textnums}pt & + \rmfamily \begin{textnums}\tf@roundvi{\strip@pt\fontdimen5\font}\end{textnums}pt & + \rmfamily \begin{textnums}\tf@roundvi{\tf@textfiguresscalefactor}\end{textnums}& + \rmfamily \ifthenelse{\equal{\tf@textfiguresscalemethod}{\TF@NO@SCALE} + \OR\equal{\tf@textfiguresscalefactor}{\TF@UNSCALED}} + {not scaled} + {\ifbool{tf@textfiguresscaledatloadtime}{load time}{run time}} + \\ + }{}% + \sffamily Sans Serif & + \sffamily \tf@sfprintname & + \sffamily \fontname\the\font & + \sffamily \tf@roundvi@pt{\the\fontdimen6\font} & + \sffamily \tf@roundvi@pt{\the\fontdimen5\font} & + \sffamily \tf@roundvi{\tf@sfscalefactor} & + \sffamily \ifthenelse{\equal{\tf@sfscalemethod}{\TF@NO@SCALE} + \OR\equal{\tf@sfscalefactor}{\TF@UNSCALED}} + {not scaled} + {\ifbool{tf@sffontdirty}{run time}{load time}} + \\ + \ttfamily Typewriter & + \ttfamily \tf@ttprintname & + \ttfamily \fontname\the\font & + \ttfamily \tf@roundvi@pt{\the\fontdimen6\font} & + \ttfamily \tf@roundvi@pt{\the\fontdimen5\font} & + \ttfamily \tf@roundvi{\tf@ttscalefactor} & + \ttfamily \ifthenelse{\equal{\tf@ttscalemethod}{\TF@NO@SCALE} + \OR\equal{\tf@ttscalefactor}{\TF@UNSCALED}} + {not scaled} + {\ifbool{tf@ttfontdirty}{run time}{load time}} + \\ + \rmfamily Math & + \rmfamily $\tf@mathprintname$ & + \rmfamily $\fontname\textfont\tf@mathfontfamily$ & + \rmfamily $\tf@roundvi@pt{\the\fontdimen6\textfont\tf@mathfontfamily}$ & + \rmfamily $\tf@roundvi@pt{\the\fontdimen5\textfont\tf@mathfontfamily}$ & + \rmfamily $\tf@roundvi{\tf@mathscalefactor}$ & + \rmfamily \ifthenelse{\equal{\tf@mathscalemethod}{\TF@NO@SCALE} + \OR\equal{\tf@mathscalefactor}{\TF@UNSCALED}} + {not scaled} + {\ifbool{tf@mathscaledatloadtime}{load time}{run time}} + \\ + \rmfamily Symbols & + \multicolumn{4}{l}{\rmfamily $\tf@symbolsprintname$} & & + \rmfamily \ifthenelse{\equal{\tf@mathscalemethod}{\TF@NO@SCALE} + \OR\equal{\tf@mathscalefactor}{\TF@UNSCALED}} + {not scaled} + {\ifbool{tf@mathscaledatloadtime}{load time}{run time}} + \\ + \end{tabular}% + \par\medskip% + }} + + \newcommand\tfprinttext[1]{{% + \ifthenelse{\equal{#1}{rm}}{ + \newcommand\tf@nums{\begin{textnums}0123456789\end{textnums}} + \newcommand\tf@NUMS{\begin{liningnums}0123456789\end{liningnums}} + }{ + \newcommand\tf@nums{0123456789} + \newcommand\tf@NUMS{} + }% + \csname #1family\endcsname\selectfont\noindent% + \begin{tabular}{@{}>{\csname #1family\endcsname\selectfont}l + >{\csname #1family\endcsname\selectfont}l@{}}% + `#1' family: & \ifthenelse{\equal{#1}{rm}}{\tf@rmprintname}{}% + \ifthenelse{\equal{#1}{sf}}{\tf@sfprintname}{}% + \ifthenelse{\equal{#1}{tt}}{\tf@ttprintname}{}\\ + Normal: & \tftext\ \tf@nums \\ + & \tfTEXT\ \tf@NUMS \\ + \textbf{Bold:} & \textbf{\tftext\ \tf@nums}\\ + & \textbf{\tfTEXT\ \tf@NUMS}\\ + \textit{Italic:} & \textit{\tftext\ \tf@nums}\\ + & \textit{\tfTEXT\ \tf@NUMS}\\ + \textsl{Slant:} & \textsl{\tftext\ \tf@nums}\\ + & \textsl{\tfTEXT\ \tf@NUMS}\\ + \textsc{Smallcaps:} & \textsc{\tftext\ \tf@nums}\\ + & \textsc{\tfTEXT\ \tf@NUMS}\\ + Variants: & {\fontseries{l}\selectfont Light} + {\fontseries{c}\selectfont Condensed} + {\fontseries{m}\selectfont Medium} + {\fontseries{sb}\selectfont Semi-bold} + {\fontseries{b}\selectfont Bold} + {\fontseries{bx}\selectfont Bold-extended} + {\scshape\bfseries Bold-Smallcaps} + {\fontseries{eb}\selectfont Extra-bold}\\ + \end{tabular}% + \par\medskip% + }} + + \newcommand\tfprintfigures[1]{{% + \csname #1family\endcsname\selectfont\noindent% + \begin{tabular}{@{}>{\rmfamily}l>{\rmfamily}l>{\rmfamily}l + >{\rmfamily}l>{\rmfamily}l>{\rmfamily}l + >{\rmfamily}l>{\rmfamily}l@{}} + & Normal & Italics & Bold & Bold Italics & Punctuation \\ + Plain numerals: & + 0123456789 & + \textit{0123456789} & + \textbf{0123456789} & + \textbf{\textit{0123456789}} & + \tfpunctuation \\ + $Math$: & + $0123456789$ & + $\mathit{0123456789}$ & + $\mathbf{0123456789}$ & + $\mathbf{\mathit{0123456789}}$ & + $\tfpunctuation$ \\ + \texttt{\textbraceleft liningnums\textbraceright}: & + \begin{liningnums}0123456789\end{liningnums} & + \textit{\begin{liningnums}0123456789\end{liningnums}} & + \textbf{\begin{liningnums}0123456789\end{liningnums}} & + \textbf{\textit{\begin{liningnums}0123456789\end{liningnums}}} & + \begin{liningnums}\tfpunctuation\end{liningnums} \\ + \texttt{\textbraceleft textnums\textbraceright}% + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@TS}\AND\equal{#1}{rm}} + { (TS1)} + {\ifthenelse{\equal{\tf@osf@method}{\TF@OSF@SC}\AND\equal{#1}{rm}} + { (smallcaps)}{}}: & + \begin{textnums}0123456789\end{textnums} & + \textit{\begin{textnums}0123456789\end{textnums}} & + \textbf{\begin{textnums}0123456789\end{textnums}} & + \textbf{\textit{\begin{textnums}0123456789\end{textnums}}} & + \begin{textnums}\tfpunctuation\end{textnums} \\ + \texttt{\textbackslash textstylenums}% + \ifthenelse{\equal{\tf@osf@method}{\TF@OSF@TS}\AND\equal{#1}{rm}} + { (TS1)} + {\ifthenelse{\equal{\tf@osf@method}{\TF@OSF@SC}\AND\equal{#1}{rm}} + { (smallcaps)}{}}: & + \textstylenums{0123456789} & + \textit{\textstylenums{0123456789}} & + \textbf{\textstylenums{0123456789}} & + \textbf{\textit{\textstylenums{0123456789}}} & + \textstylenums{\tfpunctuation} \\ + \texttt{\textbackslash oldstylenums}: & + \oldstylenums{0123456789} & + \textit{\oldstylenums{0123456789}} & + \textbf{\oldstylenums{0123456789}} & + \textbf{\textit{\oldstylenums{0123456789}}} & + \oldstylenums{\tfpunctuation} \\ + \texttt{\textbackslash oldstylenums} (TS1): & + {\fontencoding{TS1}\selectfont0123456789} & + {\fontencoding{TS1}\selectfont\textit{0123456789}} & + {\fontencoding{TS1}\selectfont\textbf{0123456789}} & + {\fontencoding{TS1}\selectfont\textbf{\textit{0123456789}}} & + {\fontencoding{TS1}\selectfont\tfpunctuation} \\ + \end{tabular}% + \par\medskip% + }} + + \newcommand\tfprinttextalphabets{{% + \setlength{\parindent}{0pt} + $acegmnopqrsuvwxyz$% + \textrm{acegmnopqrsuvwxyz}% + \textsf{acegmnopqrsuvwxyz}% + \texttt{acegmnopqrsuvwxyz}\ % + $bdfhijklt$% + \textrm{bdfhijklt}% + \textsf{bdfhijklt}% + \texttt{bdfhijklt}\\% + $\tfABC$\textrm{\tfABC}\textsf{\tfABC}\texttt{\tfABC}\\% + $\tfdigits$\textrm{\tfdigits}\textsf{\tfdigits}\texttt{\tfdigits}% + }\par\medskip% + } + + \newcommand\tfprinttextsample[1]{{% + \csname #1family\endcsname\selectfont\noindent% + Rank-dependent utility theories, introduced for objective probabilities + by Quiggin (\begin{textnums}1981\end{textnums}; + \begin{textnums}1982\end{textnums}) and for subjective distributions by + Schmeidler (\begin{textnums}1989\end{textnums}), reconfigure $p$ to + accommodate findings that actual choice behaviours often differ + systematically from that predicted by classical expected utility + theories (for example, see Allais, \begin{textnums}1953\end{textnums}; + Ellsberg, \begin{textnums}1961\end{textnums}; Lichtenstein \& Slovic, + \begin{textnums}1971\end{textnums}; H\"{u}fflefjord, + \begin{textnums}2004\end{textnums}). These theories accomplish their + task in two interrelated ways:\ first by discarding the ``linearity of + the probabilities'' restriction imposed by the standard rationality + assumptions, second by employing more of the information available to + individuals at decision-making time.\par\medskip% + }} + + \newcommand\tfprintmathalphabets[1]{{% + \csname #1family\endcsname\selectfont\noindent% + \edef\longestword{calligraphic:\ \ }% + \ifundef{\mathbb}{} + {\rlap{blackboard:}\phantom{\longestword}$\mathbb\tfABC$\\}% + \ifundef{\mathcal}{} + {\rlap{calligraphic:}\phantom{\longestword}$\mathcal\tfABC$\\}% + \ifundef{\mathfrak}{} + {\rlap{fraktur:}\phantom{\longestword}$\mathfrak\tfABC% + \quad\mathfrak\tfabc$\\}% + \rlap{greek:}\phantom{\longestword}$% + \Gamma\Delta\Theta\Lambda\Xi\Pi\Sigma\Upsilon\Phi\Psi\Omega% + \quad% + \alpha\beta\gamma% + \ifundef{\digamma}{.}{\digamma}% + \delta\epsilon% + \ifundef{\varepsilon}{.}{\varepsilon}% + \zeta\eta\theta% + \ifundef{\vartheta}{.}{\vartheta}% + \iota\kappa% + \ifundef{\varkappa}{.}{\varkappa}% + \lambda\mu\nu\xi\pi% + \ifundef{\varpi}{.}{\varpi}% + \rho% + \ifundef{\varrho}{.}{\varrho}% + \sigma% + \ifundef{\varsigma}{.}{\varsigma}% + \tau% + \ifundef{\varphi}{.}{\varphi}% + \upsilon\phi\chi\psi\omega% + $\\% + \ifthenelse{\NOT\isundefined{\alphaup}}{% + \phantom{\longestword$% + \Gamma\Delta\Theta\Lambda\Xi\Pi\Sigma\Upsilon\Phi\Psi\Omega% + \quad$}$% + \ifundef{\alphaup}{.}{\alphaup}% + \ifundef{\betaup}{.}{\betaup}% + \ifundef{\gammaup}{.}{\gammaup}% + \ifundef{\digammaup}{.}{\digammaup}% + \ifundef{\deltaup}{.}{\deltaup}% + \ifundef{\epsilonup}{.}{\epsilonup}% + \ifundef{\varepsilonup}{.}{\varepsilonup}% + \ifundef{\zetaup}{.}{\zetaup}% + \ifundef{\etaup}{.}{\etaup}% + \ifundef{\thetaup}{.}{\thetaup}% + \ifundef{\varthetaup}{.}{\varthetaup}% + \ifundef{\iotaup}{.}{\iotaup}% + \ifundef{\kappaup}{.}{\kappaup}% + \ifundef{\varkappaup}{.}{\varkappaup}% + \ifundef{\lambdaup}{.}{\lambdaup}% + \ifundef{\muup}{.}{\muup}% + \ifundef{\nuup}{.}{\nuup}% + \ifundef{\xiup}{.}{\xiup}% + \ifundef{\piup}{.}{\piup}% + \ifundef{\varpiup}{.}{\varpiup}% + \ifundef{\rhoup}{.}{\rhoup}% + \ifundef{\varrhoup}{.}{\varrhoup}% + \ifundef{\sigmaup}{.}{\sigmaup}% + \ifundef{\varsigmaup}{.}{\varsigmaup}% + \ifundef{\tauup}{.}{\tauup}% + \ifundef{\varphiup}{.}{\varphiup}% + \ifundef{\upsilonup}{.}{\upsilonup}% + \ifundef{\phiup}{.}{\phiup}% + \ifundef{\chiup}{.}{\chiup}% + \ifundef{\psiup}{.}{\psiup}% + \ifundef{\omegaup}{.}{\omegaup}% + $\\% + }{}% + \par\vspace{-0.5\baselineskip}% + }} + + \newcommand\tfprintmathfonts{{% + \noindent% + \parbox{\linewidth}{\ttfamily\selectfont% + \count255=0 + \textbf{Math fonts:} + \loop\ifnum\count255<15 + \the\count255.~\fontname\textfont\count255; + \advance\count255 by 1 + \repeat + \the\count255.~\fontname\textfont\count255. + }\par% + }} + + \newcommand\tfprintmathsample[1]{{% + \ifundef{\Res}{% + \edef\Res{\mathop{\operator@font Res}\nolimits}% + }{}% + \csname #1family\endcsname\selectfont\noindent% + \textbf{Theorem 1 (Residue Theorem)} % Credit: Hartke + Let $f$ be analytic in the region $G$ except for the isolated + singularities $a_1,a_2,\ldots,a_m$. If $\gamma$ is a closed rectifiable + curve in $G$ which does not pass through any of the points $a_k$ and if + $\gamma\approx 0$ in $G$ then + \begin{equation}\ifbool{tf@debug}{\color{\TF@DEBUG@COLOUR@MATH}}{}% + \frac{1}{2\pi i}\int_\gamma f = \sum_{k=1}^m n(\gamma;a_k) + \Res(f;a_k)\qquad\pi=3.1415926\dots + \end{equation}% + }} +}{ + % Stub print info definitions for whenever package option printinfo=false + %------------------------------------------------------------------------ + \newcommand\tfprintinfopage{} + \newcommand\tfprintpackageoptions{} + \newcommand\tfprintinfo{} + \newcommand\tfprinttext[1]{} + \newcommand\tfprintfigures[1]{} + \newcommand\tfprinttextalphabets{} + \newcommand\tfprinttextsample[1]{} + \newcommand\tfprintmathalphabets[1]{} + \newcommand\tfprintmathsample[1]{} +} + +\renewcommand*\familydefault{\rmdefault} % override any package-induced change +\rmfamily + +\TF@PackageDebugInfo{... package loaded} +% +%============================== end typeface.sty ============================== |