# LaTeX

Ok, here's the best I can do for getting what I want:
\code
oldline();
@    newline1();
@    if (something)
@       newline3();
    oldline();
@    newline4();
oldline();
\end{c2}\clabel{Testing}
\TheSbox
\end{c3}
`
which produces this, which is a compromise in two different directions output-wise (I want the label to be at the left, and I would rather the old lines be normal colored and the new lines to be normal colored with a darker background), and is obviously a pain to type--at which point a preprocessor seems the best solution to avoid having to type all the crud.

The problem is that I'm getting the nicely-labeled frame from fancyvrb, which does its parsing in such a way that I have to have an explicit end--that's \end{c3}. \code starts two nested environments; one, c1, is an Sbox, which captures its contents for later, and the interior one, c2, is a listings environment which lets me use "delimiter" characters to get my formatting effects. listings is verbatim-ish and needs to see an explicit end--that's \end{c2}. I can't embed the \clabel{Testing} inside the environment end of c2, and I don't know why; it starts by ending c1, and apparently that can't be done from inside the end-of-the-c2 environment, I guess it's "too soon"--the trailing code of the c2 environment is run before the environment "ends", instead of after. So \clabel closes c1, then starts c3, the fancyvrb verbatim environment, which I've set to allow escapes. Then it embeds \TheSbox, which is what was captured before, and ends it. Because it's verbatim, I don't know any way to embed \TheSbox\end{c3} into a command. Of course, since I'm not using the verbatim part of fancyvrb, just its frame, obviously this could be done more easily if you knew how, but I don't.
• Post a new comment

#### Error

default userpic