r3tex

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

r3asn.tex (5545B)


      1 \csname input:r3asn.tex\endcsname
      2 \expandafter\let\csname input:r3asn.tex\endcsname=\endinput
      3 
      4 % Extra fonts
      5 \let\FSbody=\FSpnrutl
      6 
      7 
      8 % Pararmeters
      9 \paper[letter]
     10 \hoffset=1.5in \voffset=1.5in % 1.5in margins
     11 \hsize=5.5in \vsize=7.9in
     12 \normalparindent=10pt \parindent=\normalparindent
     13 \normalparskip=0pt plus1pt \parskip=\normalparskip
     14 
     15 
     16 % Math spacing
     17 \newmuskip\tthinmuskip  \tthinmuskip=3mu
     18 \newmuskip\dthinmuskip  \dthinmuskip=3mu
     19 \newmuskip\tmedmuskip   \tmedmuskip=4mu plus 2mu minus 4mu
     20 \newmuskip\dmedmuskip   \dmedmuskip=4mu plus 2mu minus 2mu
     21 \newmuskip\tthickmuskip \tthickmuskip=6mu plus 4mu
     22 \newmuskip\dthickmuskip \dthickmuskip=10mu minus 3mu
     23 \def\textmath{%
     24 	\thinmuskip=\tthinmuskip
     25 	\medmuskip=\tmedmuskip
     26 	\thickmuskip=\tthickmuskip
     27 }
     28 \def\displaymath{%
     29 	\thinmuskip=\dthinmuskip
     30 	\medmuskip=\dmedmuskip
     31 	\thickmuskip=\dthickmuskip
     32 }
     33 % TODO: use event?
     34 \everymath={\textmath}
     35 \everydisplay={\displaymath}
     36 
     37 
     38 % Title
     39 \newtoks\title
     40 \newtoks\author
     41 \newtoks\date
     42 \Fdef\titlefont\FSpntit16pt
     43 \Fdef\subtitlefont\FSbody10pt
     44 \def\maketitle{%
     45 	\topglue 0.05in
     46 	\centerline{\titlefont \the\title}%
     47 	\edef\csA{\the\author}%
     48 	\edef\csB{\the\date}%
     49 	\unless\ifx\csA\empty
     50 		\nobreak\medskip
     51 		\centerline{\subtitlefont \csA}%
     52 		\ifx\csB\empty\else
     53 			\nobreak\smallskip
     54 			\centerline{\subtitlefont \csB}%
     55 		\fi
     56 	\else\ifx\csB\empty\else
     57 		\nobreak\medskip
     58 		\centerline{\subtitlefont\csB}%
     59 	\fi\fi
     60 	\nobreak\vskip 0.5in plus0.15in
     61 }
     62 
     63 
     64 % Output
     65 \countdef\pageno=0 \pageno=1
     66 
     67 \newtoks\footline
     68 \Fdef\footfont\FSbody10pt
     69 \footline={\hss\footfont\number\pageno\hss}
     70 \def\nopagenumbers{\footline={\hfil}}
     71 
     72 \output={\asnoutput}
     73 \def\asnoutput{%
     74 	\shipout\vbox{\pagebody\makefootline}%
     75 	\gincr\pageno
     76 }
     77 \def\pagebody{\vbox to\vsize{\boxmaxdepth\maxdepth \unvbox255}}
     78 \def\makefootline{\baselineskip=24pt \lineskiplimit=0pt \line{\the\footline}}
     79 
     80 
     81 % Sectioning
     82 % TODO consider moving to text.tex
     83 \newcount\@mpenalty \newif\if@mpenalty
     84 \def\mpenalty{\global\@mpenaltytrue \@mpenalty=}
     85 \def\@mvskip{%
     86 	\par
     87 	\ifdim\lastskip<\skipA
     88 		\removelastskip
     89 		\if@mpenalty \penalty\@mpenalty \fi
     90 		\vskip\skipA
     91 	\fi
     92 	\global\@mpenaltyfalse
     93 }
     94 \def\mvskip{\afterassignment\@mvskip \skipA=}
     95 \def\msmallskip{\mvskip\smallskipamount}
     96 \def\mmedskip{\mvskip\medskipamount}
     97 \def\mbigskip{\mvskip\bigskipamount}
     98 \def\removelastskip{\ifdim\lastskip=0pt \else \vskip-\lastskip \fi}
     99 
    100 \def\topic #1. {\msmallskip\noindent{\it#1.}\enspace}
    101 
    102 \def\begolbf{\begxlist{\bf\number\Lcnt.\enspace}} % 1. 2. 3. ...
    103 \def\endolbf{\Lend}
    104 
    105 
    106 % p@last is last problem-related macro used.
    107 %   0 => other
    108 %   1 => header
    109 %   2 => statement
    110 \newcount\p@last \p@last=0
    111 \newbox\pstmt@box
    112 \Fdef\probfont\FSpnimp12pt
    113 \def\prob{\@phdr\probfont}
    114 \Fdef\partfont\FSpnimp10pt
    115 \def\part{\@phdr\partfont}
    116 \def\@phdr#1.{%
    117 	\ifnum\p@last=2 \@endpstmt \else \par \fi
    118 	\ifnum\p@last=0
    119 		\vskip 0pt plus.3\vsize \penalty0 \vskip 0pt plus-.3\vsize
    120 		\nobreak\vskip16pt plus6pt minus6pt
    121 	\fi
    122 	\ifnum\p@last=1 \nobreak\medskip \fi
    123 	\hbox{#1}\nobreak%
    124 	\p@last=1
    125 }
    126 \def\pstmt{%
    127 	\par
    128 	\p@last=2
    129 	\nobreak\medskip
    130 	\setbox\pstmt@box=\vbox\bgroup
    131 		\advance \hsize by -2\normalparindent
    132 		\def\nostrut{\let\strut=\relax}%
    133 		\noindent\strut
    134 }
    135 \def\@endpstmt{%
    136 	\ifhmode\unskip\fi\strut\egroup% End the vbox started in \pstmt.
    137 	\dimen0=\ht\pstmt@box \advance \dimen0 by 2pt
    138 	\dimen1=\dp\pstmt@box \advance \dimen1 by 2pt
    139 	\nointerlineskip\hbox to \hsize{%
    140 		\hfil
    141 		\vrule height\dimen0 depth\dimen1 width0.5pt
    142 		\hskip5pt
    143 		\box\pstmt@box
    144 		\hskip5pt
    145 		\hskip 0.5pt plus1fil
    146 	}%
    147 	\nointerlineskip
    148 	\penalty25\medskip
    149 }
    150 \def\psoln{%
    151 	\ifcase\p@last
    152 		\errmessage{psoln must be preceded by prob/part/pstmt}%
    153 	\or
    154 		\nobreak\medskip
    155 	\or
    156 		\@endpstmt
    157 	\fi
    158 	\p@last=0
    159 	\tmpparindentw0pt
    160 	\tmpparskipw0pt
    161 }
    162 
    163 \newif\ifpmark
    164 \def\begp#1 [#2] (#3). {%
    165 	\par
    166 	\global\pmarkfalse
    167 	\mpenalty-100
    168 	\mmedskip
    169 	\noindent{\bf#1%
    170 		\def\\{#2}\ifx\\\empty\else\ {\rm[\\]}\fi
    171 		\def\\{#3}\ifx\\\empty\else\ {\rm({\it\\\/})}\fi
    172 		.}\enspace
    173 }
    174 \def\pmark{\global\pmarktrue} % TODO
    175 \def\endp{\ifpmark\else \pmark \fi \mpenalty55 \mmedskip}
    176 
    177 \newif\ifqed
    178 \def\qed{\slug \global\qedtrue}
    179 \newtoks\prooftext \prooftext={Proof}
    180 \def\begproof{%
    181 	\par \global\qedfalse
    182 	\mmedskip
    183 	\noindent{\it\the\prooftext.}\enspace
    184 	\prooftext={Proof}%
    185 }
    186 \def\endproof{\ifqed\else \qed \fi \mmedskip}
    187 
    188 
    189 % Lists
    190 \Lindent=0pt
    191 \Lmaxprotrusion=20pt
    192 \Llmargin=20pt
    193 \Ltopskip=\smallskipamount \Ltoppenalty=50
    194 \Lmidskip=\smallskipamount \Lmidpenalty=0
    195 \Lbotskip=\smallskipamount \Lbotpenalty=50
    196 
    197 
    198 % Misc
    199 \def\slugbox{\hbox{\kern1.5pt\vrule width2.5pt height6pt depth1.5pt\kern1.5pt}}
    200 \def\slug{\unskip\nobreak\quad\slugbox}
    201 \def\pdfimg#1file #2.pdf{\pdfximage#1{#2.pdf}\pdfrefximage\pdflastximage}
    202 \def\eqref(#1){({\oldstyle#1})}
    203 \def\C{{\f[d]C}}
    204 \def\Q{{\f[d]Q}}
    205 \def\R{{\f[d]R}}
    206 \def\Z{{\f[d]Z}}
    207 \def\N{{\f[d]N}}
    208 \def\utext#1{{\Fmch7pt/7pt/5pt/5pt/8.5pt
    209 	\vbox{\ialign{\hfil##\hfil\cr\noalign{\kern-2pt}#1\crcr}}}}
    210 \def\set#1{\hbox{$\m@th\{\,#1\,\}$}}
    211 \def\@cycend\,\@cyciter{}
    212 \def\@cyciter#1,{#1\,\@cyciter}
    213 \def\cyc(#1){(\@cyciter#1\@cycend,)}
    214 \def\tbin#1{\nonscript\mskip\tmedmuskip{#1}\nonscript\mskip\tmedmuskip}
    215 \def\trel#1{\nonscript\mskip\tthickmuskip{#1}\nonscript\mskip\tthickmuskip}
    216 \def\dbin#1{\nonscript\mskip\dmedmuskip{#1}\nonscript\mskip\dmedmuskip}
    217 \def\drel#1{\nonscript\mskip\dthickmuskip{#1}\nonscript\mskip\dthickmuskip}
    218 \def\upto{\mathinner{\ldotp\ldotp}}
    219 \def\compl{{\sm c}}
    220 
    221 % \left and \right but the resulting atoms are open/close, not inner.
    222 \def\ml{\mathopen{}\mathclose\bgroup\left}
    223 \def\mr{\aftergroup\egroup\right}
    224 
    225 \endinput