自动“输入” LaTeX 表中的列
我想知道是否可以使用 LaTeX 创建一个具有多行和多列的表,并在每个表中都有一个自动“条目”列?这意味着我希望每个表的第一列都写着“entry”,并将该列的行从 1 到 n 编号。 (我希望这能解释我想要实现的目标)。
我需要引用列中的单个条目,并且如果我稍后更改行的顺序,自动完成编号会更容易。
有没有什么办法可以做到这一点,或者有一个包可以做到这一点?
我对整个 LaTeX 很陌生,所以请简单介绍一下技术术语:)
I was wondering if it is possible with LaTeX to create a table with multiple rows and columns and have an automatic "entry" column in every table? This means I would like the first column of every table saying "entry" and numbering the rows of the column from 1 to n. (I hope that kind of explains what I want to achieve).
I will need to refer to single entries in a column and it would be easier to have that numbering done automatically in case I change the order of the rows later on.
Is there any way to do that or a package to make that work?
I am new to the whole LaTeX thing so please be easy on the technical terms :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
查看这篇 TeXBlog 帖子。
您想要使用
\newcounter
创建一个计数器,使用\setcounter
将其设置为零,然后在每行的开头,递增计数器并打印出其值。我链接到的示例利用了tabular
环境的一个漂亮功能,在指定列的格式时,您还可以指定要在该列中的每个单元格之前包含的一段代码。这使您不必重复代码,如 这个例子。Check out this TeXBlog post.
You want to create a counter using
\newcounter
, set it to zero using\setcounter
, then at the beginning of each row, increment the counter and print out its value. The example I linked to makes use of a nifty feature of thetabular
environment where, in specifying the format for a column, you can also specify a piece of code to be included before each cell in that column. This saves you from having to duplicate the code, as is done in this example.