lstinline วางช่องว่างก่อนจุด

Oct 31 2020

ฉันพยายามใช้\lstinlineเพื่อจัดรูปแบบชื่อไฟล์ในเอกสารของฉัน แต่มันทำให้มีช่องว่างแบบสุ่มอยู่ข้างจุด ฉันคิดว่ามันเกี่ยวข้องกับการตั้งค่าอัตโนมัติสำหรับเครื่องหมายวรรคตอน?

ฉันสามารถปิดใช้งานสิ่งนี้กับรายชื่อหรือเป็น Generall Latex Thing ได้หรือไม่?

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}

คำตอบ

Cube Nov 03 2020 at 14:24

การใช้คำแนะนำ leandriis เพื่อทำให้จุดเป็นตัวอักษรจะลบช่องว่างภายใน exp expration แต่สร้างช่องว่างหลัง ความคิดใด ๆ ?

\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}
Cube Nov 03 2020 at 17:58

การใช้แบบอักษรแบบ monospaced ช่วยแก้ปัญหาได้ซึ่งไม่ได้ช่วยแก้ปัญหาด้วยเหตุผล แต่ได้ผล

\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}