:

# MKTEX -- a Unix shell script

# Usage:  mktex filename

# Creates a file called "filename.tex", suitable for inclusion in
# a plain TeX document (similar to LaTeX's "verbatim" mode).

# Here "filename" is any plain-text file, e.g. C source code.

# The inclusion of "filename.tex" in a TeX document results in the
# display of the contents of "filename", in a "verbatim" format which
# preserves the spacing, line breaks, etc., of the original text.


echo '' > $TMPDIR/$1.top.$$
echo '{' >> $TMPDIR/$1.top.$$
echo '\bigskip' >> $TMPDIR/$1.top.$$
echo '\frenchspacing' >> $TMPDIR/$1.top.$$
echo '\obeylines' >> $TMPDIR/$1.top.$$
echo '\obeyspaces' >> $TMPDIR/$1.top.$$
echo '\tt' >> $TMPDIR/$1.top.$$
echo '\baselineskip=12pt' >> $TMPDIR/$1.top.$$
echo '\parindent=0pt' >> $TMPDIR/$1.top.$$
echo '\advance\hsize by 1cm' >> $TMPDIR/$1.top.$$
echo '' >> $TMPDIR/$1.top.$$

sed -e 's/\\/TTEEMMPP/g' \
	-e 's/\$/\\\$/g' \
	-e 's/TTEEMMPP/$\\backslash$/g' \
	-e 's/\%/\\\%/g' \
	-e 's/\#/\\\#/g' \
	-e 's/\&/\\\&/g' \
	-e 's/\^/\\\^/g' \
	-e 's/{/$\\{$/g' \
	-e 's/}/$\\}$/g' \
	-e 's/_/\\underbar{ }/g' \
	-e 's/	/        /g' \
	-e 's/^ *$/\\line{ }/g' \
	-e 's/^/$ $/g' \
< $1 > $TMPDIR/$1.main.$$

cat $TMPDIR/$1.top.$$ $TMPDIR/$1.main.$$ > $1.tex
rm $TMPDIR/$1.top.$$ $TMPDIR/$1.main.$$

echo '' >> $1.tex
echo '}' >> $1.tex
echo '' >> $1.tex

