Sed script inserting and appending in wrong place only in one particular place

view story

http://unix.stackexchange.com – I am trying to convert man pages to tex, and I keep getting \item[ in the beginning of the file and ] \hfill \\ After the part of the man pages where it shows ENV(1L). Everything else seems to be working. This is my tex.sed: /^\<[A-Z]*[A-Z]/i \ \\item[ /^\<[A-Z]*[A-Z]/a \ ] \\hfill \\\\ 1i\ \\documentstyle[11pt]{article} \ \\begin{document} 1i\ \\begin{center} {\\bf 1a\ \} \\end{center} 2i\ \\begin{description} $a\ \\end{description} $a\ \\end{document} s/\\/\\verb\+\\\+/g s/%/\\%/g s/\^/\\\^/g s/--/-\\hspace\{.01cm\}-/g s/^+/ \\\\/ s/^-/ \\\\/ Here is env.ascii: (HowTos)