1

After inserting a Python file into my latex file via \lstinputlisting[language=Python]{Thesis.py}, I get

enter image description here

Normally, it should be ~, but it is at higher than it should be. When I copy it from the output PDF , I no longer get ~.

Could you please elaborate on this issue and how to get the normal ~?

Akira
  • 1,215
  • Does https://tex.stackexchange.com/questions/17266/how-to-insert-a-nice-tilde-in-a-lstlisting help? – Torbjørn T. Jun 06 '20 at 21:10
  • @TorbjørnT. Because I imported via \lstinputlisting[language=Python]{Thesis.py}, the command in your linked answer does work. I mean I insert Python code and not directly type it in my LaTex document. – Akira Jun 06 '20 at 21:12
  • 1
    I don't think it matters that you're inputting a file. (And also, if you thought that mattered, it would have been nice if your question included a minimal example in the first place, which would have definitely avoided any misunderstandings about what you're doing.) That said, I linked to a question, which answer doesn't work? The accepted answer worked for me with \lstinputlisting. So does the one with beramono and fontenc, but note that it needs basicstyle=\ttfamily. – Torbjørn T. Jun 06 '20 at 21:20
  • I'm really sorry for my rush reaction @TorbjørnT. The one with beramono and fontenc does solve my problem. – Akira Jun 06 '20 at 21:28

0 Answers0