<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">%Date: Fri, 24 Nov 89 13:44:13 EST
%From: Denys Duchier &lt;duchier-denys@YALE.ARPA&gt;
%Subject: Re: secret.sty?
%Keywords: LaTeX, secret.sty
%
%&gt;   Does anyone out there have an option file for report.sty (call
%&gt;   it secret.sty?) which does the following (for use in LaTeXing
%&gt;   classified reports):
%&gt;
%&gt;   (1)  all paragraphs must begin with a (U), (C), or (S) which
%&gt;   denotes unclassified, confidential, and secret, respectively.
%&gt;
%&gt;   (2)  if a paragraph continues on the next page, the (U), (C),
%&gt;   and (S) has to be inserted into the first line of the continuing
%&gt;   paragraph on the next page.
%
%I don't think requirement (2) can be satisfied as stated because when
%TeX exercises its page breaking algorithm, paragraphs have already
%been formatted and broken into individual lines, each one put in its
%own box and appended to the vertical list: you can't insert (S) at the
%top of the next page and have TeX reconsider line breaks.
%
%However, it is possible to come close: instead of putting the labels
%in the running text, we can let them hang out in the margin. The code
%below appears to work on the example I tried; put it in file
%secret.sty and use \documentstyle[secret]{article} or something like
%it at the top of your document.
%
%If you type \unclassified (resp. \confidential or \secret) the
%subsequent paragraphs will begin with (U) (resp. (C) or (S)) hanging
%out in the margin. \nosecret turns off this behaviour. You can also
%use them as environments.
%
%%--Denys
%Organization: Computer Science, Yale University, New Haven, CT 06520-2158
%%% File: secret.sty

\def\@markright#1#2#3#4{\gdef\@themark{{#1}{#4}{#3}}}
\def\@markextra#1#2#3#4{\gdef\@themark{{#1}{#2}{#4}}}
\def\@markboth#1#2#3#4#5{\gdef\@themark{{#4}{#5}{#3}}}

\def\@leftmark#1#2#3{#1}
\def\@rightmark#1#2#3{#2}
\def\@extramark#1#2#3{#3}

\def\markboth#1#2{{\let\protect\noexpand
  \let\label\relax \let\index\relax
  \expandafter\@markboth\@themark
  {#1}{#2}\mark{\@themark}}\if@nobreak\ifvmode\nobreak\fi\fi}

\def\markextra#1{{\let\protect\noexpand
  \let\label\relax \let\index\relax
  \expandafter\@markextra\@themark
  {#1}\mark{\@themark}}\if@nobreak\ifvmode\nobreak\fi\fi}

\def\extrabotmark{\expandafter\@extramark\botmark}
\def\extrafirstmark{\expandafter\@extramark\firstmark}

\def\@themark{{}{}{}}

\newdimen\@tempdimc

\output{\@tempdimc = \dp255
  \ifnum\outputpenalty &lt;-\@M\@specialoutput\else
  \@makecol\@opcol\@floatplacement\@startcolumn
  \@whilesw\if@fcolmade \fi{\@opcol\@startcolumn}\fi
  \global\vsize\ifnum\outputpenalty &gt;-\@Miv \@colroom
                  \else \maxdimen\fi
  \edef\@tempa{\extrabotmark}\ifx\@tempa\empty\else
    \llap{\@tempa\hskip\labelsep}\advance\@tempdimc
    -\prevdepth \advance\@tempdimc -\baselineskip
    \kern\@tempdimc\fi}

\def\@secret#1{\everypar{\markextra{}\llap{#1\hskip\parindent\hskip\labelsep}\markextra{#1}}}

\def\unclassified{\@secret{(U)}}
\def\confidential{\@secret{(C)}}
\def\secret{\@secret{(S)}}

\def\nosecret{\markextra{}\everypar{}}

\let\@extraenddocument\enddocument
\def\enddocument{\nosecret\@extraenddocument}

%--Denys
</pre></body></html>