乳胶生成的文本文件中计算机编程脚本上的不当空间
在这里,一个示例代码
\documentclass{article}
\usepackage{listings}
\begin{document}
\lstset{language=Python}
\lstset{frame=lines}
\lstset{caption={Insert code directly in your document}}
\lstset{label={lst:code_direct}}
\lstset{basicstyle=\footnotesize}
\begin{lstlisting}
x = np.arange(-3, 3, 0.01)
y = np.sin(np.pi*x)/(np.pi*x)
plt.plot(x, y)
\end{lstlisting}
\end{document}
为我提供了一个带有Python代码的PDF文件。
在接下来的内容中,我将生成的PDF文件的结果复制并粘贴到
x = np . a r a n g e ( −3 , 3 , 0 . 0 1 )
y = np . s i n ( np . p i ∗x ) / ( np . p i ∗x )
plt . plot (x , y)
大多数字母中,在这种情况下,添加了一个空间,这使得代码不适合进行测试或使用。
如何删除该空间?
Here a sample code
\documentclass{article}
\usepackage{listings}
\begin{document}
\lstset{language=Python}
\lstset{frame=lines}
\lstset{caption={Insert code directly in your document}}
\lstset{label={lst:code_direct}}
\lstset{basicstyle=\footnotesize}
\begin{lstlisting}
x = np.arange(-3, 3, 0.01)
y = np.sin(np.pi*x)/(np.pi*x)
plt.plot(x, y)
\end{lstlisting}
\end{document}
which provides me a pdf file with a python code inside.
In what follows I copy and paste the result from the generated pdf file
x = np . a r a n g e ( −3 , 3 , 0 . 0 1 )
y = np . s i n ( np . p i ∗x ) / ( np . p i ∗x )
plt . plot (x , y)
For most of the letters, in this case EACH of the latters, a space is added, which makes the code not suitable to be tested or used.
How can I remove that space?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论