If I put in lstlisting it converts it into space. How to avoid that? I need to write this code in lstlisting:

  • 2
    You need to literate it. See the manual for more information. Just an untested try: \lstset{literate={∆}{{\tiny$\Delta$}}1}. – TeXnician Jul 3 '17 at 12:54
  • You're the man! – Josh Jul 3 '17 at 13:16
  • 4
    @TeXnician sounds like an answer to me – cgnieder Jul 3 '17 at 13:37

lstlisting's output routine will need to know how to parse unicode input. So you need to provide those information. The right setting for that is literate. The common syntax is literate={<input>}{{<output>}}<number of characters>.

That means to literate your input delta you need to use something like \lstset{literate={∆}{{\tiny$\Delta$}}1}. Please note that using this output version might not look very pleasing to you. Maybe you want to use a different representation than a down-scaled capital delta, but you get the idea.

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.