1% Id: singcard.tex,v 1.1 2003/08/08 14:27:06 pertusus Exp $ 2 3% 4% singcard.tex - common macros for Singular reference cards. 5% 6% Some of the macros/settings ripped from gdb reference card. 7% 8 9% 10% - declare configurable parameters. 11% 12\newdimen\totalwidth 13\newdimen\totalheight 14\newdimen\hmargin 15\newdimen\vmargin 16 17\newdimen\barwidth 18\newdimen\barheight 19 20%%% START CONFIGURABLE SECTION 21 22% 23% - configure your papersize. 24% 25 26% US letter paper (8.5x11in) 27%\totalwidth=11in % total width of paper 28%\totalheight=8.5in % total height of paper 29%\hmargin=.25in % horizontal margin width 30%\vmargin=.25in % vertical margin width 31 32% A4 paper 33\totalwidth=29.7cm 34\totalheight=21cm 35\hmargin=6mm 36\vmargin=6mm 37 38% 39% - configure your folding guides. 40% 41\barwidth=.1pt % width of the folding guide 42\barheight=2pt % height of the folding guide 43 44% For NO printed folding guide, 45% comment out other \def\vdecor's and uncomment: 46%\def\vdecor{\hskip\hmargin plus1fil\hskip\barwidth plus1fil\hskip\hmargin plus1fil} 47 48% For SOLID LINE folding guide, 49% comment out other \def\vdecor's and uncomment: 50%\def\vdecor{\hskip\hmargin plus1fil \vrule width \barwidth \hskip\hmargin plus1fil} 51 52% For SMALL MARKS NEAR TOP AND BOTTOM as folding guide, 53% comment out other \def\vdecor's and uncomment: 54\def\vdecor{\hskip\hmargin plus1fil 55\vbox to \vsize{\hbox to \barwidth{\vrule height\barheight width\barwidth}\vfill 56\hbox to \barwidth{\vrule height\barheight width\barwidth}}%THIS PERCENT SIGN IS ESSENTIAL 57\hskip\hmargin plus1fil} 58 59%%% END CONFIGURABLE SECTION 60 61% 62% - compute parameters of three column format. 63% 64\newdimen\fullhsize % width of area without margins 65\newdimen\itemwidth % width of item column 66\newdimen\definitionwidth % width of definition column 67\newdimen\temp % only for temporary use 68 69% adjust the offsets so the margins are measured *from paper edge* 70\hoffset=-1in \advance \hoffset by \hmargin 71\voffset=-1in \advance \voffset by \vmargin 72 73% fullhsize = totalwidth - (2 * hmargin) 74\fullhsize=\totalwidth 75\temp=\hmargin \multiply \temp by 2 \advance \fullhsize by -\temp 76 77% hsize = (fullhsize - (4 * hmargin) - (2 * barwidth)) / 3 78\hsize=\fullhsize 79\temp=\hmargin \multiply \temp by 4 \advance \hsize by -\temp 80\temp=\barwidth \multiply \temp by 2 \advance \hsize by -\temp 81\divide \hsize by 3 82 83% vsize = totalheight - (2 * vmargin) 84\vsize=\totalheight 85\temp=\vmargin \multiply \temp by 2 \advance \vsize by -\temp 86 87% default itemwidth = hsize * 1/4 88% default definitionwidth = hsize * 3/4 89\temp=\hsize \divide \temp by 4 90\itemwidth=\temp 91\definitionwidth=\hsize \advance \definitionwidth by -\itemwidth 92 93% 94% - miscellaneous parameters. 95% 96\tolerance=2000 97\hyphenpenalty=500 98 99\parindent=0pt 100\parskip=0pt 101\baselineskip=9pt 102 103\footline={\vbox to0pt{\hss}} 104 105% 106% - font definitions. 107% 108\font\rm=cmr7 109\font\bf=cmbx7 110\font\it=cmti7 111\font\bit=cmbxti10 at 7pt 112\font\tt=cmtt8 % cmtt7 seems too small 113\font\sc=cmcsc10 at 7pt 114 115% huge fonts 116\font\hbf=cmbx12 117 118% large fonts 119\font\lbf=cmbx10 120 121% small fonts 122\font\srm=cmr6 123\font\ssc=cmcsc10 at 6pt 124 125% tiny fonts 126\font\tit=cmti7 at 5pt 127 128% math fonts 129\font\mathrm=cmr7 130\font\smathrm=cmr5 131\font\mathit=cmmi7 132\font\smathit=cmmi5 133\font\mathsy=cmsy7 134\font\smathsy=cmsy5 135\font\mathex=cmex7 136 137\textfont0=\mathrm \scriptfont0=\smathrm 138\textfont1=\mathit \scriptfont1=\smathit 139\textfont2=\mathsy \scriptfont2=\smathsy 140\textfont3=\mathex \scriptfont3=\mathex 141 142% 143% - macros for tree column format. 144% 145\def\fulline{\hbox to \fullhsize} 146\def\columnbox{\leftline{\pagebody}} 147\def\tripleformat{\shipout 148 \vbox{\fulline{\box\leftcolumn\vdecor 149 \box\centercolumn\vdecor 150 \columnbox}}% 151 \advancepageno} 152\def\bye{\par\vfill 153 \supereject 154 \if R\currentcolumn\null\vfill\eject\fi 155 \end} 156 157% 158% - miscellaneous macros. 159% 160% \Singular: for sake of corporate identity 161% \ctl: print control keys 162% \opt: print optional arguments 163% \alt: separate alternative arguments 164% \rep: denote repitition of arguments 165% \rmslash: print a slash in roman type face 166% \eg, \ie: obvious 167% \verysmallskip: skip a very small amount (used between \sec entries). 168% Extra skip does not harm in the applications of \verysmallskip, 169% so we choose a large stretch for it. 170% \strut: redefinition of TeX's \strut macro 171% 172\def\Singular{{\sc Singular}} 173\def\ctl#1{{\tt C-#1}} 174\def\opt#1{{\rm[{\tt #1}]}} 175\def\alt{\hbox{\hskip 1pt$\mid$\hskip 1pt}} 176\def\rep{$\ldots$} 177\def\rmslash{{\rm /}} 178\def\eg{e.g.~} 179\def\ie{i.e.~} 180 181\newskip\verysmallskipamount 182\verysmallskipamount=1pt plus 0.333333pt minus 0.333333pt 183\def\verysmallskip{\vskip \verysmallskipamount} 184 185\newbox\sevenptstrutbox 186\setbox\sevenptstrutbox=\hbox{\vrule height6pt depth3pt width0pt} 187\def\strut{\relax\ifmmode\copy\sevenptstrutbox\else\unhcopy\sevenptstrutbox\fi} 188 189% 190% \sec - insert a new section into the card. 191% 192% First argument is section title, second argument the item column 193% width (defaults to 1/4*hsize), third the section itself. 194% 195% \setitemwidth: auxiliary macro 196% 197\def\setitemwidth#1{\itemwidth=#1 198 \definitionwidth=\hsize 199 \advance\definitionwidth by -\itemwidth} 200\long\def\sec#1(#2)#3\endsec{{% 201 \def\\{#2}\ifx\empty\\ \else\setitemwidth{#2}\fi 202 \halign{% column 1 203 \vtop{\hsize=\itemwidth\strut\tt##\strut}& 204 % column 2 205 \vtop{\hsize=\definitionwidth\strut\rm##\strut}\cr 206 % tail of \long\def fills in halign body with argument 207 \noalign{\bigskip\lbf #1\verysmallskip}% 208 #3}}} 209 210% 211% - macros to use inside a \sec. 212% 213% \subsec: insert a sub heading into a \sec 214% \sectext: insert non-aligned text into a \sec 215% \longentry: insert an entry with a long item field into a \sec 216% \longitem: insert an entry with a long item field and no 217% definition field into a \sec 218% \entryskip: insert glue between two entries 219% 220\def\subsec#1{\noalign{\smallskip\bf #1}} 221\long\def\sectext#1\cr{\noalign{\strut\hyphenpenalty=50 #1\strut}} 222% the `\ ' forces a non empty item field 223\long\def\longentry#1\cr{\noalign{\strut\tt #1\strut}\ \cr} 224\long\def\longitem#1\cr{\noalign{\strut\tt #1\strut}} 225 226\newskip\entryskipamount 227\entryskipamount=\smallskipamount 228\def\entryskip{\noalign{\vskip \entryskipamount}} 229 230% 231% - initialization. 232% 233 234% set output routine 235\newbox\leftcolumn 236\newbox\centercolumn 237\let\currentcolumn=L 238\output={\if L\currentcolumn 239 \global\setbox\leftcolumn=\columnbox \global\let\currentcolumn=C% 240 \else 241 \if C\currentcolumn 242 \global\setbox\centercolumn=\columnbox \global\let\currentcolumn=R% 243 \else 244 \tripleformat \global\let\currentcolumn=L% 245 \fi 246 \fi} 247 248% switch to our default font 249\rm 250 251% ragged format 252\raggedbottom 253\raggedright 254