2010-10-05 17 views
8

我得到了一个LaTeX文档,使用下面的代码编辑图形和表格。在LaTeX中使用单一计数的图形和表格

\makeatletter 
\newcounter{unisequence} 
\def\ucaption{ 
    \ifx\@captype\@undefined 
     \@[email protected]{\noexpand\ucaption outside float}\@ehd 
     \expandafter\@gobble 
    \else 
     \refstepcounter{unisequence} 
     \expandafter\@firstofone 
    \fi 
    {\@dblarg{\@caption\@captype}} 
    } 
\def\thetable{\@arabic\[email protected]} 
\def\thefigure{\@arabic\[email protected]} 
\makeatother 

这种运作良好,给一个计数器表格和数字,但字幕的,我发现,如果我在这个代码生成.PDF点击任何标题数字,我总是回到第一图表或文件中的表格而不是我想要的,例如点击表格[3]将带我到表1。

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

我是LaTeX的新手。

谢谢

摩根先生。

回答

4

如果它使用的任何人,使用方法:

\makeatletter 
\renewcommand*{\thetable}{\arabic{table}} 
\renewcommand*{\thefigure}{\arabic{figure}} 
\let\[email protected]\[email protected] 
\makeatother 

在文档的序言。

+0

该解决方案忽略[每章/章节编号](http://tex.stackexchange.com/questions/28333/continuous-v-per-chapter-section-numbering-of-figures-tables-and-other -docume)。 – 2016-10-04 22:32:36

+0

为什么不只是'\ makeatletter \ let \ c @ table \ c @图 \ makeatother'?它似乎完全适合我,并且不会破坏我在这份160页的论文草案中设置的其他内容:每章编号,带subcaption包的子图,超链接... – Blaisorblade 2017-04-06 16:01:02

+0

编辑:也是'\让\ ftype @ table \ ftype @ figure'来自http://stackoverflow.com/questions/3865036/using-a-single-count-for-figures-and-tables-in-latex/7771554?noredirect=1#comment73589319_7771554使事情变得更好。 – Blaisorblade 2017-04-06 21:21:50

0

将查询中的代码与以前的答案结合起来对我来说非常有用 - 谢谢。

要获得有关章节号太章节内连续编号的数字和表格,我取代了答案片段两行

\renewcommand*{\thetable}{\arabic{chapter}.\arabic{table}} 
\renewcommand*{\thefigure}{\arabic{chapter}.\arabic{figure}} 
+0

你想参考http://stackoverflow.com/a/3866061/53974我猜?我认为完全删除这些行应该只是工作... – Blaisorblade 2017-04-06 15:59:12

+1

@Blaisorblade这是很久以前,可能http://tex.stackexchange.com/questions/127742/place-floating-tables-and-figures-in-订单的-外观 – 2017-04-06 16:04:12

0

基于https://stackoverflow.com/a/3866061/53974https://tex.stackexchange.com/a/127744/1340,我们只要(1)使表(2)使表的浮动类型与数字浮动类型相同,以确保订单与编号一致,因为:

LaTeX保留所有漂浮物orde中的同一类型[R

代码:

\makeatletter 
\let\[email protected]\[email protected] % for (1) 
\let\[email protected]\[email protected] % for (2) 
\makeatother 

相比https://stackoverflow.com/a/3866061/53974,这样下去\thetable\thefigure孤单,所以表和图数字格式保持原样。这遵循每章/章节编号,它适用于我和超链接,subcaption,floatrotating程序包,以及可能更多的160页文档。