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