This might be a long shot, but I'm planning to include a roughly 300-line block of python code as an appendix to my undergraduate thesis, and I was wondering if there's a way to make it display with colored highlighting the way it would in Emacs or another text editor. I just find that I personally can't read code well when it's not colored, so I don't want to inflict that upon the reader. I know about the fancyvrb package, but I don't want to go through character by character and declare colors for everything, and as far as I can tell that would be the only way to use it to get the desired effect.

closed as unclear what you're asking by siracusa, Phelype Oleinik, Troy, Stefan Pinnow, Andrew Swann Oct 20 '18 at 9:52

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 5
    listings or minted package, perhaps minted is most natural in this case as it uses the pygmentize python library to apply the syntax highlighting, – David Carlisle Mar 2 '18 at 0:06
  • 1
    «I'm planning to include a roughly 300-line block of python code» Just don't. Nobody wants to read printed out code. – Henri Menke Mar 2 '18 at 0:41
  • 1
    @HenriMenke I actually agree with you, but the program is about half of the original work that I've done for my thesis, so my advisor says I should include it as an appendix. – Jules Randolph Mar 4 '18 at 17:12
  • Possible duplicate of Syntax Coloring in LaTeX – Andrew Swann Oct 20 '18 at 9:52