r3tex

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

text.tex (6323B)


      1 % INITEX sets \sfcode x=1000 for all x, except that \sfcode`X=999
      2 % for uppercase letters. The following changes are needed:
      3 \sfcode`\)=0  \sfcode`\'=0  \sfcode`\]=0
      4 
      5 % Punctuation spacing control
      6 \def\frenchspacing{%
      7 	\sfcode`\.=1000  \sfcode`\?=1000  \sfcode`\!=1000
      8 	\sfcode`\:=1000  \sfcode`\;=1000  \sfcode`\,=1000
      9 }
     10 \def\nonfrenchspacing{%
     11 	\sfcode`\.=3000  \sfcode`\?=3000  \sfcode`\!=3000
     12 	\sfcode`\:=2000  \sfcode`\;=1500  \sfcode`\,=1250
     13 }
     14 
     15 % Interlineskip control
     16 \def\nointerlineskip{\prevdepth=-1000pt }
     17 \def\normalbaselines{%
     18 	\baselineskip=\normalbaselineskip
     19 	\lineskip=\normallineskip
     20 	\lineskiplimit=\normallineskiplimit
     21 }
     22 \def\@constlineskip{% TODO helper isn't needed here
     23 	\baselineskip=-1000pt
     24 	\lineskip=\skipA
     25 	\lineskiplimit=\maxdimen
     26 }
     27 \def\constlineskip{\afterassignment\@constlineskip \skipA=}
     28 \def\offinterlineskip{\constlineskip0pt\relax}
     29 
     30 % We often need to do something after the next \par. Redefining \par to trigger
     31 % an event handles these situations in a general way.
     32 \defevent[par]
     33 \def\par{\event[par]\endgraf}
     34 
     35 % \parskip control: use \tmpparskip to change the \parskip until the next \par;
     36 % use \tmpparskipw to change the \parskip until after the next paragraph (in
     37 % horizontal mode).
     38 \def\@restoreparskip{\global\parskip=\normalparskip \glet\@tmpparskip\relax}
     39 \def\@restoreparskipweak{\ifhmode \@restoreparskip \fi}
     40 \def\tmpparskip{\glet\@tmpparskip\@restoreparskip \global\parskip=}
     41 \def\tmpparskipw{\glet\@tmpparskip\@restoreparskipweak \global\parskip=}
     42 \let\@tmpparskip=\relax
     43 \addhook[par]\@tmpparskip
     44 
     45 % \parindent control: use \tmpparindent to change the \parindent until the next
     46 % \par; use \tmpparindentw to change the \parindent until after the next
     47 % paragraph (in horizontal mode).
     48 \def\@restoreparindent{\global\parindent=\normalparindent \glet\@tmpparindent\relax}
     49 \def\@restoreparindentweak{\ifhmode \@restoreparindent \fi}
     50 \def\tmpparindent{\glet\@tmpparindent\@restoreparindent \global\parindent=}
     51 \def\tmpparindentw{\glet\@tmpparindent\@restoreparindentweak \global\parindent=}
     52 \let\@tmpparindent=\relax
     53 \addhook[par]\@tmpparindent
     54 
     55 % Unbreakable glue
     56 \def\topglue{\nointerlineskip \vglue-\topskip \vglue}
     57 \def\@vglue{%
     58 	\par \dimenA=\prevdepth \hrule height0pt
     59 	\nobreak\vskip\skipA \prevdepth=\dimenA
     60 }
     61 \def\vglue{\afterassignment\@vglue \skipA=}
     62 \def\@hglue{%
     63 	\leavevmode \countA=\spacefactor \vrule width0pt
     64 	\nobreak\hskip\skipA \spacefactor=\countA
     65 }
     66 \def\hglue{\afterassignment\@hglue \skipA=}
     67 
     68 % Vertical skips
     69 \def\smallskip{\vskip\smallskipamount}
     70 \def\medskip{\vskip\medskipamount}
     71 \def\bigskip{\vskip\bigskipamount}
     72 
     73 % Horizontal spaces
     74 % TODO: should these force hmode?
     75 \def\negthinspace{\kern-.16667em }
     76 \def\thinspace{\kern.16667em }
     77 \def\enspace{\kern.5em }
     78 
     79 % Horizontal skips
     80 \def\enskip{\hskip.5em\relax}
     81 \def\quad{\hskip1em\relax}
     82 \def\qquad{\hskip2em\relax}
     83 \newskip\hideskip \hideskip=-1000pt plus1fill
     84 \def\hidewidth{\hskip\hideskip}
     85 
     86 % Break control
     87 \def~{\nobreak\ }
     88 \def\break{\penalty-10000 }
     89 \def\nobreak{\penalty10000 }
     90 \def\allowbreak{\penalty0 }
     91 \def\eject{\par\break}
     92 
     93 % Horizontal overlaps
     94 \newif\if@l \newif\if@r
     95 \def\llap{\@ltrue\@rfalse\@lap}
     96 \def\rlap{\@lfalse\@rtrue\@lap}
     97 \def\hlap{\@ltrue\@rtrue\@lap}
     98 \def\@lap{\modechoice{\@textlap}{\@textlap}{\mathpalette\@mathlap}}
     99 \def\@textlap#1{\hbox to0pt{\if@l\hss\fi{#1}\if@r\hss\fi}}
    100 \def\@mathlap#1#2{\hbox to0pt{\if@l\hss\fi$\nosurround\sty#1{#2}$\if@r\hss\fi}}
    101 
    102 % Vertical overlaps
    103 \def\ulap#1{\vbox to0pt{\boxmaxdepth=0pt \vss#1}}
    104 \def\dlap#1{\vbox to0pt{\boxmaxdepth=0pt #1\vss}}
    105 \def\vlap#1{\vbox to0pt{\boxmaxdepth=0pt \vss#1\vss}}
    106 \def\smash{\modechoice{\@textsmash}{\@textsmash}{\mathpalette\@mathsmash}}
    107 \def\@textsmash#1{\setbox0=\hbox{#1}\@finsmash}
    108 \def\@mathsmash#1#2{\setbox0=\hbox{$\nosurround\sty#1{#2}$}\@finsmash}
    109 \def\@finsmash{\ht0=0pt \dp0=0pt \box0 }
    110 
    111 % Phantom boxes
    112 \newif\if@v \newif\if@h
    113 \def\vphantom{\@vtrue\@hfalse\@phant}
    114 \def\hphantom{\@vfalse\@htrue\@phant}
    115 \def\phantom{\@vtrue\@htrue\@phant}
    116 \def\@phant{\modechoice{\@textphant}{\@textphant}{\mathpalette\@mathphant}}
    117 \def\@textphant#1{\setbox0=\hbox{#1}\@finphant}
    118 \def\@mathphant#1#2{\setbox0=\hbox{$\nosurround\sty#1{#2}$}\@finphant}
    119 \def\@finphant{%
    120 	\setbox2=\null
    121 	\if@v \ht2=\ht0 \dp2=\dp0 \fi
    122 	\if@h \wd2=\wd0 \fi
    123 	\box2
    124 }
    125 
    126 \def\underscore{\leavevmode \kern.06em \vbox{\hrule width.3em}}
    127 
    128 \def\line{\hbox to\hsize}
    129 \def\leftline#1{\line{#1\hss}}
    130 \def\rightline#1{\line{\hss#1}}
    131 \def\centerline#1{\line{\hss#1\hss}}
    132 
    133 \def\strut{\vrule height\lineht depth\linedp width0pt }
    134 
    135 \def\ialign{\everycr={}\tabskip=0pt\halign}
    136 \def\ooalign#1{%
    137 	\leavevmode
    138 	\vtop{%
    139 		\baselineskip=0pt \lineskiplimit=-\maxdimen
    140 		\ialign{##\cr #1\crcr}%
    141 	}%
    142 }
    143 
    144 \newcount\mscount
    145 \def\multispan#1{\omit \mscount=#1\relax \loop\ifnum\mscount>1 \@cspan \repeat}
    146 \def\@cspan{\cspan\omit \decr\mscount}
    147 
    148 \mathchardef\braceld="37A \mathchardef\bracerd="37B
    149 \mathchardef\bracelu="37C \mathchardef\braceru="37D
    150 \def\downbracefill{%
    151 	$\nosurround
    152 	\setbox0=\hbox{$\braceld$}%
    153 	\braceld \leaders\vrule height\ht0 depth0pt \hfill \braceru
    154 	\bracelu \leaders\vrule height\ht0 depth0pt \hfill \bracerd
    155 	$%
    156 }
    157 \def\upbracefill{%
    158 	$\nosurround
    159 	\setbox0=\hbox{$\braceld$}%
    160 	\bracelu \leaders\vrule height\ht0 depth0pt \hfill \bracerd
    161 	\braceld \leaders\vrule height\ht0 depth0pt \hfill \braceru
    162 	$%
    163 }
    164 \def\dots{\relax\ifmmode\ldots\else$\nosurround\ldots\,$\fi}
    165 
    166 \endinput
    167 
    168 
    169 % TODO: sort through all this; after this, all that remains is line 729 and
    170 %  onwards in plain.tex
    171 
    172 % \def\removelastskip{\ifdim\lastskip=\z@\else\vskip-\lastskip\fi}
    173 % \def\smallbreak{\par\ifdim\lastskip<\smallskipamount
    174   % \removelastskip\penalty-50\smallskip\fi}
    175 % \def\medbreak{\par\ifdim\lastskip<\medskipamount
    176   % \removelastskip\penalty-100\medskip\fi}
    177 % \def\bigbreak{\par\ifdim\lastskip<\bigskipamount
    178   % \removelastskip\penalty-200\bigskip\fi}
    179 
    180 % \def\TeX{T\kern-.1667em\lower.5ex\hbox{E}\kern-.125emX}
    181 
    182 % \def\hrulefill{\leaders\hrule\hfill}
    183 % \def\dotfill{\cleaders\hbox{$\m@th \mkern1.5mu.\mkern1.5mu$}\hfill}
    184 % \def\rightarrowfill{$\m@th\smash-\mkern-7mu%
    185   % \cleaders\hbox{$\mkern-2mu\smash-\mkern-2mu$}\hfill
    186   % \mkern-7mu\mathord\rightarrow$}
    187 % \def\leftarrowfill{$\m@th\mathord\leftarrow\mkern-7mu%
    188   % \cleaders\hbox{$\mkern-2mu\smash-\mkern-2mu$}\hfill
    189   % \mkern-7mu\smash-$}
    190 
    191 % \outer\def\bye{\par\vfill\supereject\end}