r3tex

custom LuaTeX format
git clone git://git.rr3.xyz/r3tex
Log | Files | Refs | README | LICENSE

commit 8550d0b3e6ae5b06222f1a199b63509b318560e7
parent 87a3006ec0abe8133db522d66c5eba0d1028dab2
Author: robert <robertrussell.72001@gmail.com>
Date:   Mon, 24 Jan 2022 22:09:50 -0800

Put temp font system in place

Diffstat:
Mmath.tex | 14+++++++++-----
Mr3tex.tex | 1+
Atmpfont.tex | 328+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 338 insertions(+), 5 deletions(-)

diff --git a/math.tex b/math.tex @@ -102,11 +102,15 @@ \def\Bigl{\mathopen\Big} \def\Bigm{\mathrel\Big} \def\Bigr{\mathclose\Big} \def\biggl{\mathopen\bigg} \def\biggm{\mathrel\bigg} \def\biggr{\mathclose\bigg} \def\Biggl{\mathopen\Bigg} \def\Biggm{\mathrel\Bigg} \def\Biggr{\mathclose\Bigg} -% XXX hard-coded dimens -\def\big#1{{\hbox{$\left#1\vbox to8.5\p@{}\right.\n@space$}}} -\def\Big#1{{\hbox{$\left#1\vbox to11.5\p@{}\right.\n@space$}}} -\def\bigg#1{{\hbox{$\left#1\vbox to14.5\p@{}\right.\n@space$}}} -\def\Bigg#1{{\hbox{$\left#1\vbox to17.5\p@{}\right.\n@space$}}} +% TODO need to reconsider when new font system designed +\def\big#1{{\hbox{$\left#1\vbox to\Fbight{}\right.\n@space$}}} +\def\Big#1{{\hbox{$\left#1\vbox to\FBight{}\right.\n@space$}}} +\def\bigg#1{{\hbox{$\left#1\vbox to\Fbigght{}\right.\n@space$}}} +\def\Bigg#1{{\hbox{$\left#1\vbox to\FBigght{}\right.\n@space$}}} +% \def\big#1{{\hbox{$\left#1\vbox to8.5\p@{}\right.\n@space$}}} +% \def\Big#1{{\hbox{$\left#1\vbox to11.5\p@{}\right.\n@space$}}} +% \def\bigg#1{{\hbox{$\left#1\vbox to14.5\p@{}\right.\n@space$}}} +% \def\Bigg#1{{\hbox{$\left#1\vbox to17.5\p@{}\right.\n@space$}}} \def\n@space{\nulldelimiterspace\z@ \m@th} \def\choose{\atopwithdelims()} diff --git a/r3tex.tex b/r3tex.tex @@ -15,6 +15,7 @@ % \input verbatim % \input hyphen % \input graphics +\input tmpfont % TODO tmp % Libraries: % pseudocode diff --git a/tmpfont.tex b/tmpfont.tex @@ -0,0 +1,328 @@ +% This is mostly copied from defs.tex, with some minor tweaks to work with +% r3tex. This is to be replaced with a better font system using what I learned +% from writing and using the following. + + + +% Font selection system + +% Most of the complexity in this font loading system is to make loading fonts +% at a given size easy. I.e., the system automatically picks the right font +% to scale, if necessary. A *font set* is a list of the same font at different +% design sizes in the form of a macro. E.g., +% \def\FSmyfs{myfs=\\17:myfont17;\\14:myfont14;;} +% (By convention, font set macros start with "FS".) +% Whenever we load a font from a font set, the font with the maximum design +% size that is no larger than the desired size is scaled appropriately. +% In the above example, "myfs" at 17pt will choose "myfont17 at17pt", while +% "myfs" at 16pt will choose "myfont14 at 16pt". As a special case, the +% smallest font will be chosen for sizes smaller than it. +% \FSnull is a special font set that means "always use \nullfont". +% +% Fonts in font sets may have a non-default skewchar or hyphenchar by using +% \Fskew and \Fhyph. See FScm.tex for examples of how to use these macros. +% Fonts in font sets can also be scaled using \Fscale<numerator>/<denominator>. +% (Don't make <numerator> too big, or else you'll overflow TeX's max dimen!) +% +% Math families are reassigned by redefining the 16 corresponding \FfamsetX +% macros. Text fonts are changed by letting \rmset, \bfset, etc. be equal to +% the desired font set. When adding new font styles (e.g., a bold slanted text +% font), it may also be necessary to redefine \Fupdfonts so that the associated +% style switch macros are updated appropriately. In any case, see FScm.tex for +% examples. + +\let\newfam=\@undefined +\def\newfam{\errmessage{Don't use \noexpand\newfam}} + +\newdimen\Fsize \newdimen\Ftsize \newdimen\Fssize \newdimen\Fsssize +\newdimen\Fbight \newdimen\FBight \newdimen\Fbigght \newdimen\FBigght +\newcount\@Fskewchar \newcount\@Fhyphenchar +\newcount\@Fscalenum \newcount\@Fscaleden + +\def\FSnull{(null)=;;} +\def\Fskew{\global\@Fskewchar=} +\def\Fhyph{\global\@Fhyphenchar=} +\def\Fscale#1/{\global\@Fscalenum=#1\relax \global\@Fscaleden=} + +\def\@Fbasename#1=#2;;{#1} +\def\@Fentries#1=#2;;{#2;} +\def\@Fgobble#1;{} +\def\@Fsearch#1:#2;{% + \gdef\@Fname{#2 }% + \ifdim#1pt>\@dimen \else \let\\=\@Fgobble \fi +} + +% \@Fload loads a font with size \dimenA from font set #1 according to the +% rules described above. +\def\@Fload#1{% + \@Fskewchar=\defaultskewchar \@Fhyphenchar=\defaulthyphenchar + \@Fscalenum=1 \@Fscaleden=1 + {\let\\=\@Fsearch \ea\@Fentries#1}% + \dimenB=\dimexpr\dimenA*\@Fscalenum/\@Fscaleden\relax + \font\Ffont=\@Fname at\dimenA + \skewchar\Ffont=\@Fskewchar \hyphenchar\Ffont=\@Fhyphenchar +} + +% \Ffind finds a font with size \dimenA from font set #1. If it doesn't +% exist, load it. In either case, the resulting font is \Ffont. +\def\Ffind#1{% + \ifx#1\FSnull + \let\Ffont=\nullfont + \else + \letcs\Ffont{\ea\@Fbasename#1\the\dimenA}% + \ifx\Ffont\relax + \@Fload{#1}% + \cslet{\ea\@Fbasename#1\the\dimenA}\Ffont + \fi + \fi +} + +% \Fdef is a friendly wrapper of \Ffind. E.g., \Fdef\myfont\FScmr15pt loads +% cmr at 15pt into \myfont. +\def\Fdef#1#2{\def\@{\Ffind#2\let#1=\Ffont}\afterassignment\@\dimenA=} + +\def\@Fdecompose#1#2#3{\let\@Ftset=#1\let\@Fsset=#2\let\@Fssset=#3} +\def\@Fupdfam"#1#2{% + \ea\@Fdecompose#2% + \dimenA=\Ftsize \Ffind\@Ftset\textfont"#1=\Ffont + \dimenA=\Fssize \Ffind\@Fsset\scriptfont"#1=\Ffont + \dimenA=\Fsssize \Ffind\@Fssset\scriptscriptfont"#1=\Ffont +} +\def\Fupdfams{% + \@Fupdfam"0\Ffamseta \@Fupdfam"1\Ffamsetb + \@Fupdfam"2\Ffamsetc \@Fupdfam"3\Ffamsetd + \@Fupdfam"4\Ffamsete \@Fupdfam"5\Ffamsetf + \@Fupdfam"6\Ffamsetg \@Fupdfam"7\Ffamseth + \@Fupdfam"8\Ffamseti \@Fupdfam"9\Ffamsetj + \@Fupdfam"A\FfamsetA \@Fupdfam"B\FfamsetB + \@Fupdfam"C\FfamsetC \@Fupdfam"D\FfamsetD + \@Fupdfam"E\FfamsetE \@Fupdfam"F\FfamsetF +} +\def\Fupdfonts{\dimenA=\Fsize \Fupduser} +\def\@Fupddelim#1#2{% + \setbox\boxA=\vbox{\hbox{$\m@th#2$}\kern0pt}% + #1=\dimexpr\ht\boxA/2 + \fontdimen22\textfont2\relax +} +\def\Fupddelims{% + \@Fupddelim\Fbight\Fbigchar + \@Fupddelim\FBight\FBigchar + \@Fupddelim\Fbigght\Fbiggchar + \@Fupddelim\FBigght\FBiggchar +} +\def\Fupdlines{\lineht=.7\normalbaselineskip \linedp=.3\normalbaselineskip} + +% \Fmch and \Fch are for changing font sizes. Note that these only change font +% sizes and the \normalbaselineskip. To make the change look good, other +% document changes are probably necessary (e.g., the display skips). +\def\@Fmch{\Fupdfams \Fupdfonts \Fupddelims \Fupdlines \normalbaselines\rm} +\def\Fmch#1/#2/#3/#4/{% + \Fsize=#1\relax \Ftsize=#2\relax \Fssize=#3\relax \Fsssize=#4\relax + \afterassignment\@Fmch \normalbaselineskip=% +} +\def\Fch#1/{% + \Fsize=#1\relax + \afterassignment\@Fmch \normalbaselineskip=% +} + + + +% Font initialization + +\def\tenpt{% + % Looser baselines and tighter display skips + \Fmch10pt/10pt/7pt/5pt/12.5pt + \abovedisplayskip=8pt plus3pt minus5pt + \belowdisplayskip=8pt plus3pt minus5pt + \abovedisplayshortskip=0pt plus3pt + \belowdisplayshortskip=5pt plus3pt minus2pt +} +\def\ninept{% + \Fmch9pt/9pt/6pt/5pt/11pt + \abovedisplayskip=7pt plus3pt minus5pt + \belowdisplayskip=7pt plus3pt minus5pt + \abovedisplayshortskip=0pt plus3pt + \belowdisplayshortskip=4pt plus3pt minus1pt +} + +% Palatino +\def\FSpalr{palr=\\10:zpl-Regular-tlf-t1;;} +\def\FSpali{pali=\\10:zpl-Italic-tlf-t1;;} +\def\FSpalb{palb=\\10:zpl-Bold-tlf-t1;;} +\def\FSpalbi{palbi=\\10:zpl-BoldItalic-tlf-t1;;} + +% Palatino small caps +\def\FSpalrsc{palrsc=\\10:zpl-Regular-tlf-scl-t1;;} +\def\FSpalisc{palisc=\\10:zpl-Italic-tlf-scl-t1;;} +\def\FSpalbsc{palbsc=\\10:zpl-Bold-tlf-scl-t1;;} +\def\FSpalbisc{palbisc=\\10:zpl-BoldItalic-tlf-scl-t1;;} + +% Palatino math +\def\FSmpalmi {mpali=\Fskew127\\10:zplmi;;} +\def\FSmpalmia{mpalia=\Fskew127\\10:zplmia;;} +\def\FSmpalsy {mpalsy=\Fskew120\\10:zplsy;;} +\def\FSmpalsym{mpalsym=\\10:zplsym;;} +\def\FSmpalsyc{mpalsyc=\\10:zplsyc;;} +\def\FSmpalexx{mpalexx=\\10:zplexx;;} +\def\FSmpalexa{mpalexa=\\10:zplexa;;} + +% Palatino bold math +\def\FSmpalbmi {mpalbi=\Fskew127\\10:zplbmi;;} +\def\FSmpalbmia{mpalbia=\Fskew127\\10:zplbmia;;} +\def\FSmpalbsy {mpalbsy=\Fskew120\\10:zplbsy;;} +\def\FSmpalbsym{mpalbsym=\\10:zplbsym;;} +\def\FSmpalbsyc{mpalbsyc=\\10:zplbsyc;;} +\def\FSmpalbexx{mpalbexx=\\10:zplbexx;;} +\def\FSmpalbexa{mpalbexa=\\10:zplbexa;;} + +% Optima +\def\FSoptr{optr=\\10:URWClassico-Regular-lf-t1;;} +\def\FSopti{opti=\\10:URWClassico-Italic-lf-t1;;} +\def\FSoptb{optb=\\10:URWClassico-Bold-lf-t1;;} +\def\FSoptbi{optbi=\\10:URWClassico-BoldItalic-lf-t1;;} + +% Inconsolata (not narrow and without variant 0, l, or quotes) +\def\FSincr{incr=\\10:t1-zi4r-0;;} +\def\FSincb{incb=\\10:t1-zi4b-0;;} + +% Euler +\def\FSeurm{eurm=\Fskew'177\\10:eurm10;\\9:eurm9;\\8:eurm8;\\7:eurm7;\\6:eurm6;\\5:eurm5;;} +\def\FSeurb{eurb=\Fskew'177\\10:eurb10;\\9:eurb9;\\8:eurb8;\\7:eurb7;\\6:eurb6;\\5:eurb5;;} +\def\FSeusm{eusm=\Fskew'60\\10:eusm10;\\9:eusm9;\\8:eusm8;\\7:eusm7;\\6:eusm6;\\5:eusm5;;} +\def\FSeusb{eusb=\Fskew'60\\10:eusb10;\\9:eusb9;\\8:eusb8;\\7:eusb7;\\6:eusb6;\\5:eusb5;;} +\def\FSeufm{eufm=\\10:eufm10;\\9:eufm9;\\8:eufm8;\\7:eufm7;\\6:eufm6;\\5:eufm5;;} +\def\FSeufb{eufb=\\10:eufb10;\\9:eufb9;\\8:eufb8;\\7:eufb7;\\6:eufb6;\\5:eufb5;;} +\def\FSeuex{euex=\\10:euex10;\\9:euex9;\\8:euex8;\\7:euex7;;} + +% Boondox double struck +\def\FSboondsr{boondsr=\\10:BOONDOX-r-ds;;} +\def\FSboondsb{boondsb=\\10:BOONDOX-b-ds;;} + +\def\Ffamseta{\FSpalr\FSpalr\FSpalr} % palatino rm +\def\Ffamsetb{\FSeurm\FSeurm\FSeurm} % euler rm +\def\Ffamsetc{\FSmpalsy\FSmpalsy\FSmpalsy} % newpx symbols +\def\Ffamsetd{\FSmpalexx\FSmpalexx\FSmpalexx} % newpx ext +\def\Ffamsete{\FSeuex\FSeuex\FSeuex} % euler ext +\def\Ffamsetf{\FSeurb\FSeurb\FSeurb} % euler rb +\def\Ffamsetg{\FSeusm\FSeusm\FSeusm} % euler sm +\def\Ffamseth{\FSeusb\FSeusb\FSeusb} % euler sb +\def\Ffamseti{\FSeufm\FSeufm\FSeufm} % euler fm +\def\Ffamsetj{\FSeufb\FSeufb\FSeufb} % euler fb +\def\FfamsetA{\FSboondsr\FSboondsr\FSboondsr} % boon ds +\def\FfamsetB{\FSpali\FSnull\FSnull} % palatino it +\def\FfamsetC{\FSpalb\FSnull\FSnull} % palatino rm b +\def\FfamsetD{\FSpalbi\FSnull\FSnull} % palatino it b +% \def\FfamsetE{} +% \def\FfamsetF{} + +\mathchardef\Fbigchar="0300 +\mathchardef\FBigchar="0310 +\mathchardef\Fbiggchar="0312 +\mathchardef\FBiggchar="0320 + +\def\Fupduser{% + \Ffind\FSpalr \let\rmfont=\Ffont + \Ffind\FSeufm \let\fmfont=\Ffont + \Ffind\FSpali \let\itfont=\Ffont + \Ffind\FSpalb \let\bffont=\Ffont + \Ffind\FSpalbi \let\bifont=\Ffont + \Ffind\FSincr \let\ttfont=\Ffont + \Ffind\FSincb \let\tbfont=\Ffont + \Ffind\FSpalrsc \let\scfont=\Ffont +} +\def\rm{\fam=0 \rmfont} +\def\mi{\fam=1 } +\def\sy{\fam=2 } +\def\bm{\fam=5 } +\def\sr{\fam=6 } +\def\sb{\fam=7 } +\def\fr{\fam=8 } \def\oldstyle{\fam=8 \fmfont} +\def\fb{\fam=9 } +\def\bb{\fam=10 } +\def\it{\fam=11 \itfont} +\def\bf{\fam=12 \bffont} +\def\bi{\fam=13 \bifont} +\def\tt{\ttfont} +\def\tb{\tbfont} +\def\sc{\scfont} + + + +% Encoding stuff necessary for euler (see gkpmac.tex) +% Actually, we take most non-letter symbols from newpx instead. This keeps +% things consistent (since euler is somewhat incomplete) and easy (since +% we needn't change the conventions from plain). + +% Take numerals from euler rm (default is fam 0) +\mathcode`\0="7130 +\mathcode`\1="7131 +\mathcode`\2="7132 +\mathcode`\3="7133 +\mathcode`\4="7134 +\mathcode`\5="7135 +\mathcode`\6="7136 +\mathcode`\7="7137 +\mathcode`\8="7138 +\mathcode`\9="7139 + +% Take certain symbols from euler sm/fm (default is cmsy) +% \mathcode`\!="0821 +% \mathcode`\(="4828 \delcode`(="828300 +% \mathcode`\)="5829 \delcode`)="829301 +% \mathcode`\+="282B +% \mathcode`\-="282D +% \mathcode`\:="383A +% \mathcode`\;="683B +% \mathcode`\=="383D +% \mathcode`\?="583F +% \mathcode`\[="485B \delcode`[="85B302 +% \mathcode`\]="585D \delcode`]="85D303 +% \mathcode`\{="4666 +% \mathcode`\}="5667 + +% Euler doesn't have these +\let\varsigma=\sigma +\let\varrho=\rho + +% Take uppercase Greek from euler rm (default is fam 0) +\mathchardef\Alpha="0141 +\mathchardef\Beta="0142 +\mathchardef\Gamma="0100 +\mathchardef\Delta="0101 +\mathchardef\Epsilon="0145 +\mathchardef\Zeta="015A +\mathchardef\Eta="0148 +\mathchardef\Theta="0102 +\mathchardef\Iota="0149 +\mathchardef\Kappa="014B +\mathchardef\Lambda="0103 +\mathchardef\Mu="014D +\mathchardef\Nu="014E +\mathchardef\Xi="0104 +\mathchardef\Omicron="014F +\mathchardef\Pi="0105 +\mathchardef\Rho="0150 +\mathchardef\Sigma="0106 +\mathchardef\Tau="0154 +\mathchardef\Upsilon="0107 +\mathchardef\Phi="0108 +\mathchardef\Chi="0158 +\mathchardef\Psi="0109 +\mathchardef\Omega="010A + +% TODO: arrows? +\mathchardef\intop="1452 +\mathchardef\ointop="1448 +% \mathchardef\coprod="1460 +% \mathchardef\prod="1451 +\mathchardef\sum="1450 +% \mathchardef\braceld="047A \mathchardef\bracerd="047B +% \mathchardef\bracelu="047C \mathchardef\braceru="047D +% \mathchardef\infty="0431 +% \def\rbrace{\delimiter"5667409 } +% \def\lbrace{\delimiter"4666408 } +% \def\vert{\delimiter"066A30C } +% \def\backslash{\delimiter"066E30F } + +\tenpt\rm + +\endinput