0

I wish colour some selected text within the verbatim environment. These texts may not occupy a whole line, but rather be a small part of a line.

An illustration is given below. Say for example, in the first line of this code, from and import are to be written in purple colour, while the rest of the line is in usual black colour. I am using fancyvrb package, but cannot figure out how to do this. Can someone help?

enter image description here

  • Why do you want import and from coloured differently from the other keywords? – Henri Menke May 9 '16 at 18:26
  • Have you tried using listings or minted to do this? They have a lot of options for syntax highlighting code. – Arun Debray May 9 '16 at 18:44
  • @Henri, It want them coloured differently because its a part of a code, and I want it to look similar in my text document as in the code itself. – kanayamalakar May 9 '16 at 23:21
  • Thanks @ArunDebray, I have not tried them. Can you enlighten me a bit more on those? – kanayamalakar May 9 '16 at 23:24

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.