I am trying to add a GBP \pounds symbol inside lstlisting
\begin{lstlisting}
Lorem ipsum 3£ \pounds
\end{lstlisting}
However this results in the following line:
Lorem ipsum 3Â \pounds
How do I draw correct GBP 开发者_开发知识库symbol inside lstlisting?
Thank you very much!
This should work even if it is a bit hackish:
\begin{lstlisting}[mathescape=true]
Lorem ipsum 3$\mbox{\pounds}$ \pounds
\end{lstlisting}
Move the question to tex.stackexchange.com and you'll have better answers wrt character encodings.
This even works inside verbatim and using xelatex compiler:
\usepackage{newunicodechar}
\newunicodechar{£}{\textsterling}
\begin{lstlisting}
Lorem ipsum 3£
\end{lstlisting}
\begin{verbatim}
Lorem ipsum 3£
\end{verbatim}
精彩评论