diff options
Diffstat (limited to 'fmt')
-rw-r--r-- | fmt/com.h | 25 | ||||
-rw-r--r-- | fmt/doc.h | 37 | ||||
-rw-r--r-- | fmt/font.h | 50 | ||||
-rw-r--r-- | fmt/multicol.h | 35 |
4 files changed, 147 insertions, 0 deletions
diff --git a/fmt/com.h b/fmt/com.h new file mode 100644 index 0000000..0363798 --- /dev/null +++ b/fmt/com.h @@ -0,0 +1,25 @@ +%% links + +\def\link#1{% + \penalty-500% + \pdfstartlink + user{/Subtype /Link + /Border [ 0 0 0 ] + /A << + /Type /Action + /S /URI + /URI (#1) + >>}% + {\tt \color{blue} #1}% + \pdfendlink +} + +%% the godly `pre` + +\def\pre#1{\par\leavevmode\llap{\hbox to \parindent{\hfil #1 \hfil}}} + +%% gives image files surrounding stretch +\newskip\imgskipamount +\def\imgskip{\vskip\imgskipamount} +\imgskipamount=0pt plus 48pt +\def\image #1 {\imgskip\input #1\imgskip} diff --git a/fmt/doc.h b/fmt/doc.h new file mode 100644 index 0000000..85cb134 --- /dev/null +++ b/fmt/doc.h @@ -0,0 +1,37 @@ +% Generic format file pulled out from format.tex + +\input color %blue links! + +\input fmt/font.h + +%% Fonts +\font\fourteenbf=ptmb at 14pt +\font\fourteenrm=ptmb at 14pt +\font\twelverm=ptmr at 12pt + +\spacing=120 + +%% Sectioning +\def\titlesub#1#2{\centerline{\fourteenbf #1}\centerline{#2}\bigskip} +\def\section#1{\vskip .3\hsize\goodbreak\vskip -.3\hsize\bigskip\noindent{\fourteenrm #1:}\par} + +%% Table +\def\table#1{ + \medskip\vbox{\vbox{\halign{&\vrule\vphantom{\vrule height 12pt depth 2pt width 2pt}\hskip3pt\hfil ##\hfil\hskip3pt\vrule\cr\noalign{\hrule} + #1 + }}}\medskip +} +\def\vtable#1{ + \medskip\line{\hfil + \vbox{\line{\hfil{\hsize=1.5in\valign{&\hrule\vfil\vskip2pt\noindent \line{\hfil##\hfil}\par\vfil\vskip2pt\hrule\cr\noalign{\vrule} + #1 + }}\hfil}} + } +} + +%% Pictures +\newcount\pics +\def\pic#1#2{\pdfximage width #1{#2}\pdfrefximage\pdflastximage} +\def\caption#1{\def\a{#1}\ifx\a\empty\else\line{\vbox{\smallskip\leftskip=0pt plus 1fill\rightskip=0pt plus 1fill\parindent=0pt\relax Fig \number\pics: #1\bigskip}}\fi} +\def\picture#1#2{\def\a{#2}\ifx\a\empty\else\advance\pics by 1\fi\vbox{\centerline{\pic{5in}{#1}}\caption{#2}}} +\def\twopicture#1#2#3{\def\a{#3}\ifx\a\empty\else\advance\pics by 1\fi\vbox{\line{\pic{3in}{#1}\hfil\pic{3in}{#2}}\caption{#3}}} diff --git a/fmt/font.h b/fmt/font.h new file mode 100644 index 0000000..54d4b54 --- /dev/null +++ b/fmt/font.h @@ -0,0 +1,50 @@ +%% Fonts +\newcount\thespacing +\newdimen\size +\begingroup + \edef\specialAt{{ \string a\string t }}% + \def\x#1{% + \def\getfontsize##1=##2{% The user level macro + \expandafter\getfontsizE\fontname##2#1\relax{##1}% + }% + \def\getfontsizE##1#1##2\relax##3{% + \ifx*##2*% Loaded at designsize + \begingroup + \font\tmpfont"##1" scaled 2000 + \getfontsize\dimen0=\tmpfont + \divide\dimen0 by 2 + \expandafter + \endgroup + \expandafter\getfontsiZe\the\dimen0\relax{##3}% + \else% Otherwise #2 holds the size. But is is followed by " at ", so we have to strip that + \getfontsiZE{##3}##2% + \fi + }% + \def\getfontsiZE##1##2#1{##1=##2}% Strip " at " + \def\getfontsiZe##1\relax##2{##2=##1} + } + \expandafter\expandafter\expandafter +\endgroup +\expandafter\x\specialAt % From StackOverflow +{ +\catcode`\@=11 + +\global\let\f@nt\font + +\gdef\spacing{ + \afterassignment\adjs \thespacing} +\gdef\adjs{%adjust spacing + \baselineskip=\size \multiply\baselineskip by \thespacing + \divide\baselineskip by 100\relax} + +\gdef\font#1{% + \def\orig{#1}\edef\realname{\csname\string#1@font\endcsname} + \afterassignment\xfont + \expandafter\f@nt\realname +} +\gdef\xfont{ + \expandafter\getfontsize\expandafter\dimen0\expandafter=\realname + \expandafter\expandafter\expandafter\def + \expandafter\orig\expandafter{\realname\size\dimen0\adjs} +} +} diff --git a/fmt/multicol.h b/fmt/multicol.h new file mode 100644 index 0000000..1c45047 --- /dev/null +++ b/fmt/multicol.h @@ -0,0 +1,35 @@ +% Requires \newdimen\gap, \newcount\cols, adjusts to \newdimen\width + +\newdimen\fullhsize\fullhsize=\width \advance\fullhsize by -2in%1 in margin +\def\fullline{\hbox to \fullhsize}%%modify \makeheadline\makefootline +\def\widthline{\hbox to \width} +\def\fullcenter#1{\fullline{\hfil #1\hfil}} +\def\makeheadline{\vbox to 0pt{\vskip -22.5pt \fullline{% + \vbox to 8.5pt{}\the\headline}\vss}\nointerlineskip} +\def\makefootline{\baselineskip24pt\lineskiplimit0pt \fullline{\the% + \footline}} +\newcount\defs\defs=\cols\advance\defs by -1 +\hsize=\fullhsize \divide\hsize by \cols\advance\hsize by -\gap + +\newcount\col +\let\isnum\ifnum +\def\newb@x{\alloc@4\box\chardef\insc@unt} + +\loop\expandafter\newb@x\csname col\number\col\endcsname\advance\col + by 1\isnum\col<\defs\repeat +\col=0 +\output={% +\ifnum\col<\defs +\expandafter\global\expandafter\setbox\csname col\number\col\endcsname\fullbox +\global\advance\col by 1% +\else \global\col=0\shipout\vbox{\makeheadline + \fullline{% + \loop\isnum\col<\defs\expandafter\box\csname col\number\col\endcsname\hfil + \advance\col by 1\repeat\fullbox} + \makefootline} +\fi +\ifnum\outputpenalty>-20000 \else\dosupereject\fi +} +\def\fullbox{\hbox{{\expandafter}\expandafter\ifx\csname color\endcsname\relax%is color defined? +\else\colorbox{colo}{\columnbox}\fi}} +\def\columnbox{\leftline{\vbox to \vsize{\vfil}\pagebody}} |