TransWikia.com

lstinline puts space before dot

TeX - LaTeX Asked by Cube on March 28, 2021

I am trying to use lstinline to style filenames in my document, but it puts some random whitespace befor the dot. I presume it has to do with autosettings for punctuation?

Can I deactivate this with listings or is it a generall Latex Thing?

enter image description here

MWE:

documentclass[11pt]{scrreprt}
usepackage{color}
usepackage{listings}
lstset{basicstyle=color{blue}} % just to demo

begin{document}

    I use the file lstinline{file.ext}, which is nice.

end{document}

2 Answers

using a monospaced font solves the problem, which doesn't aswer the quetion for why, but works.

enter image description here

documentclass[11pt]{scrreprt}
usepackage{color}
usepackage{listings}
lstset{basicstyle=color{blue}ttfamily}

begin{document}

    I use the file lstinline{file.ext}, which is nice.

end{document}

Correct answer by Cube on March 28, 2021

using leandriis suggestion to make the dot a letter does remove the space inside the expretion, but creates wird space after. Any Ideas?

enter image description here

documentclass[11pt]{scrreprt}
usepackage{color}
usepackage{listings}
lstset{
    basicstyle=color{blue},
    alsoletter={.}
} % just to demo

begin{document}

    I use the file lstinline{file.ext}, which is nice.

end{document}

Answered by Cube on March 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP