1

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?

1
  • Welcome to TeX.SE! As fa as I know, sans serif fonts are proporcional fonts. What is the problem then?
    – Zarko
    Commented Jul 1, 2020 at 10:00

1 Answer 1

3
\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}
3
  • 1
    Good answer (+1), note that besides fullflexible there is also flexible and spaceflexible that are still proportional but a bit less condensed.
    – Marijn
    Commented Jul 1, 2020 at 10:44
  • My best wishes for your 10k of reputation: just it was 9999. I am very happy for to have give you my upvoted.
    – Sebastiano
    Commented Jul 1, 2020 at 12:09
  • good answer indeed. Thanks, it helps me a lot
    – AreTaro
    Commented Jul 2, 2020 at 14:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .