使用乳胶中的列表包进行行编号
我正在尝试使用列表包插入代码片段,并希望对行进行编号。 不过,我只想根据手册对每 5 行和第一行进行编号(数字 beeing(1,5,10,15,...)):
stepnumber=5
应该可以解决问题,但是使用我的最小示例(见底部) ,我得到行号 1,6,11,16,...
可能是我误解了他的手册 8 之前曾经这样做过),但是我一无所知。
如果有真正的乳胶大师,我会更想要一些东西,将每个行号打印出来,但每隔五个以粗体/与being不同的样式数字:1 2 3 4 5 6 7 8 9 10 11 ...但是,由于这不在 doku 中,我确信它需要一些更深入的乳胶/列表知识。
PS:还有一个奇怪的地方,即使我输入“numberfirstline = false”我得到了行号1(我也得到了该行号而不设置numberfirstline,它应该默认为false),它是jsu在那里指出了一些东西是错误的。
我正在使用 miktex 进行编译,如果有帮助的话。
提前致谢。
\documentclass{scrreprt} %[twoside,headings=openright]
%Sourcecode formatting
\usepackage{listings}
\lstset{
numbers=left, % Ort der Zeilennummern
stepnumber=5, % Abstand zwischen den Zeilennummern
numberfirstline=false
}
\begin{document}
\lstinputlisting{sourcecode/AES/lookupSoftcoded.S} %codefile with 15 lines or so...
\end{document}
I am trying to insert a code snippet with the listingspackage, and want the lines numbered.
However I would like only every 5th line and the first to be numbered (numbers beeing(1,5,10,15,...)) according to the manual:
stepnumber=5
should do the trick, however using my minimal example (see bottom), I get the line numbers 1,6,11,16,...
May be I misinterpreted he manual 8did that once before), however I am clueless.
If a real latex guru is around, there would be something I would like even more, having every linenumber printed however every fifth in bold/ a different style numbers than beeing: 1 2 3 4 5 6 7 8 9 10 11 ... however since this is not in the doku I am sure it requires some deeper latex/listings knowledge.
P.S.: There is one more oddity, eventhough I put "numberfirstline=false" I get the line number 1 ( I get that linenumber as well without setting numberfirstline, which should default to false), it is jsu in there to point out that something is wrong.
I am using miktex for compilation, if that helps.
Thanks in advance.
\documentclass{scrreprt} %[twoside,headings=openright]
%Sourcecode formatting
\usepackage{listings}
\lstset{
numbers=left, % Ort der Zeilennummern
stepnumber=5, % Abstand zwischen den Zeilennummern
numberfirstline=false
}
\begin{document}
\lstinputlisting{sourcecode/AES/lookupSoftcoded.S} %codefile with 15 lines or so...
\end{document}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以像这样获得所需的编号:
You can get the desired numbering like this: