![\usepackage{listings} 与 sffamily 成比例](https://linux22.com/image/416909/%5Cusepackage%7Blistings%7D%20%E4%B8%8E%20sffamily%20%E6%88%90%E6%AF%94%E4%BE%8B.png)
我使用\usepackage{listings}
在文本中显示代码。使用basicstyle=\sffamily
,文本显示为无衬线字体,但我希望它也按比例显示。有人知道是否可以有无衬线比例字体吗?
答案1
\documentclass{article}
\usepackage{listings}
\begin{document}
\begin{lstlisting}[basicstyle=\sffamily]
I'm using \usepackage{listings} to display code in a text. With basicstyle=\sffamily, the text is
displayed sans serif, but I want to have it proportianal too. Is any one know if it possible to
have sans serif proportional font?
\end{lstlisting}
\begin{lstlisting}[basicstyle=\sffamily,columns=fullflexible]
I'm using \usepackage{listings} to display code in a text. With basicstyle=\sffamily, the text is
displayed sans serif, but I want to have it proportianal too. Is any one know if it possible to
have sans serif proportional font?
\end{lstlisting}
\end{document}