在LaTeX中使用单个计数表和数字表

Mar*_*hea 7 latex

我已经获得了一个LaTeX文档,可以使用以下代码进行编辑,以便对图形和表格使用单个计数.

 \makeatletter
 \newcounter{unisequence}
 \def\ucaption{
    \ifx\@captype\@undefined
        \@latex@error{\noexpand\ucaption outside float}\@ehd
        \expandafter\@gobble
    \else
        \refstepcounter{unisequence} 
        \expandafter\@firstofone
    \fi
    {\@dblarg{\@caption\@captype}}
  }
 \def\thetable{\@arabic\c@unisequence}
 \def\thefigure{\@arabic\c@unisequence}
 \makeatother
Run Code Online (Sandbox Code Playgroud)

这适用于为表格和图形的字幕提供单个计数器但是,我发现如果我点击此代码生成的.pdf中的任何标题数字,我总是返回到文档中的第一个数字或表格比我想要的那个,例如点击表[3]将把我带到表1.

有谁知道如何解决这一问题?或者任何人都可以建议替代方案吗?

我是一名乳头新手.

谢谢

摩根先生.

Bla*_*ade 5

基于/sf/answers/270624301/和https://tex.stackexchange.com/a/127744/1340,我们可以(1)使表计数器与图形计数器相同, (2) 使表格浮点类型与图形浮点类型相同,以确保排序与编号一致,因为:

LaTeX 按顺序保留所有相同类型的浮点数

代码:

\makeatletter
\let\c@table\c@figure % for (1)
\let\ftype@table\ftype@figure % for (2)
\makeatother
Run Code Online (Sandbox Code Playgroud)

相比于/sf/answers/270624301/,这样下去\thetable和\thefigure单独,所以表和图数字格式保持原样。这方面每章/节的编号,并与超链接时,为我工作得很好subcaption,float和rotating包,甚至更多,在160页的文件。


Der*_*unk 0

在我的脑海中,这是您那里的代码片段没有生成正确引用的问题。例如,参见此处:http://en.wikibooks.org/wiki/LaTeX/Hyperlinks