1

I am struggling with my table references in combination with endfloat and longtable. Somehow, they are not referring to the right table.

I get the following problem reported (I think that this is the problem):

destination with the same identifier (name{table.2}) has been already used, duplicate ignored \relax l.127 \end{longtable} \end{spacing}\end{landscape}

I have seen people reporting the same error but never in combination with the packages I am using.

This is the code I am running:

\documentclass[12pt, a4paper, notitlepage]{article}
\usepackage{ragged2e,array,longtable, afterpage}
\usepackage{lscape,booktabs}
\usepackage{pdflscape}
\usepackage{fullpage}
\usepackage[colorlinks=true,citecolor=blue,linkcolor=blue,urlcolor=green, filecolor=green, plainpages=false]{hyperref}  
\usepackage[doublespacing]{setspace} % double spacing
\usepackage[nolists,tablesfirst]{endfloat} % place figures at the end 

\newenvironment{ltable}
  {\footnotesize\begin{landscape}\begin{spacing}{1}\begin{longtable}}
  {\end{longtable}\end{spacing}\end{landscape}}
\DeclareDelayedFloatFlavor*{ltable}{table}


\begin{document}

\begin{titlepage}
THIS IS THE TITLE PAGE

\end{titlepage}
\makeatother
\newpage 
\hypersetup{pageanchor=true} % removes "destination with the same identifier (name{page.1})"


%\listoftodos

\section{Introduction}

\begin{table}[h!tb]\centering \caption{Table 1}\label{Tab: 1}
    \footnotesize
    \begin{spacing}{1}
        \begin{tabular}{l r r r}\toprule
            Variable  & Mean & S.D. & N \\
        \end{tabular}
    \end{spacing}
\end{table}


\begin{ltable}[l]
    {
        >{\RaggedRight\arraybackslash}p{3.3cm} >{\RaggedRight\arraybackslash}p{3.3cm} >{\RaggedRight\arraybackslash}p{3.3cm} >{\RaggedRight}p{3.3cm} >{\RaggedRight}p{3.3cm} >{\RaggedRight}p{3.3cm}  >{\RaggedRight}p{3.3cm}}
    \caption{Table 2}\label{Tab: 2} \\ \toprule
    &(1) & (2) & (3) & (4) & (5) & (6)\\    

\end{ltable}


Table~\ref{Tab: 1}

Table~\ref{Tab: 2}. 

Table~\ref{Tab: A1}. 

Table~\ref{Tab: A2}. 

\clearpage


% % %APPENDIX % % % % % % % % % % % % %
\processdelayedfloats
\makeatletter
\efloat@restorefloats
\makeatother
\appendix


\renewcommand{\thefigure}{A\arabic{figure}}
\renewcommand{\thepostfigure}{A\arabic{postfigure}}
\setcounter{figure}{0}
\setcounter{postfigure}{0}

\renewcommand{\thetable}{A\arabic{table}}
\renewcommand{\theposttable}{A\arabic{posttable}}
\setcounter{table}{0}
\setcounter{posttable}{0}

\footnotesize\begin{landscape}\begin{spacing}{1}\begin{longtable}{ 
                >{\RaggedRight\arraybackslash}p{3.3cm} >{\RaggedRight\arraybackslash}p{3.3cm} >{\RaggedRight\arraybackslash}p{3.3cm} >{\RaggedRight}p{3.3cm} >{\RaggedRight}p{3.3cm} >{\RaggedRight}p{3.3cm}  >{\RaggedRight}p{3.3cm}}
            \caption{Table A1}\label{Tab: A1} \\ \toprule
            &(1) & (2) & (3) & (4) & (5) & (6)\\    
        \end{longtable}\end{spacing}\end{landscape}

\newpage            

\footnotesize\begin{landscape}\begin{spacing}{1}\begin{longtable}{ 
                >{\RaggedRight\arraybackslash}p{3.3cm} >{\RaggedRight\arraybackslash}p{3.3cm} >{\RaggedRight\arraybackslash}p{3.3cm} >{\RaggedRight}p{3.3cm} >{\RaggedRight}p{3.3cm} >{\RaggedRight}p{3.3cm}  >{\RaggedRight}p{3.3cm}}
            \caption{Table A2}\label{Tab: A2} \\ \toprule
                &(1) & (2) & (3) & (4) & (5) & (6)\\    
            \end{longtable}\end{spacing}\end{landscape}


\end{document}

I hope this code is suitable to follow up on my problem. I appreciate any help.

Thank you!

  • Why is my code not working as a minimal example? I thought that I have created one :) – Mona Aug 11 '15 at 6:31
  • I have simplified my example. I hope this works better. – Mona Aug 11 '15 at 7:47
1

Package hyperref needs unique anchor names. Since counters sometimes do not have unique names, it introduces a companion "counter" form as \theH<counter>. Then \the<counter> do not be to be unique, but \theH<counter> must.

The example redefines \thetable, but \theHtable is not changed. After making \theHtable unique again, the error is gone:

\renewcommand{\thetable}{A\arabic{table}}
\renewcommand*{\theHtable}{A\arabic{table}}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.