% pretzel-noweb.sty  -- interfacing Pretzel and noweb in LateX
% (c) 1997 by Felix Gaertner. Look at pretzel-noweb-style.nw if
% you want to make changes.
%
%\input noweb.sty
\def\@begincode{%
        \trivlist \item[]%
        \leftskip\@totalleftmargin \advance\leftskip\codemargin
        \rightskip\hsize \advance\rightskip -\codehsize
        \parskip\z@ \parindent\z@ \parfillskip\@flushglue
        \linewidth\codehsize
        \nowebsize
        \let\maybehbox\mbox
%       \let\eatline=\relax
}
\def\pretzelnwcodeimitation{
  \@@par
  \def\par{\leavevmode\null \@@par \penalty\nwcodepenalty}%
  \obeylines
  \@noligs   \ifx\verbatim@nolig@list\undefined\else
               \let\do=\nw@makeother \verbatim@nolig@list \do@noligs\`
             \fi
  \setupcode \frenchspacing \@vobeyspaces
}
\newcount\ind
\newenvironment{ppcode}{%
        \sfcode`;=3000                % a `;' acts like a period
        \pretolerance=10000 %
        \hyphenpenalty=10000 %
        \exhyphenpenalty=10000 %
        \global\ind=2 % This fakeout is important for opt to work correctly
        \par
        \global\hangindent\ind em
}{%
%        \mathout
}
\newbox\bak\setbox\bak=\hbox to -1em{} % backspace 1 em
\newbox\bakk\setbox\bakk=\hbox to -2em{} % backspace 2 ems

\def\pretzelindent{\global\advance\ind by1\hangindent\ind em}%
\def\pretzeloutdent{\global\advance\ind by-1}%
\def\pretzelopt#1{\hfil\penalty#10\hfilneg}%
\def\pretzelbackup{\copy\bak}%
\def\pretzelbreakspace{\hfil\penalty-1\hfilneg
        \kern2.5em\copy\bakk\ignorespaces}%
% parm below is to eat {} generated by Pretzel
\def\pretzelforce#1{\mathout\par\hangindent\ind em\noindent
        \kern\ind em\copy\bakk#1\ignorespaces}%
\def\pretzelbigforce{\mathout\par\smallskip\pretzelforce}%
\def\pretzelnoindent{\hskip-\ind em\hskip 2em}%
\catcode`\^^K=12    % 12=other, for \verb* with strings
\def\pretzelid#1{\begingroup\catcode`\_=12%
  #1\endgroup}
\def\mathin{\ifmmode\else\begin{math}\fi{}}
\def\mathout{\ifmmode\end{math}\fi{}}
