\ProvidesPackage{lgrindsetup}[2005/08/02  Nicks preferences and helpers
for lgrind]

% Nick Urbanik <nicku@nicku.org>

% The idea is to use this, together with lgrindpp.pl and a standard
% lgrind as installed with yum install tetex-lgrind or apt-get.
% Note that lgrindpp.pl is a small Perl preprocessor for LaTeX after
% running lgrind to reduce space between the left and right shift
% operators used so much in C++, and to make other cosmetic changes.
% #! /usr/bin/perl

% use warnings;
% use strict;

% while ( <> ) {
%     s#\\<\\<#\\<\\!\\!\\<#g;
%     s#\\>\\>#\\>\\!\\!\\>#g;
%     print;
% }


\RequirePackage[nolineno,noindent]{lgrind}
\renewcommand*{\BGfont}{\sffamily}% background, including operators
\renewcommand*{\CMfont}{\rmfamily}% comments
\renewcommand*{\NOfont}{\sffamily}% font for numbers
\renewcommand*{\KWfont}{\sffamily\bfseries}% keywords
\renewcommand*{\STfont}{\ttfamily}% strings
\renewcommand*{\VRfont}{\sffamily\itshape}% variables
%\def\TTfont{\ttfamily\upshape}

% To avoid the special handling for the @ symbol by lgrind:
\providecommand*{\at}{\symbol{64}}

%DeclareMathAlphabet{\mathvf}{OT1}{cmss}{m}{sl}

% The following are shorthand for the above:
% \providecommand*{\Vf}[1]{\ensuremath{\mathvf{#1}}}% Variables
% \providecommand*{\Kf}[1]{\textsf{\textbf{\textup{#1}}}}% Keywords
% \providecommand*{\Of}[1]{\textsf{\textmd{\textup{#1}}}}% Operators
% \providecommand*{\Vf}[1]{{\VRfont #1}}% Variables
% \providecommand*{\Kf}[1]{{\KWfont #1}}% Keywords
% \providecommand*{\Of}[1]{{\BGfont #1}}% Operators
% \providecommand*{\Cf}[1]{{\CMfont #1}}% Comments
% \providecommand*{\Sf}[1]{{\STfont #1}}% Strings
% \providecommand*{\Nf}[1]{{\NOfont #1}}% Numbers
\newcommand*{\V}[1]{{\VRfont #1}}% Variables
\newcommand*{\K}[1]{{\KWfont #1}}% Keywords
% \O is already defined to produce an O with a slash
\DeclareRobustCommand*{\Of}[1]{{\BGfont #1}}% Operators
\DeclareRobustCommand*{\C}[1]{{\CMfont #1}}% Comments
% \S produces a section symbol
\newcommand*{\Sf}[1]{{\STfont #1}}% Strings
\newcommand*{\N}[1]{{\NOfont #1}}% Numbers


% From lgrind.sty, changed to suit me.
\renewcommand*{\LGfsize}{\small}% Size to use in \lgrindfile
%\renewcommand*{\LGfsize{\footnotesize}% Size to use in \lgrindfile
\renewcommand*{\LGsize}{\small}% Size to use in displayed code, i.e, lagrind.

