I have an already formatted text (space-wise) that is also being colored etc, so I am using alltt environment to print it. The text is code actually, but I am not using listings because I don't want it to color my code (I am doing the coloring based on which line is important so it's different).
Problem is now, I can't figure a way to tell alltt to wrap the text. It would eventually look ugly if the text is wrapped, but it is even more ugly if they go out of the right border of the page!!
So, is there a way to wrap text with alltt? If no, is it possible to get text that has styles (such as \textit{...} etc) with the listings package?
Edit: Here is an example:
Preamble (some styling):
\newcommand{\somewhatImportantCode}[1]{\textcolor[rgb]{0.0,0.35,0.6}{#1}}
\newcommand{\veryImportantCode}[1]{\textcolor[rgb]{0.0,0.5,0.9}{#1}}
Code:
\begin{alltt}
\somewhatImportantCode{\#include <iostream>}
int main()
\{
\veryImportantCode{std::cout <<} "Hello World!" \veryImportantCode{<< std::endl};
return 0;
\}
\end{alltt}
And here is how it looks like:

Note that that goal is to direct the user to parts of the code that are more significant and that's why its styling is different. As you can see, the \somewhatImportantCode and \veryImportantCode could cover any short or long part of the code.


listingsmarks the code so that nothing it coloured. Maybe you should post a smalllistingsexample document with what kind of line-based colouring you are using and ask the listings question directly. – Alan Munn Dec 1 '11 at 14:01listingson the internet and if there is no way to wrap text inalltt, I don't think I would have a problem figuring out how to make it work withlistings. So, let's first see if wrapping text is possible withalltt. If not, then I'll try to figurelistingsmyself – Shahbaz Dec 1 '11 at 14:05listings– Shahbaz Dec 1 '11 at 14:06