summaryrefslogtreecommitdiff
path: root/macros/plain/contrib/misc/mhack.tex
diff options
context:
space:
mode:
Diffstat (limited to 'macros/plain/contrib/misc/mhack.tex')
-rw-r--r--macros/plain/contrib/misc/mhack.tex102
1 files changed, 102 insertions, 0 deletions
diff --git a/macros/plain/contrib/misc/mhack.tex b/macros/plain/contrib/misc/mhack.tex
new file mode 100644
index 0000000000..6f0546a19d
--- /dev/null
+++ b/macros/plain/contrib/misc/mhack.tex
@@ -0,0 +1,102 @@
+%% Save file as: MHACK.TEX Source: FILESERV@SHSU.BITNET
+%% Original author: Norman Walsh <walsh@cs.umass.edu>
+%% Original source: Posted to INFO-TeX@SHSU.edu by
+%% RAY BROHINSKY <RAYBRO%HOLON@utrcgw.utc.com> on Fri, 27 Sep 1991 16:29 EDT
+%%
+%Here are two solutions for marginal hacks. \ihack is based upon
+%the marginal hacks notes in the book and requires the section that
+%redefines \pagecontents. It has the defect that marginal hacks
+%start at the top of the page rather than where you put them in the
+%text.
+
+%\vhack doesn't use inserts and has the advantage that you don't
+%need to redefine part of the output routine (\pagecontents) but if
+%you put several hacks very close to each other, they may overlap.%
+
+%Let me know what you think. If you have try to integrate them into
+%your notes and you have trouble, just let me know.
+
+% mhack.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\font\marginhackfont=cmr7
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newinsert\margin
+\dimen\margin=\maxdimen
+\count\margin=0 \skip\margin=0pt
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newdimen\marginhackwidth
+\newdimen\marginhackshift
+\newdimen\marginhacknudge
+\marginhackwidth=.8in
+\marginhackshift=\hsize
+\advance\marginhackshift by .1in
+\marginhacknudge=.1in
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\def\ihack#1{\marginhacknudge=0pt\insert\margin{\hbox{\marginhackpara{#1}}}}
+\def\vhack#1{\vadjust{\vbox to 0pt{%
+ \marginhacknudge=.1in%
+ \vskip-8.5pt% move it back up the page
+ \hskip6.2in\rlap{%
+ \marginhackpara{#1}}\vss}}}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% this is a modified version of \para that I got
+% from ... somewhere
+%
+\long\def\marginhackpara#1{% %
+ \hskip\marginhacknudge %
+ \vtop{\leftskip=0pt\rightskip=0pt % Make width ok
+ \hsize=\marginhackwidth %
+ \marginhackfont % select font
+ \parindent=0pt %
+ \baselineskip=6pt %
+ \everypar={} %
+ \lineskip=1pt %
+ \lineskiplimit=1pt %
+ \raggedright %
+ \hbadness=10000 % I don't care about underfull boxes
+ \tolerance=10000 % I don't care about overfull ones
+ \noindent % don't indent
+ \vrule width0pt height8.5pt % line up top of hack and text
+ #1\relax % add the text
+ \vrule width 0pt depth 7pt}% % pad bottom of box
+}%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Include the marginal hacks in the plain output routine
+% (only needed for \ihack)
+\catcode`@=11
+\def\pagecontents{\ifvoid\topins\else\unvbox\topins\fi
+ \ifvoid\margin\else %
+ \rlap{\kern\marginhackshift\vbox to 0pt{\box\margin\vss}}\fi
+ \dimen@=\dp\@cclv \unvbox\@cclv % open up \box255
+ \ifvoid\footins\else % footnote info is present
+ \vskip\skip\footins
+ \footnoterule
+ \unvbox\footins\fi
+ \ifr@ggedbottom \kern-\dimen@ \vfil \fi}
+\catcode`@=12 % at signs are no longer letters
+
+\endinput
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+Here is some text followed by more text and more text and more text and
+more text and more text and more text and more text and more text and
+more text and more text and more text and more text and more text and
+more text and more text and more text and more text and more text and
+more text and more text and more text and more text and more text and
+more text and more text and more text and more text and more text and
+more text and more text and more text and more text and more text and
+more text and more text and more text and more text and more text and
+more text and more text and more text and more text and more text and
+more text and more text and VHACK\vhack{this is a vhack, it starts
+here and goes on for several lines} more text and more text and
+more text and more text and more text and more text and more text and
+more VHACK\vhack{this is another vhack, which collides}
+and more text and more text and more text and more text and
+more text and more IHACK\ihack{this is an ihack, it starts at the top}
+and more text and more text and more
+IHACK\ihack{this is a second ihack, but it doesn't collide}
+and more text and more text and more text and more text and more text and
+more text and more text and more text and more text and more text and
+more text and more text and more text and more text and more text and
+more text and more text and more text and more text and more text and
+more text and more text and more text and more text and more text.
+\bye
+% end of mhack.tex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%