diff options
author | Holden Rohrer <hr@hrhr.dev> | 2020-07-05 22:39:41 -0400 |
---|---|---|
committer | Holden Rohrer <hr@hrhr.dev> | 2020-07-06 18:42:06 -0400 |
commit | a397704baca9c18aed7575006703e9880b9e27e0 (patch) | |
tree | e9fa1068628978d92058cdb793cb6d44ecd0f747 /fmt | |
parent | 7fb897a5dce7c3c3af4b432366967132e7c5a06c (diff) |
cleanup, extension, and table improvements
Diffstat (limited to 'fmt')
-rw-r--r-- | fmt/com.h | 5 | ||||
-rw-r--r-- | fmt/doc.h | 17 | ||||
-rw-r--r-- | fmt/font.h | 16 |
3 files changed, 18 insertions, 20 deletions
@@ -22,3 +22,8 @@ \def\imgskip{\vskip\imgskipamount} \imgskipamount=0pt plus 48pt \def\image #1 {\imgskip\input #1\imgskip} + +\newcount\pics +\def\caption#1{\def\a{#1}\ifx\a\empty\else\global\advance\pics by +1\smallskip\line{\vbox{\leftskip=0pt plus 1fill\rightskip=0pt plus +1fill\parindent=0pt\relax Fig \number\pics: #1}}\smallskip\fi} @@ -16,22 +16,13 @@ \def\section#1{\vskip .3\hsize\goodbreak\vskip -.3\hsize\bigskip\noindent{\fourteenrm #1:}\par} %% Table +\def\make#1{\hskip3pt\hfil #1\hfil\hskip3pt\vrule height 12pt depth 2pt\relax} \def\table#1{ - \medskip\vbox{\vbox{\halign{&\vrule\vphantom{\vrule height 12pt depth 2pt width 2pt}\hskip3pt\hfil ##\hfil\hskip3pt\vrule\cr\noalign{\hrule} + \halign{\vrule\make{##}&&\make{##}\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}}} +\def\picture#1#2{\def\a{#2}\ifx\a\empty\fi\vbox{\centerline{\pic{5in}{#1}}\caption{#2}}} +\def\twopicture#1#2#3{\def\a{#3}\ifx\a\empty\fi\vbox{\line{\pic{3in}{#1}\hfil\pic{3in}{#2}}\caption{#3}}} @@ -8,7 +8,8 @@ \expandafter\getfontsizE\fontname##2#1\relax{##1}% }% \def\getfontsizE##1#1##2\relax##3{% - \ifx*##2*% Loaded at designsize + {\def\tmp{##2}\expandafter}% + \ifx\tmp\empty % empty #2 = Loaded at designsize \begingroup \font\tmpfont"##1" scaled 2000 \getfontsize\dimen0=\tmpfont @@ -21,8 +22,8 @@ \fi }% \def\getfontsiZE##1##2#1{##1=##2}% Strip " at " - \def\getfontsiZe##1\relax##2{##2=##1} - } + \def\getfontsiZe##1\relax##2{##2=##1}% + }% \expandafter\expandafter\expandafter \endgroup \expandafter\x\specialAt % From StackOverflow @@ -31,8 +32,7 @@ \global\let\f@nt\font -\gdef\spacing{ - \afterassignment\adjs \thespacing} +\gdef\spacing{\afterassignment\adjs \thespacing} \gdef\adjs{%adjust spacing \baselineskip=\size \multiply\baselineskip by \thespacing \divide\baselineskip by 100\relax} @@ -44,7 +44,9 @@ } \gdef\xfont{ \expandafter\getfontsize\expandafter\dimen0\expandafter=\realname - \expandafter\expandafter\expandafter\def - \expandafter\orig\expandafter{\realname\size\dimen0\adjs} + \setbox0=\hbox{\vphantom(}% + \dimen1=\ht0\advance\dimen1 by 1.5pt% + \expandafter\edef\orig{\realname\size\the\dimen0\setbox\strutbox=\hbox{\vrule + height \the\dimen1 depth \the\dp0 width 0pt}\adjs} } } |