Inclusion of program listing

berntl's picture

What is the best way to include program listing, where I get decent typesetting?

I have used verbatim so far, but the result is not very nice -- e.g. tabs become \qquad or something.

I seem to recall that George suggested the latex package "listings" a while ago. But I don't recall the description of how to activate/use it. Is this documented somewhere? And will it also work for SWP 6?

Also, I'm using a modeling language named Modelica, and I don't think "listings" has support for that one. Is there a way I can add definitions of a new language (such as Modelica)?

-B

Dr. Robert Stanton's picture

I have also had the \qquad

I have also had the \qquad replace tabs; this is true even in Version 5.5. An alternative is to use typewriter mode. This seems to take more horizontal space than verbatim.

If you wish to use verbatim, you can select the program, and do a Find and Replace. Put \qquad in the Search for box, and the desired horizontal space in the Replace with box.

berntl's picture

Thanks, Robert -- that's what

Thanks, Robert -- that's what I do. But it never looks "right"...