diff options
author | Karl Berry <karl@freefriends.org> | 2021-11-14 21:18:38 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-11-14 21:18:38 +0000 |
commit | ab7a84bcbf30675831657e3a3b79790e85c8dc4d (patch) | |
tree | 3c4544232e278bb593800e0b51580620a35f4304 /Master/texmf-dist/tex/latex/cochineal | |
parent | efb2d1d046b7f209f18fbc449e44ec58de6c675b (diff) |
cochineal (14nov21)
git-svn-id: svn://tug.org/texlive/trunk@61056 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/cochineal')
-rw-r--r-- | Master/texmf-dist/tex/latex/cochineal/cochineal.sty | 499 |
1 files changed, 409 insertions, 90 deletions
diff --git a/Master/texmf-dist/tex/latex/cochineal/cochineal.sty b/Master/texmf-dist/tex/latex/cochineal/cochineal.sty index 187f6a45440..15f976ce3c0 100644 --- a/Master/texmf-dist/tex/latex/cochineal/cochineal.sty +++ b/Master/texmf-dist/tex/latex/cochineal/cochineal.sty @@ -1,19 +1,50 @@ %% cochineal.sty %% \NeedsTeXFormat{LaTeX2e} -\def\fileversion{1.063} -\def\filedate{2020/09/20} +\def\fileversion{1.07} +\def\filedate{2021/11/13} \ProvidesPackage{cochineal} [\filedate\space v\fileversion.] \RequirePackage[T1]{fontenc} -\RequirePackage{textcomp} -\DeclareEncodingSubset{TS1}{Cochineal-*}{0} -\IfFileExists{mweights.sty}{\RequirePackage{mweights}}{} +\RequirePackage{ifxetex,ifluatex,xkeyval,etoolbox,textcomp} \RequirePackage{xstring,ifthen,scalefnt} % for \textfrac -\RequirePackage{etoolbox} -\IfFileExists{fontaxes.sty}{ - \RequirePackage{fontaxes} +\IfFileExists{mweights.sty}{\RequirePackage{mweights}}{} +\DeclareEncodingSubset{TS1}{Cochineal-*}{0} + +%KOMA check +\newif\ifcoch@KOMA +\@ifundefined{KOMAClassName}{}{\coch@KOMAtrue} +\@ifundefined{ver@scrextend.sty}{}{\coch@KOMAtrue} + +% Engine check +\newif\ifcoch@otf +\ifxetex + \coch@otftrue +\else\ifluatex + \coch@otftrue +\else % [pdf]LaTeX + \coch@otffalse +\fi\fi + +\ifcoch@otf% + \RequirePackage{fontspec} + \ifxetex\XeTeXtracingfonts=1\fi + \ifluatex % avoid possibly uncorrected "system" fonts + \directlua{fonts.names.set_location_precedence{ + "local", "texmf", "system" }} + \fi + \def\coch@base{Cochineal} + \newcommand{\textfrac}[3][]{{% + \mbox{% + \ifthenelse{\not\equal{#1}{}}%Test for integer portion [optional #1] + {\textlf{#1}\kern.02em}{}% + \textsu{#2\char"2044}% numerator + \textde{\kern-.154em\char"2044 #3}% denominator +}}} + +\else % type1 + \RequirePackage{fontaxes} \fa@naming@exception{figures}{{superior}{proportional}}{Sup} \fa@naming@exception{figures}{{superior}{tabular}}{Sup} \def\sufigures{\@nomath\sufigures @@ -25,9 +56,8 @@ \fa@naming@exception{figures}{{inferior}{tabular}}{Inf} \def\infigures{\@nomath\infigures \fontfigurestyle{inferior}\selectfont} - \DeclareTextFontCommand{\textin}{\infigures} - \let\textinferior\textin - + \DeclareTextFontCommand{\textinf}{\infigures} + \let\textinferior\textinf \fa@naming@exception{figures}{{denominators}{proportional}}{Dnom} \fa@naming@exception{figures}{{denominators}{tabular}}{Dnom} @@ -36,8 +66,7 @@ \DeclareTextFontCommand{\textde}{\defigures} \let\textdenominators\textde -}{} -\newcommand{\textfrac}[3][]{% like \textfrac[1]{7}{8} + \newcommand{\textfrac}[3][]{% like \textfrac[1]{7}{8} \mbox{% \ifthenelse{\not\equal{#1}{}}%Test for integer portion [optional #1] {\textlf{#1}\kern.05em}{}% @@ -67,19 +96,87 @@ \or\kern .02em% 7 \fi% \textde{#3}% denominator [#3] - }% -} + }%mbox +} % textfrac +\fi \IfFileExists{xkeyval.sty}{ - \newcommand*{\Cochineal@scale}{1} \RequirePackage{xkeyval} - \DeclareOptionX{scale}{\renewcommand*{\Cochineal@scale}{##1}} - \DeclareOptionX{scaled}{\renewcommand*{\Cochineal@scale}{##1}} -}{ + }{ \let\DeclareOptionX\DeclareOption \let\ExecuteOptionsX\ExecuteOptions \let\ProcessOptionsX\ProcessOptions } +%%%%Start Options +\newif\ifcoch@lining\coch@liningtrue +\newif\ifcoch@tabular\coch@tabulartrue % default is tabular lining figures +\DeclareOptionX{type1}[true]{% +\@nameuse{if#1}\coch@otffalse\fi +} +\DeclareOptionX{nofontspec}[true]{% +\@nameuse{if#1}\coch@otffalse\fi +} +\def\coch@defaultfeatures{} +\DeclareOptionX{defaultfeatures}{\def\coch@defaultfeatures{#1}} + +%Figure style options +\edef\coch@dfltfigurestyle{lf} +\edef\coch@dfltfigurealign{t} + +\DeclareOptionX{lining}[true]{% +\@nameuse{coch@lining#1} +} +\DeclareOptionX{lf}[true]{% +\@nameuse{coch@lining#1} +} +\DeclareOptionX{oldstyle}[true]{% +\@nameuse{if#1}% + \coch@liningfalse +\else + \coch@liningtrue +\fi +} + +\DeclareOptionX{osf}[true]{% +\@nameuse{if#1}% + \coch@liningfalse +\else + \coch@liningtrue +\fi +} +\DeclareOptionX{tabular}[true]{% +\@nameuse{coch@tabular#1} +} +\DeclareOptionX{t}[true]{% +\@nameuse{coch@tabular#1} +} +\DeclareOptionX{proportional}[true]{% +\@nameuse{if#1}% + \coch@tabularfalse +\else + \coch@tabulartrue +\fi +} +\DeclareOptionX{p}[true]{% +\@nameuse{if#1}% + \coch@tabularfalse +\else + \coch@tabulartrue +\fi +} + +%Scale +\newcommand*{\Cochineal@scale}{1} +\DeclareOptionX{scale}{\renewcommand*{\Cochineal@scale}{#1}} +\DeclareOptionX{scaled}{\renewcommand*{\Cochineal@scale}{#1}} + +%\newif\ifcoch@defaultsups +\newif\ifcoch@scosf +%\newif\ifcoch@largesc % we don't use this exc. in fd, but may in future +%\newif\ifcoch@helv \coch@helvtrue % default is to load helvetica as sans serif font +%\newif\ifcoch@sl + + \let\orig@footnote=\thefootnote \let\orig@makefnmark=\@makefnmark \def\bfseries@rm{b} @@ -94,24 +191,31 @@ \newif\if@Cochineal@thrm \newif\if@Cochineal@sups \newif\if@Cochineal@scosf -\def\useosf{\edef\Cochineal@figurestyle{OsF}} -\@onlypreamble\useosf -\def\useproportional{\edef\Cochineal@figurealign{}} -\@onlypreamble\useproportional -%\newif\ifCochineal@babel -%\ifdefined\bbl@tempa \Cochineal@babeltrue\fi - -\DeclareOptionX{lining}{\edef\Cochineal@figurestyle{LF}} -\DeclareOptionX{lf}{\edef\Cochineal@figurestyle{LF}} -\DeclareOptionX{oldstyle}{\edef\Cochineal@figurestyle{OsF}} -\DeclareOptionX{osf}{\edef\Cochineal@figurestyle{OsF}} -\DeclareOptionX{tabular}{\edef\Cochineal@figurealign{T}} -\DeclareOptionX{p}{\useproportional} -\DeclareOptionX{proportional}{\useproportional} +%\newif\ifcoch@altQ +%\newif\ifcoch@altJ +%\newif\ifcoch@oldSS +\newif\ifcoch@swashQ +\def\coch@defaultfeatures{} +\newcount\coch@cnt \coch@cnt=0 + + +%\DeclareOptionX{lining}{\edef\Cochineal@figurestyle{LF}} +%\DeclareOptionX{lf}{\edef\Cochineal@figurestyle{LF}} +%\DeclareOptionX{oldstyle}{\edef\Cochineal@figurestyle{OsF}} +%\DeclareOptionX{osf}{\edef\Cochineal@figurestyle{OsF}} +%\DeclareOptionX{tabular}{\edef\Cochineal@figurealign{T}} +%\DeclareOptionX{p}{\useproportional} +%\DeclareOptionX{proportional}{\useproportional} +%\def\coch@fnmark{} +%\DeclareOptionX{fnmarkerfont}{\def\coch@fnmark{#1}} +\DeclareOptionX{defaultfeatures}{\def\coch@defaultfeatures{#1}} +\DeclareOptionX{altQ}{\advance\coch@cnt 4 } +\DeclareOptionX{altJ}{\advance\coch@cnt\tw@} +\DeclareOptionX{oldSS}{\advance\coch@cnt\@ne} \DeclareOptionX{theoremfont}{\@Cochineal@thrmtrue} \DeclareOptionX{thmtabular}{\edef\Cochineal@@thmtab{t}} \DeclareOptionX{thmlining}{\edef\Cochineal@@thmlin{l}} -\DeclareOptionX{swashQ}{\edef\Cochineal@@swashQ{-swash}} +\DeclareOptionX{swashQ}{\edef\Cochineal@@swashQ{-swash}\coch@swashQtrue} \DeclareOptionX{sups}{\@Cochineal@supstrue} \DeclareOptionX{scosf}{\@Cochineal@scosftrue} \DeclareOptionX{bold}{\edef\bfseries@rm{b}} @@ -121,6 +225,34 @@ \ExecuteOptionsX{lining,tabular} \ProcessOptionsX\relax +\ifcoch@otf + \def\coch@dflt{} + \ifcoch@swashQ + \edef\coch@dflt{Style = Swash , + }\fi + %\coch@cnt will be 0..7 + \edef\coch@lst{} + \ifnum\coch@cnt>3 \edef\coch@lst{3}\advance\coch@cnt -4 \fi + \ifnum\coch@cnt>1 \edef\coch@lst{2,\coch@lst}\advance\coch@cnt -2 \fi + \ifnum\coch@cnt>0 \edef\coch@lst{2,\coch@lst}\fi + \ifthenelse{\not\equal{\coch@lst}{}} + {\edef\coch@dflt{\coch@dflt StylisticSet={\coch@lst} , + }}{} + \defaultfontfeatures{ + Ligatures = TeX , + Extension = .otf , + SmallCapsFeatures={Letters=SmallCaps} , + \coch@dflt , + \coch@defaultfeatures + } + +\fi + +\def\useosf{\coch@liningfalse} +\@onlypreamble\useosf +\def\useproportional{\coch@tabularfalse} +\@onlypreamble\useproportional + \if@Cochineal@thrm \ifdefined\newtheoremstyle \newtheoremstyle{plain} @@ -134,22 +266,21 @@ {} % CUSTOM-HEAD-SPEC\newtheorem{thm}{Theorem}[section] \fi% \fi -\DeclareRobustCommand{\lfstyle}{% - \not@math@alphabet\lfstyle\relax - \fontfamily{Cochineal-LF}\selectfont % -}% to get lf -\DeclareRobustCommand{\tlfstyle}{% - \not@math@alphabet\tlfstyle\relax - \fontfamily{Cochineal-TLF}\selectfont % -}% to get tlf -\DeclareRobustCommand{\osfstyle}{% - \not@math@alphabet\osfstyle\relax - \fontfamily{Cochineal-OsF}\selectfont % -}% to get osf -\DeclareRobustCommand{\tosfstyle}{% - \not@math@alphabet\tosfstyle\relax - \fontfamily{Cochineal-TOsF}\selectfont % -}% to get tosf + +% \DeclareRobustCommand{\textlf}[1]{% +% {\lfstyle #1}% +% }% to get lf +% \DeclareRobustCommand{\texttlf}[1]{% +% {\tlfstyle #1}% +% }% to get tlf +% \DeclareRobustCommand{\textosf}[1]{% +% {\osfstyle #1}% +% }% to get osf +% \DeclareRobustCommand{\texttosf}[1]{% +% {\tosfstyle #1}% +% }% to get tosf + + \DeclareRobustCommand{\textlf}[1]{% {\lfstyle #1}% }% to get lf @@ -162,50 +293,238 @@ \DeclareRobustCommand{\texttosf}[1]{% {\tosfstyle #1}% }% to get tosf -\if@Cochineal@scosf % -\DeclareRobustCommand{\textsc}[1]{% -{\fontfamily{Cochineal-\Cochineal@figurealign% -OsF}\fontshape{sc}\selectfont #1}% -}\fi% use OsF in small caps -\renewcommand*{\rmdefault}{Cochineal-TLF} % always TLF in math -\renewcommand*{\familydefault}{\rmdefault} -\newcommand{\Qswash}{{\fontencoding{TS1}\fontfamily{Cochineal-LF}\selectfont \char59 }} -\newcommand{\Qnoswash}{{\fontencoding{TS1}\fontfamily{Cochineal-LF}\selectfont \char58 }} - -\DeclareTextCommand{\textcircled}{TS1}[1]{\hmode@bgroup - \ooalign{% - \hfil \raise .37ex\hbox {\fontencoding{T1}\fontfamily{Cochineal-TOsF}\fontseries{m}\fontshape{sc}\selectfont\scalefont{.72}% -\lowercase{#1}}\hfil \crcr - \char 79 %\textbigcircle - }% - \egroup} - -\if@Cochineal@sups % - \ifdefined\sufigures - \def\f@@tn@te{footnote} - \def\@makefnmark{% - \ifx\@mpfn\f@@tn@te% - \ifx\thefootnote\orig@footnote% - \hbox{\sufigures\hspace*{.04em}\@thefnmark\hspace*{.04em}}% - \else% - \orig@makefnmark% - \fi - \else% - \orig@makefnmark% - \fi}% - \fi% + +\ifcoch@otf + \def\coch@nft{\if t\Cochineal@thmtab Monospaced% + \else Proportional\fi} + \def\coch@sty{\if l\Cochineal@thmlin Lining% + \else OldStyle\fi} + \DeclareTextFontCommand{% + \slshape}{\addfontfeatures{Numbers = {\coch@nft,\coch@sty}, RawFeature=+salt}\itshape} % for theorems + \DeclareTextFontCommand{\textsl}{\slshape} + + \DeclareTextFontCommand{% + \oldstylenums}{\addfontfeatures{Numbers=OldStyle}} + \DeclareTextFontCommand{% + \liningnums}{\addfontfeatures{Numbers=Lining}} + \DeclareTextFontCommand{% + \tabularnums}{\addfontfeatures{Numbers=Tabular}} + \DeclareTextFontCommand{% + \proportionalnums}{\addfontfeatures{Numbers=Proportional}} + \DeclareTextFontCommand{% + \osfstyle}{\addfontfeatures{Numbers={Proportional,OldStyle}}} + \DeclareTextFontCommand{% + \tosfstyle}{\addfontfeatures{Numbers={Tabular,OldStyle}}} + \DeclareTextFontCommand{% + \tlfstyle}{\addfontfeatures{Numbers={Tabular,Lining}}} + \DeclareTextFontCommand{% + \lfstyle}{\addfontfeatures{Numbers={Proportional,Lining}}} + \newfontfamily\cochTLF + [ %IgnoreFontspecFile , + Numbers = {Monospaced,Lining}, + Scale = \Cochineal@scale , + UprightFont = *-Roman , + ItalicFont = *-Italic , + %SlantedFont = *-Slanted , + BoldFont = *-Bold , + BoldItalicFont = *-BoldItalic , + % BoldSlantedFont= *-BoldSlanted , + ] {\coch@base} + \newfontfamily\cochTOsF + [ %IgnoreFontspecFile , + Numbers = {Monospaced,OldStyle} , + Scale = \Cochineal@scale , + UprightFont = *-Roman , + ItalicFont = *-Italic , + %SlantedFont = *-Slanted , + BoldFont = *-Bold , + BoldItalicFont = *-BoldItalic , + %BoldSlantedFont= *-BoldSlanted , + ] {\coch@base} + \newfontfamily\cochOsF + [ %IgnoreFontspecFile , + Numbers = {Proportional,OldStyle} , + Scale = \Cochineal@scale , + UprightFont = *-Roman , + ItalicFont = *-Italic , + %SlantedFont = *-Slanted , + BoldFont = *-Bold , + BoldItalicFont = *-BoldItalic , + %BoldSlantedFont= *-BoldSlanted , + ] {\coch@base} + \newfontfamily\cochLF + [ %IgnoreFontspecFile , + Numbers = {Proportional,Lining} , + Scale = \Cochineal@scale , + UprightFont = *-Roman , + ItalicFont = *-Italic , + %SlantedFont = *-Slanted , + BoldFont = *-Bold , + BoldItalicFont = *-BoldItalic , + %BoldSlantedFont= *-BoldSlanted , + ] {\coch@base} + \providecommand\sufigures{\addfontfeatures{VerticalPosition=Superior}} + \providecommand\defigures{\addfontfeatures{RawFeature=+dnom}} +\providecommand\infigures{\addfontfeatures{VerticalPosition=ScientificInferior}} + \DeclareTextFontCommand{\textsu}{\sufigures} + \let\textsuperior\textsu + \DeclareTextFontCommand{\textde}{\defigures} + \let\textdenominator\textde + \DeclareTextFontCommand{\textinf}{\infigures} + \let\textinferior\textinf + + \renewcommand*{\textcircled}[1]{\hmode@bgroup + \ooalign{% +\hfil \raise .37ex\hbox {{\cochTOsF\addfontfeatures{RawFeature=+smcp}\def\x{\lowercase{#1}}\scalefont{.72}\x}}\hfil \crcr \symbol{"25EF}}% +\egroup} + \newcommand{\Qswash}{{\addfontfeatures{RawFeature=+swsh}Q}} + \newcommand{\Qnoswash}{{\addfontfeatures{RawFeature=-swsh}Q}} +% \newcommand{\coch@altQ}{{\addfontfeatures{RawFeature=+ss03}}} +% \newcommand{\coch@altJ}{{\addfontfeatures{RawFeature=+ss02}}} +% \newcommand{\coch@oldSS}{{\addfontfeatures{RawFeature=+ss01}}} + \if@Cochineal@sups % + \usepackage{realscripts} + %\newfontfamily\Timessu{TeXGyreTermesX} + + \ifcoch@KOMA + \setkomafont{footnotelabel}{\normalfont} + \else + \renewcommand\footnotemarkfont{\normalfont} + \fi + \fi + +\else % type1 +% \DeclareRobustCommand\thfamily % new family for theorem font +% {\not@math@alphabet\thfamily\relax +% \fontfamily\thdefault\selectfont} +% \DeclareRobustCommand{\textth}[1]{% +% {\thfamily #1}% +%} +%\let\textthit\textth + \renewcommand*{\rmdefault}{Cochineal-TLF} % always TLF in math + \renewcommand*{\familydefault}{\rmdefault} + \newcommand{\Qswash}{{\fontencoding{TS1}\fontfamily{Cochineal-LF}\selectfont \char59 }} + \newcommand{\Qnoswash}{{\fontencoding{TS1}\fontfamily{Cochineal-LF}\selectfont \char58 }} + \DeclareRobustCommand{\lfstyle}{% + \not@math@alphabet\lfstyle\relax + \fontfamily{Cochineal-LF}\selectfont % + }% to get lf + \DeclareRobustCommand{\tlfstyle}{% + \not@math@alphabet\tlfstyle\relax + \fontfamily{Cochineal-TLF}\selectfont % + }% to get tlf + \DeclareRobustCommand{\osfstyle}{% + \not@math@alphabet\osfstyle\relax + \fontfamily{Cochineal-OsF}\selectfont % + }% to get osf + \DeclareRobustCommand{\tosfstyle}{% + \not@math@alphabet\tosfstyle\relax + \fontfamily{Cochineal-TOsF}\selectfont % + }% to get tosf + + \if@Cochineal@sups % + \ifcoch@KOMA % + \else % not KOMA + \ifdefined\sufigures + \def\f@@tn@te{footnote} + \def\@makefnmark{% + \ifx\@mpfn\f@@tn@te% + \ifx\thefootnote\orig@footnote% + \hbox{\sufigures\hspace*{.04em}\@thefnmark\hspace*{.04em}}% + \else% + \orig@makefnmark% + \fi + \else% + \orig@makefnmark% + \fi}% + \fi% + \fi + \fi + + \DeclareTextCommand{\textcircled}{TS1}[1]{\hmode@bgroup + \ooalign{% + \hfil \raise .37ex\hbox {\fontencoding{T1}\fontfamily{Cochineal-TOsF}\fontseries{m}\fontshape{sc}\selectfont\scalefont{.72}% + \lowercase{#1}}\hfil \crcr + \char 79 %\textbigcircle + }% + \egroup} + \fi -%\ifCochineal@babel -% \renewcommand*{\rmdefault}{Cochineal-\Cochineal@figurealign% -% \Cochineal@figurestyle} -% \normalfont -%\else - \AtEndPreamble{% +\AtEndPreamble{% + \ifcoch@otf + \ifcoch@lining + \def\coch@figurestyle{Lining} + \else + \def\coch@figurestyle{OldStyle} + \fi + \ifcoch@tabular + \def\coch@figurealign{Monospaced} + \else + \def\coch@figurealign{Proportional} + \fi + + \setmainfont + [%IgnoreFontspecFile , + Extension = .otf , + %Path = ./ , + Numbers = {\coch@figurealign,\coch@figurestyle}, + Scale = \Cochineal@scale , + UprightFont = Cochineal-Roman , + ItalicFont = Cochineal-Italic , + % SlantedFont = *-Slanted , + BoldFont = Cochineal-Bold , + BoldItalicFont = Cochineal-BoldItalic , + %BoldSlantedFont= *-BoldSlanted , + %SmallCapsFeatures={Letters=SmallCaps} , + ] {\coch@base} + \newfontface\circledtxt{\coch@base-Roman} + [%IgnoreFontspecFile , + Scale = \Cochineal@scale , + %Numbers = {Monospaced,OldStyle} , + SmallCapsFeatures={Letters=SmallCaps} , + ] + \if@Cochineal@scosf + \edef\coch@fnt{\expandafter\csname coch\ifcoch@tabular T\fi OsF\endcsname} + \DeclareRobustCommand{\textsc}[1]{% + {\coch@fnt \addfontfeatures{RawFeature=+smcp}#1}}% +%\show\coch@fnt + \fi + \else % type1 + \ifcoch@tabular + \def\Cochineal@figurealign{T} + \else + \def\Cochineal@figurealign{} + \fi + \ifcoch@lining + \def\Cochineal@figurestyle{LF} + \else + \def\Cochineal@figurestyle{OsF} + \fi + \DeclareTextFontCommand{% + \oldstylenums}{Cochineal-\Cochineal@figurealign OsF} + \DeclareTextFontCommand{% + \liningnums}{Cochineal-\Cochineal@figurealign LF} + \DeclareTextFontCommand{% + \tabularnums}{\fontfamily{Cochineal-T\Cochineal@figurestyle}\selectfont} + \DeclareTextFontCommand{% + \proportionalnums}{\fontfamily{Cochineal-\Cochineal@figurestyle}\selectfont} + \if@Cochineal@scosf % + \DeclareRobustCommand{\textsc}[1]{% + {\fontfamily{Cochineal-\Cochineal@figurealign% + OsF}\fontshape{sc}\selectfont #1}% + }\fi% use OsF in small caps \renewcommand*{\rmdefault}{Cochineal-\Cochineal@figurealign% \Cochineal@figurestyle} - \normalfont} + \normalfont + \renewcommand*{\familydefault}{\rmdefault} + +% \ifCochineal@thrm +% \theoremstyle{plain} +% \patchcmd{\th@plain}{\itshape}{\slshape}{\message{Replaced itshape by slshape in theorem style plain.}}{\message{Unable to replace itshape by slshape in theorem style plain.}} +% \fi + \fi +} %\fi -\renewcommand*{\familydefault}{\rmdefault} \endinput |