开发者

Currency symbols inside lstlisting

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}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜