% File nodoc.tex
% By Enrique Mel\'endez, <UEI0560130010@eurociber.es> April, 14, 1999.
% Freely distributable under, f. i. GNU.
% I do this for fun, but if you use it, I would like no know how it performs
% Please, keep the author notice.
% Put \include nodoc.tex  as the very first line of your documents.
% No responsibility.  Usde this at your own risk.  (That is, it may not work
% as you intended, but I never designed it to.)


\makeatletter
\ifx\section\undefined
    \makeatother
    \expandafter\endinput
\else

% Things we suppress are `only preamble'
% documentclass
\let\n@documentclass\documentclass
\def\documentclass{\@ifnextchar[\@documentclass@{\@documentclass@[]}}
\def\@documentclass@[#1]#2{\relax}

% usepackage
\let\n@usepackage\usepackage
\def\usepackage{\@ifnextchar[\@usepackage@{\@usepackage@[]}}
\def\@usepackage@[#1]#2{\relax}
% The following 4 should be allowed to change.  I don't know how.
% author
\let\n@author\author
\def\author#1{\gdef \@author{#1}%\relax
}
% date
\let\n@date\date
\def\date#1{\relax}
% title
\let\n@title\title
\def\title#1{\gdef \@title{#1}%\relax
}
% maketitle
\let\n@maketitle\maketitle
\def\maketitle{%
  \vskip 2em%
  \begin{center}%
  \let \footnote \thanks
    {\LARGE \@title \par}%
    \vskip 1.5em%
    {\large
      \lineskip .5em%
      \begin{tabular}[t]{c}%
        \@author
      \end{tabular}\par}%
    \vskip 1em%
    {\large \@date}%
  \end{center}%
  \par
  \vskip 1.5em
  \global\let\@title\@empty
  \global\let\@author\@empty
  \global\let\title\relax
  \global\let\author\relax
%\relax
}
\def\pagestyle#1{\relax}
\def\thispagestyle#1{\relax}
\renewenvironment{titlepage}
    {%
      \if@twocolumn
        \@restonecoltrue\onecolumn
      \else
        \@restonecolfalse\newpage
      \fi
      \thispagestyle{empty}%
      %\setcounter{page}\@ne
    }%
    {\if@restonecol\twocolumn \else \newpage \fi
     %\if@twoside\else
        %\setcounter{page}\@ne
     %\fi
    }
% tableofcontents
\let\n@tableofcontents\tableofcontents
\def\tableofcontents{\relax}
% The begindocument, where we rebind some of the above
\let\@document@=\document
\def\document{\endgroup\relax%
\let\document\@document@%
\let\documentclass\n@documentclass%
\let\usepackage\n@usepackage%
}
% The enddocument, where some more things are rebound
\let\@enddoc@=\enddocument
\def\enddocument{%
\let\tableofcontents\n@tableofcontents%
\let\maketitle\n@maketitle
\let\title\n@title
\let\author\n@author
\let\date\n@date
\let\enddocument\@enddoc@%
\begingroup}
\fi

%% Borrowed from LaTeX general format.
\def\@ifnextchar#1#2#3{%
  \let\reserved@d=#1%
  \def\reserved@a{#2}\def\reserved@b{#3}%
  \futurelet\@let@token\@ifnch}
\def\@ifnch{%
  \ifx\@let@token\@sptoken
    \let\reserved@c\@xifnch
  \else
    \ifx\@let@token\reserved@d
      \let\reserved@c\reserved@a
    \else
      \let\reserved@c\reserved@b
    \fi
  \fi
  \reserved@c}
\def\:{\let\@sptoken= } \:  % this makes \@sptoken a space token
\def\:{\@xifnch} \expandafter\def\: {\futurelet\@let@token\@ifnch}

\makeatother
