3

I had the (somewhat) specialized problem of incorporating source code listings into blocks tagged with \begin{outline} etc. I found that \verbatim wasn't working for me and so I ended up stuck with the awkwardness of making each source line a \texttt{} block. I admit that this is horrifically inelegant, and indenting blocks of code this way (in an outline format that does some automatic indentation for me!) is sheer hell. Yes, I should have come here first and asked...

Anyway, I got it all rendered OK, but found I wanted an i-- (decrement op) in the middle of a simple \texttt{} expression in some C source code, and the second '-' would not render. I stuck a {} between the two '-' characters and presto!, it did!

There must be an easier way with than the barebones \usepackage{outline} and \texttt{} approach, because I ended up putting a lot of source code in my outline. It works (barely!) but I'm interested in discovering an easier approach for next time, including an explanation of how the outline environment is not all that special wrt these changes. I'll say this: I've gotten pretty good at balancing my braces! ;-D

  • 2
    Have you looked at the listings and minted packages? Both are great for including source code, with syntax highlighting. – Andrew Feb 17 '17 at 5:50
  • Can you provide a minimum working example of how outline works, so that we don't have to learn a new package syntax? – Steven B. Segletes Feb 17 '17 at 11:13
  • Oops. Sorry about that, Steven: there's a \usepackage{outline} in the preamble and then \begin{outline} to start each division and \item for paragraphs under each division. With each \end{outline} you step up a level, like from (A, B, C) back up to (I, II, III). My understanding is that this only goes 4 levels deep in this simple package. To respond to @Andrew, thanks for making me aware of listings and minted. – daniel julian Feb 18 '17 at 8:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.