如何使用 LaTeX minted 减少与其他文本的分离?
我想使用 minted 包来突出显示语法,但它的间距超过一厘米。
设置:
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt}
\setlength{\headsep}{0pt}
\setlength{\topskip}{0pt}
\setlength{\topmargin}{0pt}
\setlength{\topsep}{0pt}
\setlength{\partopsep}{0pt}
根本没有帮助。有什么办法可以减少文本其余部分的间距吗?
I want to use the minted package to give me syntax highlighting but it has a spacing of more than a centimeter.
Setting:
\setlength{\parskip}{0pt}
\setlength{\parsep}{0pt}
\setlength{\headsep}{0pt}
\setlength{\topskip}{0pt}
\setlength{\topmargin}{0pt}
\setlength{\topsep}{0pt}
\setlength{\partopsep}{0pt}
does not help at all. Is there any way to reduce the spacing from the rest of the text?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
minted 在内部使用 fancyvrb 包中的
Verbatim
环境。在实现文档中,给出了以下空格公式:和
因此,将
\partopsep
设置为其他值即可达到目的;我已经尝试过了,您需要一个负值来删除边距:这会删除文本正文和代码之间的大部分空间。要获得 0.5 厘米的距离,请添加其距离:
可以在 https://tex.stackexchange.com/ 中找到实现a/19423
minted internally uses the
Verbatim
environment from the fancyvrb package. In the documentation of the implementation, the following formula for the spaces is given:And
Hence, setting
\partopsep
to some other value does the trick; I’ve tried it, and you need a negative value to remove the margin:This removes most of the space between the text body and the code. To get a distance of 0.5cm, add its distance to that:
An implementation can be found in https://tex.stackexchange.com/a/19423
如果你想改变行距,你可以使用:
并稍微修改一下大括号中的数字。
您作为示例给出的命令是指页面环境。
请参阅此 Wiki 了解更多说明和示例。
If you want to change the line spacing you can use:
And play a little bit around with the number in the curly brackets.
The commands you have given as an example refer to the page environment.
See this Wiki for additional explanations and examples.