singcard.tex 6.4 KB

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