\usepackage{listings} 与 sffamily 成比例

\usepackage{listings} 与 sffamily 成比例

我使用\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}

相关内容