% author: norm % HISTYLE.TEX %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % 07/23/1991: -started working on it (ndw) % -1.0 % 07/24/1991: -added \begin{box}...\end{box} % -added \setboxthickness % -added \in, \inr, \inboth % -added \begin{inboth}{}...\end{inboth}{} % -1.1 % 07/25/1991: -added \begin{points}, \begin{bullets}, \begin{list} % -cleaned up some comments (there still aren't enough) % -1.2 % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % make sure we don't get loaded twice \ifx\HighStyleLoaded\relax\endinput\fi \let\HighStyleLoaded=\relax %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\HighStyleMacrosVer{1.2} \message{cLoading HighStyle macros|} \input startup % defines bullets used in the \begin{bullets} environment %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % this file contains the very rudimentary beginnings of a ``HighStyle'' % environment for TeX. It is in Plain TeX and not LaTeX ... don't say % I didn't warn you! % % Note: the grouping mechanisms in HighStyle and TeX are fundamentally % different and they are, in a small way, incompatible. In % HighStyle functions, the function name goes inside the curly % braces, in TeX, it must go outside the braces. % % For example, in HighStyle you would say {q This is in quotes} % but in TeX, you must say \q{This is in quotes}. There's not % much that we can do about this... % % The following macros have been defined: % % \abs{} returns the absolute value of a number (for printing, not % for use in math in macros! Also, only for integers) % \accept reads from the keyboard and creates a control sequence % (variable) % \blank{} creates a blank line of the requested length (i.e. \blank{1in} % produces a blank line 1 inch long). % \bo turns on bold, it should be used within {}'s % \begin{boldtext} Like \bo but it does the grouping for you... % \end{boldtext} % \begin{box} A box environment. It's not real robust but it does handle % \end{box} \leftskip and \rightskip's % \setboxthickness{} Sets the thickness of the rules used in \begin{box}... % \setboxgutter{} Sets the box gutter (\graphboxborder) % \center{} Center's text % \in{} Moves the left margin in % \inr{} Moves the right margin in % \inboth{} Moves in the left and right margins % \begin{inboth}{} Indents the left and right margins by parameter % \end{inboth} % \begin{points}width= just= text= Starts a points % \end{points} environment. Use \p{} to define points % \begin{list} Begins a numbered list. Lists can be nested up to three % \end{list} levels deep, level one is numbered 1,2,3..., level two is % numbered a,b,c..., and level 3 is numbered i,ii,iii,iv... % \begin{bullets} Starts a bulleted environment, six levels are defined. % \end{bullets} % \q{} Produces quoted text (i.e. typographic ``quotes'') % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % for the duration of of this input file, @ is a letter ... this makes % it possible to create control sequences that cannot (easily) be used % outside this macro file...neat, sorta... \catcode`@=11 % @ is a letter here %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % We're going to screw with the meaning of \end, so make sure we can % still use the real one ... \let\@end=\end % now redefine \bye to use the @end \outer\def\bye{\par\vfil\supereject\@end} % just like the real \bye... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newcount\workreg % just a work integer \newdimen\workdim % just another workreg... \newread\console % input file for accept %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % My \begin{box} box macro tries to be really clever. It probably % isn't, but it's as clever as my TeXnical ability can get me right % now. I collect the material in a \vbox then I use the values of % \leftskip and \rightskip to trim it down, (the \vbox is always % \hsize in width because that's the way TeX set it). From this % box, I generate a box with a border that is indented by the % appropriate \leftskip amount. Improvements are welcome... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newbox\graphbox % \begin{box} box \newdimen\graphboxwidth % width of box \newdimen\graphboxleftmar % left margin of box \newdimen\graphboxborder % border distance (from rules to text) \graphboxborder=0.25in % defaults to 0.25in \newdimen\graphboxthick % border thickness (thickness of rules) \graphboxthick=0.4pt % defaults to 0.4pt %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % \begin and \end macros, thanks (mostly) to Bert Bos . % Thanks Bert! \def\begin#1{\begingroup \let\@group\relax% \expandafter\let\expandafter\@group\csname @begin#1\endcsname% \csname @begin#1\endcsname} % execute command \def\end#1{\expandafter\ifx\csname @begin#1\endcsname\@group\else% \errmessage{End doesn't match begin: \noexpand\end{#1}}\fi% \expandafter\ifx\csname @end#1\endcsname\relax \else \csname @end#1\endcsname\fi \endgroup} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Absolute value, no one is ever going to use this but...it was in % HighStyle, so here it is. Actually, it was in HighStyle and it was % easy to do so here it is (there are lots of things in HighStyle that % I haven't (and probably won't) implement. \def\abs#1{% \workreg=#1 \ifnum0>\workreg \number -\workreg \else \number \workreg \fi } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % asks the user for a string \def\accept{\immediate\read\console to} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % makes a blank rule \def\blank#1{\hbox to #1{\hrulefill}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % bold faced text \def\bo{\bf} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % bold faced text in a group \def\@beginboldtext{\begingroup\bo} \def\@endboldtext{\endgroup} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This is a rather fragile set of macros for handling the \begin{box}... % \end{box} environment. It will handle changes in \leftskip and \rightskip % and it will handle multiple paragraphs, but I don't think it will % handle really complex things like multiple pages or anything like that. % \def\setboxthickness#1{\global\graphboxthick=#1} \def\setboxgutter#1{\global\graphboxborder=#1} \def\@beginbox{\par% \global\graphboxleftmar=\leftskip% \global\graphboxwidth=\hsize% \global\advance\graphboxwidth by -\graphboxleftmar% \global\advance\graphboxwidth by -\rightskip% \global\advance\graphboxwidth by 2\graphboxborder% \global\advance\graphboxleftmar by -\graphboxborder% \setbox\graphbox=\vbox\bgroup} \def\@endbox{\par\egroup% \setbox\graphbox=\vbox{\hbox to \graphboxwidth{\hss\box\graphbox\hss}}% \hbox{\hskip\graphboxleftmar% \vrule width\graphboxthick% \vbox{% \hrule height\graphboxthick depth0pt% \vskip\graphboxborder% \box\graphbox% \vskip\graphboxborder% \hrule depth\graphboxthick height0pt% }% \vrule width\graphboxthick% }% } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\center#1{\hbox to \hsize{\hfil#1\hfil}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\in#1{\global\advance\leftskip by #1} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\inr#1{\global\advance\rightskip by #1} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\inboth#1{\in{#1}\inr{#1}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\@begininboth#1{\bgroup\leftskip=#1\rightskip=#1} \def\@endinboth{\egroup} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This defines \begin{points}, \begin{bullets}, and \begin{list}. Of % course, it also defines the appropriate \end{}s... % % \begin{points}width=1in just=f|l|r|c text=i|r|b % \begin{list} up to three levels... % \begin{bullets} up to six levels... % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Make sure we don't load the file more than once... %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newdimen\pointwidth % how wide are the points \newdimen\pointindent % how much indentation \newdimen\pointgutter % gutter between points and text \newcount\listnumnormal % list item number (depth 1) \newcount\listnumalpha % list item number (depth 2) \newcount\listnumroman % list item number (depth 3) \newcount\listdepth % current list depth \newcount\bulldepth % current bullet list depth \def\pointfulljust{f} % full justification? \def\pointrightjust{r} % right justification? \def\pointleftjust{l} % left justification? \def\pointcenterjust{c} % center justification? \def\pointtextitalic{i} % italic text \def\pointtextbold{b} % bold text \def\pointitalic{\it} % \it is defined in plain tex, change % this to use other fonts \def\pointbold{\bf} % \bf is for emphasized text, change % (or redefine after \input) for other % fonts... \def\pointedges{\raggedright} % intially, fully justified points are % \raggedright %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % These macros let you change the justification of fully justified points. % Initially they are \raggedright because it is less likely to be ugly when % text is set in the narrow column. If you make it \justifiedpoints, then % they will be justified, IF your text is currently being justified. I'm % not sure, off the top of my head, how to get justified points if you % have said \raggedright somewhere in your document... % \def\raggedpoints{\global\def\pointedges{\raggedright}} \def\justifiedpoints{\global\def\pointedges{\relax}} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % Now we initialize the things we just defined. \listdepth=0 % initial depth is zero \bulldepth=0 \pointgutter=1em % gutterwidth is 1em %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \long\def\@pointpara#1{% % \vtop{\leftskip=0pt\rightskip=0pt % Make width ok \hsize=\pointwidth % \parindent=0pt % \everypar={} % \lineskip=1pt % \lineskiplimit=1pt % \pointedges % setup justification \hbadness=10000 % I don't care about underfull boxes \tolerance=10000 % I don't care about overfull ones \noindent #1\relax % either \vrule width 0pt depth 6pt}% % hold depth of box }% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\@beginpoints width=#1 just=#2 text=#3{ % starts points environment... \par % end this env. with \@endpoints \bgroup \def\pointjust{#2} \def\pointtext{#3} \pointwidth=#1 \pointindent=\leftskip \advance\leftskip by \pointwidth \advance\leftskip by \pointgutter } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\@endpoints{\par\egroup} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\p#1{% % this macro does the grunt work \par\vskip\parskip % workaround, why doesn't \par do % the skip here. \def\pointtextstyle{} % initially unchanged text style \ifx\pointtextitalic\pointtext \def\pointtextstyle{\pointitalic} \else \ifx\pointtextbold\pointtext \def\pointtextstyle{\pointbold} \fi \fi \ifx\pointfulljust\pointjust \setbox0=\vbox{\@pointpara{\pointtextstyle #1}} \else \ifx\pointrightjust\pointjust \setbox0=\vbox{\hbox to \pointwidth{\hfil\pointtextstyle #1}} \else \ifx\pointleftjust\pointjust \setbox0=\vbox{\hbox to \pointwidth{\pointtextstyle #1\hfill}} \else \ifx\pointcenterjust\pointjust \setbox0=\vbox{\hbox to \pointwidth{\hfil\pointtextstyle #1\hfil}} \else \message{begin{points}: invalid justification} \setbox0=\vbox{\@pointpara{\pointtextstyle #1}} \fi \fi \fi \fi \workdim=\ht0 \advance \workdim by \dp0 \vbox{\hbox{\hskip\pointindent\box0}}% \vskip-\workdim \vskip-\parskip \nointerlineskip \indent } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\@beginlist{ % starts a list environment. Lists \par % may be nested up to 3 levels deep. \bgroup % end with \@endlist \advance\listdepth by 1 \ifcase\listdepth \or % level=0, do nothing (won't happen) \listnumnormal=0% \def\listnumber{\number\listnumnormal.}\or % level=1 \listnumalpha=96% \def\listnumber{\char\listnumalpha.}\or % level=2 \listnumroman=0% \def\listnumber{\romannumeral\listnumroman.}\or % level=3 \errmessage{Lists are nested too deep!}% \fi % level>3, error message... \@beginpoints width=0.4in just=r text=r% \everypar={\hangindent=\parindent\hangafter=1\@listp}% } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\@listp{% \ifcase\listdepth \or% immediately skip the zero case ... \advance\listnumnormal by 1\or % level=1 \advance\listnumalpha by 1\or % level=2 \advance\listnumroman by 1\or % level=3 \fi % do nothing for > 3 % redefine \everypar around \p so that we don't get an infinite loop \everypar={\hangindent=\parindent\hangafter=1}% % the \vskips below are a really kludgy workaround. For some reason % the \p macro in a list environment is inserting one extra \baselineskip % and one extra \parskip. Probably need to end a few of the lines in % these macros with %'s to get rid of any extra spaces. In any event, % I use negative space to back them out rather than spending time now % figuring out how to really fix the problem (which I'm afraid might % break something else anyway) Hopefully the list and points environments % are well-defined enough so that lack of robustness won't be a problem... \vskip-\baselineskip \vskip-\parskip \p{\listnumber}% \everypar={\hangindent=\parindent\hangafter=1\@listp}% } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\@endlist{% \@endpoints \egroup } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\@beginbullets{ % starts a bullet environment. Lists \par % may be nested up to 3 levels deep. \bgroup % end with \@endbullets \advance\bulldepth by 1 % % If you want/have to use other bullets, just redefine them here... % for example $\bullet$ is about the same as \circle (but these come % from a special font) % \ifcase\bulldepth \or % level=0, do nothing (won't happen) \def\@bullpt{\circle}\or % level=1 \def\@bullpt{\ocircle}\or % level=2 \def\@bullpt{\square}\or % level=3 \def\@bullpt{\osquare}\or % level=4 \def\@bullpt{\triangle}\or % level=5 \def\@bullpt{\otriangle}\or % level=6 \errmessage{Bullets are nested too deep!}% \fi % level>3, error message... \@beginpoints width=0.25in just=r text=r% \everypar={\hangindent=\parindent\hangafter=1\@bullp}% } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\@bullp{% % redefine \everypar around \p so that we don't get an infinite loop \everypar={\hangindent=\parindent\hangafter=1}% % the \vskips below are a really kludgy workaround. For some reason % the \p macro in a list environment is inserting one extra \baselineskip % and one extra \parskip. Probably need to end a few of the lines in % these macros with %'s to get rid of any extra spaces. In any event, % I use negative space to back them out rather than spending time now % figuring out how to really fix the problem (which I'm afraid might % break something else anyway) Hopefully the list and points environments % are well-defined enough so that lack of robustness won't be a problem... \vskip-\baselineskip \vskip-\parskip \p{\@bullpt}% \everypar={\hangindent=\parindent\hangafter=1\@bullp}% } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\@endbullets{% you MUST end the \bulletpoints environment this way! \@endpoints \egroup } %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\q#1{``#1''} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \catcode`@=12 % @ is not a letter, this has to be the last thing in the file % eof % HISTYLE.TEX %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%