I'm using listings to display code in my document and tgheros font. How can I decrease the monotype letter spacing for code listings?

% in my preamble

% lstset definition
    % [...]

% code
Python code below.

def function(variable):
    pass # monospace font spacing is too large

In the screenshot you can see that the letter spacing is quite high. How to decrease it while keeping a monospace font?



Use the basewidth setting in your lstset definition:

    basewidth=0.6em % default value

For example, basewidth=0.6em (default):

enter image description here


enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.