hyperref 指向错误表并重置计数器

hyperref 指向错误表并重置计数器

我对附录部分列出的表格的超链接和引用存在问题。似乎有些表格在列出正确的表格编号时存在混淆。

例如,使用 \ref 作为表 (A.4) 后,文本中引用的表 (A8) 被改为表 (A8),尽管它会导航到附录中的正确表,即 A8。此问题只发生在一些表中,而不是全部。我尝试解决这个问题,但没有任何效果。有人能告诉我如何解决这个问题吗?提前谢谢!

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{adjustbox}
\usepackage{etoolbox}
\usepackage[utf8]{inputenc}
\usepackage{multirow}
\usepackage{placeins}
\usepackage{float}   
\usepackage{amsmath }
\usepackage{graphicx}
\graphicspath{ {images/} }
%%%\usepackage{lscape} % don't load both lscape and pdflscape
\usepackage{pdflscape}
\usepackage{fancyhdr} 
\usepackage[paper=portrait,pagesize]{typearea}
\usepackage{natbib}
\bibliographystyle{agsm}
\usepackage{longtable}
\newcommand{\etal}{\textit{et al.}}
\usepackage{amssymb}
\usepackage{array}
\setlength\extrarowheight{2pt}
\usepackage{booktabs}% http://ctan.org/pkg/booktabs
\usepackage{vcell}
\usepackage{url}
\usepackage{rotating}
\usepackage{calc}% http://ctan.org/pkg/calc
\usepackage[normalem]{ulem}
\usepackage[flushleft]{threeparttable}
\usepackage{booktabs}
%%\usepackage{amsfonts}  % 'amsfonts' is loaded automatically by 'amssymb'
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\usepackage[misc]{ifsym}
\usepackage{etoolbox}
\providecommand{\keywords}[1]{\textbf{\textit{Keywords}} #1}

\makeatletter

% Patch case where name and year are separated by aysep
\patchcmd{\NAT@citex}
  {\@citea\NAT@hyper@{%
     \NAT@nmfmt{\NAT@nm}%
     \hyper@natlinkbreak{\NAT@aysep\NAT@spacechar}{\@citeb\@extra@b@citeb}%
     \NAT@date}}
  {\@citea\NAT@nmfmt{\NAT@nm}%
   \NAT@aysep\NAT@spacechar\NAT@hyper@{\NAT@date}}{}{}

% Patch case where name and year are separated by opening bracket
\patchcmd{\NAT@citex}
  {\@citea\NAT@hyper@{%
     \NAT@nmfmt{\NAT@nm}%
     \hyper@natlinkbreak{\NAT@spacechar\NAT@@open\if*#1*\else#1\NAT@spacechar\fi}%
       {\@citeb\@extra@b@citeb}%
     \NAT@date}}
  {\@citea\NAT@nmfmt{\NAT@nm}%
   \NAT@spacechar\NAT@@open\if*#1*\else#1\NAT@spacechar\fi\NAT@hyper@{\NAT@date}}
  {}{}

\makeatother
\usepackage{hyperref} % it's a good idea to load this package _last_
\hypersetup{
    pdftoolbar=true,        % show Acrobat’s toolbar?
    pdfmenubar=true,        % show Acrobat’s menu?
    pdffitwindow=false,     % window fit to page when opened
    pdfstartview={FitH},    % fits the width of the page to the window
    pdftitle={title},    % title
    pdfauthor={Salvatore Mazzarino},     % author
    pdfsubject={Subject},   % subject of the document
    pdfcreator={Salvatore Mazzarino},   % creator of the document
    pdfproducer={Salvatore Mazzarino}, % producer of the document
    pdfkeywords={Green Networking} {Mobile Cloud} {Network Coding} {Energy}, % list of keywords
    pdfnewwindow=true,      % links in new window
    colorlinks=true,       % false: boxed links; true: colored links
    linkcolor=blue,          % color of internal links (change box color with linkbordercolor)
    citecolor=blue,        % color of links to bibliography
    filecolor=magenta,      % czolor of file links
    urlcolor=blue           % color of external links
}
\DeclareUnicodeCharacter{2206}{\(\Delta\)}
\begin{document}

\newpage

\bibliographystyle{plain}
\bibliography{references.bib}

\appendix
\section{Appendix}\label{appendix}

\setcounter{table}{0}
\renewcommand\thefigure{\thesection\arabic{figure}}    
\renewcommand{\thetable}{A\arabic{table}}

相关内容