0

I am creating a LaTeX package. I would like to set the code in the PDF documentation of the package to purple instead of the usual black. Could some one tell me how I could set the code color?

  • 1
    What package are you using to set the code? – Werner Nov 25 '16 at 7:25
  • Thanks @Werner for your prompt response. I am developing the package code in a ".dtx" file using the package "ltxdoc". – user24098 Nov 25 '16 at 7:47
  • 2
    @user24098, ltxdoc is a class file, not a package. I think what Werner meant is which package are you using to typeset the code. Like listings, minted, or just the good ol' verbatim mode. :) – Guilherme Zanotelli Nov 25 '16 at 8:43
  • Thanks Guilherme Z. Santos. Sorry for the slip: I meant to write class ltxdoc not package ltxdoc. Yes I am using the good old verbatim mode. – user24098 Nov 25 '16 at 11:05
3

I think the simplest is this:

\usepackage{xcolor}
\usepackage{etoolbox}
\AtBeginEnvironment{macrocode}{\color{red}}

enter image description here

  • Thanks Piet van Oostrum for a simple and elegant solution. It works perfectly for me. Cheers! – user24098 Nov 25 '16 at 11:26

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.