% This is part of the Tcode kernel. Only intended to by input by it.
% This file is enclosed by \unless\ifdefined\TcodeIncluded \fi

%%%%%****  Configurable parameters for all display environments: Code, stdout, stdin  ****%%%%%

%Skip before and after the environment.
% Formerly we used 1.5\medskipamount for "before" and plus\smallskipamout for "after", but
% some formats (e.g., LaTeX) do not change \bigskip, etc. when changing font size (!).
%Some authors may use Code in footnotes.
\def\Codeskipbefore{0.75\baselineskip plus 0.25\baselineskip minus 0.25\baselineskip}
\def\Codeskipafter{\dimexpr 0.42\baselineskip-\parskip\relax plus 0.25\baselineskip}

%The position of the box: Clearance at the left and right of the displayed box, with respect to
%the width of the paragraph in which it is contained.
\newdimen\CodeLeftInd \CodeLeftInd=4pt
\newdimen\CodeRightInd \CodeRightInd=4pt
%The penalty for breaking in the middle of the environment
\newcount\NLpenalty
\NLpenalty=1000 %Fairly bad

%The width of the box = the line width minus left and right clearance
\newdimen\lineboxwd
\unless\ifdefined\setlineboxwd
\ifdefined\linewidth
  \def\setlineboxwd{
    \lineboxwd=\linewidth
    \advance\lineboxwd-\CodeLeftInd
    \advance\lineboxwd-\CodeRightInd
    \advance\CodeLeftInd\@totalleftmargin %Local change
  }
\else
  \def\setlineboxwd{
    \lineboxwd=\hsize
    \advance\lineboxwd-\CodeLeftInd
    \advance\lineboxwd-\CodeRightInd
  }
\fi
\fi

%The width (thickness) of the frame. If you want no frame, set it to 0pt.
\newdimen\CodeFramewd \CodeFramewd=0.6pt

% If a page break takes place, add some vertical stretch, to avoid underfull boxes in pages consisting only of lines of code
\newskip\CodeBreakglue
\CodeBreakglue 0pt plus 10pt

%%% Paramemters specific for Code.

%The colours for the background and the frame, and how to apply them with TeX code
\def\CsnippetFrame{black}
\def\CsnippetBkg{white}
\def\CsnippetNoColor{
  \let\ApplyFrameColor\empty
  \let\ApplyBkgColor\empty
}
\def\CsnippetColor{
  \def\ApplyFrameColor{\color{\CsnippetFrame}}
  \def\ApplyBkgColor{\color{\CsnippetBkg}}
}
\CsnippetNoColor

%The frame rules above and below, and a little clearance
\def\NLhrule{\hbox{\kern\CodeLeftInd\hbox to\lineboxwd{\ApplyFrameColor\leaders\hrule height\CodeFramewd\hfil}}}
\def\N@abbe@cle{\hbox{\kern\CodeLeftInd\hbox to\lineboxwd{\NLvrule
  \ifx\ApplyBkgColor\empty\hfil\vrule width0pt height3pt
  \else{\ApplyBkgColor\leaders\hrule height3pt\hss}\fi
\NLvrule}}}
%The frame rules at left and right
\def\NLvrule{{\ApplyFrameColor\vrule width\CodeFramewd}}

%% The vert. and horiz. clearance towards the inside, 3pt and 2pt respec., are hardcoded. %%