I am fairly sure you want to typeset your examples with a fixed-width font, in which case, you should probably use verbatim environment. Even better, you could use fancyvrb package, which gives you a Verbatim environment, and allows you control over captioning, coloring, font size/shapes, etc. You can even make blanks more visible by showing them:
I would simply use the listings package and do the indention with spaces or tabs. I suppose that you are using the typewriter font anyway to get letters with a non-relative width.
发布评论
评论(4)
只需使用
\hspace*{5mm}
(即星号形式),它在行的开头就可以正常工作。Just use
\hspace*{5mm}
(i.e. the starred form) which works fine at the beginning of a line.我相当确定您想使用固定宽度字体排版示例,在这种情况下,您可能应该使用逐字环境。更好的是,您可以使用 fancyvrb 包,它可以为您提供
Verbatim
环境,并允许您控制标题、颜色、字体大小/形状等。您甚至可以通过显示空白来使它们更加明显:I am fairly sure you want to typeset your examples with a fixed-width font, in which case, you should probably use
verbatim
environment. Even better, you could use fancyvrb package, which gives you aVerbatim
environment, and allows you control over captioning, coloring, font size/shapes, etc. You can even make blanks more visible by showing them:为此,我总是在行的开头添加一个“空”对象,例如,
它并不美观,但可以达到目的。
For this, I always add an "empty" object to the beginning of the line, e.g.
it's not beautiful, but serves the purpose.
我只需使用 列表包 和用空格或制表符进行缩进。
我想您无论如何都在使用打字机字体来获取具有非相对宽度的字母。
I would simply use the listings package and do the indention with spaces or tabs.
I suppose that you are using the typewriter font anyway to get letters with a non-relative width.