2 % I have enclosed code.sty, which achieves 99% of what you want without
\r
3 % the need for a separate preprocessor. At the start of your document
\r
4 % you write "\makeatactive". From then on, inline code is written as @\x
\r
5 % -> x_1 & y@. The only difference with what you are used to, is that
\r
20 % and that you cannot use @ in \section{} and \caption{}. For the paper that occured twice, in which case I had to replace @...@ b y \texttt{...}.
\r
23 % code.sty --- nice verbatim mode for code
\r
26 \relax\ifmmode\hbox\else\leavevmode\null\fi
\r
32 \let\do\@makeother \dospecials
\r
39 \lowercase{\let~\icode@egroup}}
\r
44 % The \makeatactive command:
\r
45 % makes @ active, in such a way that @...@ behaves as \icode@...@:
\r
49 \catcode`@=\active \def@{\icode@}
\r
50 % Since @ becomes active, it has to be taken care of in verbatim-modes:
\r
51 \let\olddospecials\dospecials \def\dospecials{\do\@\olddospecials}}
\r
53 % \gdef\makeatother{\g@remfrom@specials{\@}\@makeother\@}
\r
54 \gdef\makeatother{\@makeother\@}
\r
56 \newcommand\codetabwidth{42pt}
\r
57 {\catcode`\^^I=\active%
\r
58 \gdef\@vobeytab{\catcode`\^^I\active\let^^I\@xobeytab}}
\r
59 \def\@xobeytab{\leavevmode\penalty10000\hskip\codetabwidth}
\r
61 \begingroup \catcode `|=0 \catcode `[= 1
\r
62 \catcode`]=2 \catcode `\{=12 \catcode `\}=12
\r
63 \catcode`\\=12 |gdef|@xcode#1\end{code}[#1|end[code]]
\r
65 \def\@code{\trivlist \item\relax
\r
66 \if@minipage\else\vskip\parskip\fi
\r
67 \leftskip\@totalleftmargin\rightskip\z@skip
\r
68 \parindent\z@\parfillskip\@flushglue\parskip\z@skip
\r
73 \leavevmode \null \@@par\penalty\interlinepenalty
\r
76 \ifhmode\@@par\penalty\interlinepenalty\fi
\r
78 \obeylines \verbatim@font \@noligs
\r
79 \let\do\@makeother \dospecials
\r
80 \everypar \expandafter{\the\everypar \unpenalty}%
\r
82 \def\code{\@code \frenchspacing\@vobeytab\@vobeyspaces \@xcode}
\r
83 \def\endcode{\if@newlist \leavevmode\fi\endtrivlist}
\r