Subject: tex macros

From: [email-masked]
Date: Tue, 7 Sep 93 08:27:36 PDT

Ian Glendinning writes:

> Rik,
>     could you please send me (or perhaps better, post to the mail list) a
> copy of the various Latex command definitions used in your caching proposal.
> (e.g. \funcdef)  Thanks,
>   Ian

The official macros and the tex source that I started with 
can be anonymous ftp'd from cse.ogi.edu as pub/otto/MPI/*.tex .

My piece on cacheing fits into file 'context.tex', which requires
chapter-head.tex and mpi-macs.tex .

Here are chapter-head.tex and mpi-macs.tex as of Sept.3, 1993.

--Rik
----------------------------------------------------------------------
[email-masked] (alias 'd39135')   Rik Littlefield
Tel: 509-375-3927                         Pacific Northwest Lab, MS K1-87
Fax: 509-375-6631                         P.O.Box 999, Richland, WA  99352

--- cut here: chapter-head.tex --------------------------

% Version as of July 30, 1993

%
%chapter-head.tex

%Version of July 29, 1993 - Steve Otto, Oregon Graduate Institute

\documentstyle[twoside,11pt]{report}
\pagestyle{plain}
%\markright{ {\em Draft Document of the MPI Standard,\/ \today} }
\marginparwidth 0pt
\oddsidemargin=.25in
\evensidemargin  .25in
\marginparsep 0pt
\topmargin=-.5in
\textwidth=6.0in
\textheight=9.0in
\parindent=2em

\input{psfig}
\include{mpi-macs}
\makeindex

\hyphenation{sub-script mul-ti-ple}

\begin{document}

\setcounter{page}{1}
\pagenumbering{roman}

\title{ {\em D R A F T} \\ Document for a Standard Message-Passing Interface}

\author{Message Passing Interface Forum}

\date{\today \\
This work was supported in part by ARPA and NSF under grant ASC-9310330,
the National Science Foundation Science and
Technology Center Cooperative Agreement No. CCR-8809615,
and by the Commission of the European Community through Esprit project
P6643.
}

\maketitle
\hfuzz=5pt

\newpage
\vspace{5.0in}
This is the result of a LaTeX run of a draft of a single chapter of 
the MPIF Final Report document.
\newpage

\setcounter{page}{1}
\pagenumbering{arabic}
\pagestyle{headings}  \withlinenumbers

--- cut here: mpi-macs.tex --------------------------

% Version as of July 30, 1993

%   ----------------------------------------------------------------------
%   mpi-macs.tex  --- man page macros,
%                discuss, missing, mpifunc macros
%
% ----------------------------------------------------------------------
% a couple of commands from Marc Snir, modified S. Otto

\newlength{\discussSpace}
\setlength{\discussSpace}{.7cm}

\newcommand{\discuss}[1]{\vspace{\discussSpace} {\small {\bf Discussion:} #1} \vspace{\discussSpace}
}

\newcommand{\missing}[1]{\vspace{\discussSpace} {\small {\bf Missing:} #1} \vspace{\discussSpace}
}

\newcommand{\implement}[1]{\vspace{\discussSpace}
{\small {\bf Implementation note:} #1} \vspace{\discussSpace} }

\newlength{\codeSpace}
\setlength{\codeSpace}{.4cm}

\def\mpi{{\sc mpi\ }}	% MPI macro

\newenvironment{funcdef}[1]{ 	
    \vspace{\codeSpace}
    \noindent
    \samepage
    {\func{#1}}\index{#1}
    \begin{list}{}{ 			% see pg 113 of Lamport's book
	\setlength{\leftmargin}{200pt} 
	\setlength{\labelwidth}{180pt} 
	\setlength{\labelsep}{10pt} 
	\setlength{\itemindent}{0pt}
	\setlength{\itemsep}{0pt}
	\setlength{\topsep}{5pt}
    }
}{\end{list} \vspace{\codeSpace}}

\newenvironment{cfuncdef}[1]{ 	
    \vspace{\codeSpace}
    \noindent
    C binding:

    \noindent
    \samepage
    {\cfunc{#1}}
    \begin{list}{}{ 			% see pg 113 of Lamport's book
	\setlength{\leftmargin}{200pt} 
	\setlength{\labelwidth}{180pt} 
	\setlength{\labelsep}{10pt} 
	\setlength{\itemindent}{0pt}
	\setlength{\itemsep}{0pt}
	\setlength{\topsep}{5pt}
    }
}{\end{list} \vspace{\codeSpace}}

\newenvironment{ffuncdef}[1]{ 	
    \vspace{\codeSpace}
    \noindent
    Fortran binding:

    \noindent
    \samepage
    {\ffunc{#1}}
    \begin{list}{}{ 			% see pg 113 of Lamport's book
	\setlength{\leftmargin}{200pt} 
	\setlength{\labelwidth}{180pt} 
	\setlength{\labelsep}{10pt} 
	\setlength{\itemindent}{0pt}
	\setlength{\itemsep}{0pt}
	\setlength{\topsep}{5pt}
    }
}{\end{list} \vspace{\codeSpace}}

					% see page 77, the TeX book.
\newcommand{\funcarg}[3]{\item[\hbox to 45pt{\type{#1} \hfill} \mpiarg{#2}\hfill]{\small #3}}
\newcommand{\cfuncarg}[3]{\item[\hbox to 70pt{\ctype{#1} \hfill} \carg{#2}\hfill]{\small #3}}
\newcommand{\ffuncarg}[3]{\item[\hbox to 50pt{\ftype{#1} \hfill} \farg{#2}\hfill]{\small #3}}

\newcommand{\funcold}[1]{\vspace{\codeSpace} {\bf #1} \vspace{\codeSpace} }
\newcommand{\mpifuncold}[1]{\vspace{\codeSpace} {\bf #1} \vspace{\codeSpace} }
\newcommand{\func}[1]{{\sf #1}}
\newcommand{\mpifunc}[1]{{\sf #1}}
\newcommand{\cfunc}[1]{{\sf #1}}
\newcommand{\ffunc}[1]{{\sf #1}}
\newcommand{\const}[1]{{\small\sf #1}}
\newcommand{\cconst}[1]{{\sf #1}}
\newcommand{\fconst}[1]{{\sf #1}}
\newcommand{\constitem}[2]{\item[\const{#1}\hfill]{#2}}
\newcommand{\mpiarg}[1]{{\sf #1}}
\newcommand{\carg}[1]{{\sf #1}}
\newcommand{\farg}[1]{{\sf #1}}
\newcommand{\type}[1]{{\sf #1}}
\newcommand{\ctype}[1]{{\tt #1}}
\newcommand{\ftype}[1]{{\tt #1}}

\newcommand{\IN}[0]{\small IN}
\newcommand{\OUT}[0]{\small OUT}
\newcommand{\INOUT}[0]{\small INOUT}

\newenvironment{constlist}[0]{ 	
    \vspace{\codeSpace}
    \noindent
    \begin{list}{}{ 			% see pg 113 of Lamport's book
	\setlength{\leftmargin}{200pt} 
	\setlength{\labelwidth}{190pt} 
	\setlength{\labelsep}{10pt} 
	\setlength{\itemindent}{10pt}
	\setlength{\itemsep}{-5pt}
	\setlength{\topsep}{-5pt}
    }
}{\end{list} \vspace{\codeSpace}}

% command to indicate changes
\newcommand{\change}{\marginpar{\tiny \bf \ CHANGE}}

% command to indicate topics that need be discussed
\newcommand{\todiscuss}{\marginpar{\tiny \bf \ TO DISCUSS}}

%	some commands from Bill Gropp

\def\code#1{{\tt #1}}
\def\setmargin#1{\begingroup\leftmargin #1 \advance\leftmargin\labelsep 
                 \leftmargini #1 \advance\leftmargini\labelsep}
\def\esetmargin{\endgroup}
\def\ibamount{3.0cm\relax}
\def\ibaamount{4.0cm}
\def\ibdamount{4.5cm}
\def\ibcamount{2.0cm}
\def\ib#1{\hbox to \ibamount{#1\hfil}}
\def\iba#1{\hbox to \ibaamount{#1\hfil}}
\def\ibd#1{\hbox to \ibdamount{#1\hfil}}
\def\ibc#1{\hbox to \ibcamount{#1\hfil}}

% Use \code{...} for code fragments
%\def\code#1{{\tt #1}}
% Use \df{name} for a definition of name in the text
\def\df#1{{\bf #1}}
% Use \note{text} for marginal notes
\def\note#1{\marginpar{\bf #1}}

%
% Get line numbers in the gutters.  Thanks to Guy Steele and HPFF!
%

\makeatletter
%
% This is used to put line numbers on plain pages.  Used in draft.tex
%
\def\withlinenumbers{\relax
  \def\@oddfoot{\hbox to 0pt{\hss\LineNumberRuler\hskip 1.5pc}\hfil}\relax
  \def\@evenfoot{\hfil\hbox to 0pt{\hskip 1.5pc\LineNumberRuler\hss}}}

\def\LineNumberRuler{\vbox to 0pt{\vss\normalsize \baselineskip13.6pt
    \lineskip 1pt \normallineskip 1pt \def\baselinestretch{1}\relax
    \LNR{1}\LNR{2}\LNR{3}\LNR{4}\LNR{5}\LNR{6}\LNR{7}\LNR{8}\LNR{9}
    \LNR{10}\LNR{11}\LNR{12}\LNR{13}\LNR{14}
	\LNR{15}\LNR{16}\LNR{17}\LNR{18}\LNR{19}
    \LNR{20}\LNR{21}\LNR{22}\LNR{23}\LNR{24}
	\LNR{25}\LNR{26}\LNR{27}\LNR{28}\LNR{29}
    \LNR{30}\LNR{31}\LNR{32}\LNR{33}\LNR{34}\LNR{35}
	\LNR{36}\LNR{37}\LNR{38}\LNR{39}
    \LNR{40}\LNR{41}\LNR{42}\LNR{43}\LNR{44}
	\LNR{45}\LNR{46}\LNR{47}\LNR{48}
    \vskip 31pt}}
\def\LNR#1{\hbox to 1pc{\hfil\tiny#1\hfil}}

\def\ps@plainwithlinenumbers{\ps@plain\withlinenumbers}

%
% 1st page of a chapter has its own page style, so we have to put line
% numbers in here also.
%
\def\chapter{\clearpage \thispagestyle{plainwithlinenumbers}
	\global\@topnum\z@ \@afterindentfalse \secdef\@chapter\@schapter} 

%
% Change "Chapter" to "Section", "Appendix" to "Annex"
%
\def\@chapapp{Section}
\def\appendix{\par
 \setcounter{chapter}{0}
 \setcounter{section}{0}
 \def\@chapapp{Annex}
 \def\thechapter{\Alph{chapter}}}

\makeatother

%
% Also from HPFF.  These look potentially useful.
%

\newenvironment{rationale}{\begin{list}{}{}\item[]{\it Rationale.}
}{{\rm ({\it End of rationale.})} \end{list}}

\newenvironment{implementors}{\begin{list}{}{}\item[]{\it Advice
	to implementors.}
}{{\rm ({\it End of advice to implementors.})} \end{list}}

\newenvironment{users}{\begin{list}{}{}\item[]{\it Advice to users.}
}{{\rm ({\it End of advice to users.})} \end{list}}

%
% Use Sans Serif font for sections, etc.  S. Otto
%
\makeatletter
\def\section{\@startsection {section}{1}{\z@}{-3.5ex plus -1ex minus 
-.2ex}{2.3ex plus .2ex}{\Large\sf}}
\def\subsection{\@startsection{subsection}{2}{\z@}{-3.25ex plus -1ex minus 
-.2ex}{1.5ex plus .2ex}{\large\sf}}
\def\subsubsection{\@startsection{subsubsection}{3}{\z@}{-3.25ex plus 
-1ex minus -.2ex}{1.5ex plus .2ex}{\normalsize\sf}}
\def\paragraph{\@startsection {paragraph}{4}{\z@}{3.25ex plus 1ex 
minus .2ex}{-1em}{\normalsize\sf}}
\def\subparagraph{\@startsection {subparagraph}{4}{\parindent}{3.25ex 
plus 1ex minus .2ex}{-1em}{\normalsize\sf}}
\makeatother
%
% An Editor's Note macro
%
\def\ednote#1{{\sl Editor's note: #1}}

% a way to comment out large sections of text
\newcommand{\commentOut}[1]{{}}

%
%  A few commands to help in writing MPI man pages
%
\def\twoc#1#2{
\begin{list}
{\hbox to95pt{#1\hfil}}
{\setlength{\leftmargin}{120pt}
 \setlength{\labelwidth}{95pt}
 \setlength{\labelsep}{0pt}
 \setlength{\partopsep}{0pt}
 \setlength{\parskip}{0pt}
 \setlength{\topsep}{0pt}
}
\item
{#2}
\end{list}
}
\outer\long\def\onec#1{
\begin{list}
{}
{\setlength{\leftmargin}{25pt}
 \setlength{\labelwidth}{0pt}
 \setlength{\labelsep}{0pt}
 \setlength{\partopsep}{0pt}
 \setlength{\parskip}{0pt}
 \setlength{\topsep}{0pt}
}
\item
{#1}
\end{list}
}
\def\manhead#1{\noindent{\bf{#1}}}

\makeatletter
%
% make our own index environment that can have a different
% title than just "Index" -- S. Otto
%
\def\@index{Index}
\newif\if@restonecol
\def\myindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
\columnseprule \z@
%\columnsep 35pt\twocolumn[\@makeschapterhead{Index}]
 %\@mkboth{INDEX}{INDEX}\thispagestyle{plain}\parindent\z@
\columnsep 35pt\twocolumn[\@makeschapterhead{\@index}]
 \@mkboth{\@index}{\@index}\thispagestyle{plain}\parindent\z@
 \parskip\z@ plus .3pt\relax\let\item\@idxitem}
\def\@idxitem{\par\hangindent 40pt}
\def\subitem{\par\hangindent 40pt \hspace*{20pt}}
\def\subsubitem{\par\hangindent 40pt \hspace*{30pt}}
\def\endmyindex{\if@restonecol\onecolumn\else\clearpage\fi}
\def\indexspace{\par \vskip 10pt plus 5pt minus 3pt\relax}
\makeatother