“destination with the same identifier” error with a custom appendix











up vote
0
down vote

favorite












I am working with a slightly modified version of the answer provided by @StevenBSegletes to achieve a custom appendix structure.



(disclaimer: I left out my own modifications here to make the example more minimal, as this issue arises even with the bare original code by Steven. if you deem that I need to show my full set-up, I will be more than happy to do so.)



When you run the MWE below, all of the labelling of the page numbers, equation numbers etc. work as per normal. But under the hood, eq1 and eq2 in the appendices throw up warnings in the log file that look like:



{C:/Users/user/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}]pdfTeX warnin
g (ext4): destination with the same identifier (name{equation.0.2.1}) has been
already used, duplicate ignored
<to be read again>
relax
l.56 begin{equation}
label{eq1}pdfTeX warning (ext4): destination with the sam
e identifier (name{equation.0.2.1}) has been already used, duplicate ignored
<to be read again>
relax


and clicking the hyperlinks from Appendix B (see MWE) brings me to the "first" equation in the main text, not the appropriate ones in Appendix A and B. Presumably because of the above stated warning.



How can I fix Steven's code so that my references will work as expected? I am using cleveref, hypcap, bookmark and hyperref in my actual document.



MWE



documentclass[12pt]{scrreprt}
usepackage{hyperref}
usepackage{cleveref}

% code taken from: https://tex.stackexchange.com/a/132988
makeatletter
renewcommandappendix{@ifstar{loneappendix}{anappendix}}
newcounter{appndx}
setcounter{appndx}{0}
newcommand loneappendix [1]{
clearpage
setcounter{appndx}{1}
setcounter{figure}{0}
renewcommandthefigure{Alph{appndx}-@arabicc@figure}
setcounter{table}{0}
renewcommandthetable{Alph{appndx}-arabic{table}}
setcounter{equation}{0}
renewcommandtheequation {Alph{appndx}-arabic{equation}}
defappendixtitle{appendixname. #1}
addcontentsline{toc}{section}appendixtitle
theappendixappendixtitle
setcounter{page}{1}
renewcommandthepage{Alph{appndx}.arabic{page}}
}
newcommand anappendix[1]{
clearpage
refstepcounter{appndx}
setcounter{equation}{0}
setcounter{figure}{0}
renewcommandthefigure{Alph{appndx}-@arabicc@figure}
setcounter{table}{0}
renewcommandthetable{Alph{appndx}-arabic{table}}
renewcommandtheequation {Alph{appndx}-arabic{equation}}
defappendixtitle{appendixname~Alph{appndx}. #1}
addcontentsline{toc}{section}appendixtitle
theappendixappendixtitle
setcounter{page}{1}
renewcommandthepage{Alph{appndx}.arabic{page}}
}
newcommandtheappendix[1]{
section*{#1}
}
makeatother

begin{document}
section{First section}
Hello world
section{Second Section}
Hello world, this is the offending equation.
begin{equation}
y =x^2
end{equation}

appendix{First}
I will want to reference this equation later.
begin{equation}label{eq1}
y =x^2
end{equation}

appendix{Second}
begin{equation}label{eq2}
y =x^2
end{equation}

I want to reference first equation from appendix A: cref{eq1}.

I also want to reference the first equation from appendix B: cref{eq2}

But both bring me back to the ``first'' first equation (in the main text).
end{document}


EDIT:



I think I can solve the problem if I introduce new custom counters for the appendix instead of re-using the equation, figure etc. counters. Then there wouldn't be a clash with the main text hyper-labels. But how can I implement this idea, especially with refstepcounter?










share|improve this question




















  • 1




    Option hypertexnames=false should help: usepackage[hypertexnames=false]{hyperref}.
    – esdd
    Nov 16 at 21:29










  • @esdd yeah that works, thank you.
    – ksgj1
    Nov 16 at 23:28















up vote
0
down vote

favorite












I am working with a slightly modified version of the answer provided by @StevenBSegletes to achieve a custom appendix structure.



(disclaimer: I left out my own modifications here to make the example more minimal, as this issue arises even with the bare original code by Steven. if you deem that I need to show my full set-up, I will be more than happy to do so.)



When you run the MWE below, all of the labelling of the page numbers, equation numbers etc. work as per normal. But under the hood, eq1 and eq2 in the appendices throw up warnings in the log file that look like:



{C:/Users/user/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}]pdfTeX warnin
g (ext4): destination with the same identifier (name{equation.0.2.1}) has been
already used, duplicate ignored
<to be read again>
relax
l.56 begin{equation}
label{eq1}pdfTeX warning (ext4): destination with the sam
e identifier (name{equation.0.2.1}) has been already used, duplicate ignored
<to be read again>
relax


and clicking the hyperlinks from Appendix B (see MWE) brings me to the "first" equation in the main text, not the appropriate ones in Appendix A and B. Presumably because of the above stated warning.



How can I fix Steven's code so that my references will work as expected? I am using cleveref, hypcap, bookmark and hyperref in my actual document.



MWE



documentclass[12pt]{scrreprt}
usepackage{hyperref}
usepackage{cleveref}

% code taken from: https://tex.stackexchange.com/a/132988
makeatletter
renewcommandappendix{@ifstar{loneappendix}{anappendix}}
newcounter{appndx}
setcounter{appndx}{0}
newcommand loneappendix [1]{
clearpage
setcounter{appndx}{1}
setcounter{figure}{0}
renewcommandthefigure{Alph{appndx}-@arabicc@figure}
setcounter{table}{0}
renewcommandthetable{Alph{appndx}-arabic{table}}
setcounter{equation}{0}
renewcommandtheequation {Alph{appndx}-arabic{equation}}
defappendixtitle{appendixname. #1}
addcontentsline{toc}{section}appendixtitle
theappendixappendixtitle
setcounter{page}{1}
renewcommandthepage{Alph{appndx}.arabic{page}}
}
newcommand anappendix[1]{
clearpage
refstepcounter{appndx}
setcounter{equation}{0}
setcounter{figure}{0}
renewcommandthefigure{Alph{appndx}-@arabicc@figure}
setcounter{table}{0}
renewcommandthetable{Alph{appndx}-arabic{table}}
renewcommandtheequation {Alph{appndx}-arabic{equation}}
defappendixtitle{appendixname~Alph{appndx}. #1}
addcontentsline{toc}{section}appendixtitle
theappendixappendixtitle
setcounter{page}{1}
renewcommandthepage{Alph{appndx}.arabic{page}}
}
newcommandtheappendix[1]{
section*{#1}
}
makeatother

begin{document}
section{First section}
Hello world
section{Second Section}
Hello world, this is the offending equation.
begin{equation}
y =x^2
end{equation}

appendix{First}
I will want to reference this equation later.
begin{equation}label{eq1}
y =x^2
end{equation}

appendix{Second}
begin{equation}label{eq2}
y =x^2
end{equation}

I want to reference first equation from appendix A: cref{eq1}.

I also want to reference the first equation from appendix B: cref{eq2}

But both bring me back to the ``first'' first equation (in the main text).
end{document}


EDIT:



I think I can solve the problem if I introduce new custom counters for the appendix instead of re-using the equation, figure etc. counters. Then there wouldn't be a clash with the main text hyper-labels. But how can I implement this idea, especially with refstepcounter?










share|improve this question




















  • 1




    Option hypertexnames=false should help: usepackage[hypertexnames=false]{hyperref}.
    – esdd
    Nov 16 at 21:29










  • @esdd yeah that works, thank you.
    – ksgj1
    Nov 16 at 23:28













up vote
0
down vote

favorite









up vote
0
down vote

favorite











I am working with a slightly modified version of the answer provided by @StevenBSegletes to achieve a custom appendix structure.



(disclaimer: I left out my own modifications here to make the example more minimal, as this issue arises even with the bare original code by Steven. if you deem that I need to show my full set-up, I will be more than happy to do so.)



When you run the MWE below, all of the labelling of the page numbers, equation numbers etc. work as per normal. But under the hood, eq1 and eq2 in the appendices throw up warnings in the log file that look like:



{C:/Users/user/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}]pdfTeX warnin
g (ext4): destination with the same identifier (name{equation.0.2.1}) has been
already used, duplicate ignored
<to be read again>
relax
l.56 begin{equation}
label{eq1}pdfTeX warning (ext4): destination with the sam
e identifier (name{equation.0.2.1}) has been already used, duplicate ignored
<to be read again>
relax


and clicking the hyperlinks from Appendix B (see MWE) brings me to the "first" equation in the main text, not the appropriate ones in Appendix A and B. Presumably because of the above stated warning.



How can I fix Steven's code so that my references will work as expected? I am using cleveref, hypcap, bookmark and hyperref in my actual document.



MWE



documentclass[12pt]{scrreprt}
usepackage{hyperref}
usepackage{cleveref}

% code taken from: https://tex.stackexchange.com/a/132988
makeatletter
renewcommandappendix{@ifstar{loneappendix}{anappendix}}
newcounter{appndx}
setcounter{appndx}{0}
newcommand loneappendix [1]{
clearpage
setcounter{appndx}{1}
setcounter{figure}{0}
renewcommandthefigure{Alph{appndx}-@arabicc@figure}
setcounter{table}{0}
renewcommandthetable{Alph{appndx}-arabic{table}}
setcounter{equation}{0}
renewcommandtheequation {Alph{appndx}-arabic{equation}}
defappendixtitle{appendixname. #1}
addcontentsline{toc}{section}appendixtitle
theappendixappendixtitle
setcounter{page}{1}
renewcommandthepage{Alph{appndx}.arabic{page}}
}
newcommand anappendix[1]{
clearpage
refstepcounter{appndx}
setcounter{equation}{0}
setcounter{figure}{0}
renewcommandthefigure{Alph{appndx}-@arabicc@figure}
setcounter{table}{0}
renewcommandthetable{Alph{appndx}-arabic{table}}
renewcommandtheequation {Alph{appndx}-arabic{equation}}
defappendixtitle{appendixname~Alph{appndx}. #1}
addcontentsline{toc}{section}appendixtitle
theappendixappendixtitle
setcounter{page}{1}
renewcommandthepage{Alph{appndx}.arabic{page}}
}
newcommandtheappendix[1]{
section*{#1}
}
makeatother

begin{document}
section{First section}
Hello world
section{Second Section}
Hello world, this is the offending equation.
begin{equation}
y =x^2
end{equation}

appendix{First}
I will want to reference this equation later.
begin{equation}label{eq1}
y =x^2
end{equation}

appendix{Second}
begin{equation}label{eq2}
y =x^2
end{equation}

I want to reference first equation from appendix A: cref{eq1}.

I also want to reference the first equation from appendix B: cref{eq2}

But both bring me back to the ``first'' first equation (in the main text).
end{document}


EDIT:



I think I can solve the problem if I introduce new custom counters for the appendix instead of re-using the equation, figure etc. counters. Then there wouldn't be a clash with the main text hyper-labels. But how can I implement this idea, especially with refstepcounter?










share|improve this question















I am working with a slightly modified version of the answer provided by @StevenBSegletes to achieve a custom appendix structure.



(disclaimer: I left out my own modifications here to make the example more minimal, as this issue arises even with the bare original code by Steven. if you deem that I need to show my full set-up, I will be more than happy to do so.)



When you run the MWE below, all of the labelling of the page numbers, equation numbers etc. work as per normal. But under the hood, eq1 and eq2 in the appendices throw up warnings in the log file that look like:



{C:/Users/user/AppData/Local/MiKTeX/2.9/pdftex/config/pdftex.map}]pdfTeX warnin
g (ext4): destination with the same identifier (name{equation.0.2.1}) has been
already used, duplicate ignored
<to be read again>
relax
l.56 begin{equation}
label{eq1}pdfTeX warning (ext4): destination with the sam
e identifier (name{equation.0.2.1}) has been already used, duplicate ignored
<to be read again>
relax


and clicking the hyperlinks from Appendix B (see MWE) brings me to the "first" equation in the main text, not the appropriate ones in Appendix A and B. Presumably because of the above stated warning.



How can I fix Steven's code so that my references will work as expected? I am using cleveref, hypcap, bookmark and hyperref in my actual document.



MWE



documentclass[12pt]{scrreprt}
usepackage{hyperref}
usepackage{cleveref}

% code taken from: https://tex.stackexchange.com/a/132988
makeatletter
renewcommandappendix{@ifstar{loneappendix}{anappendix}}
newcounter{appndx}
setcounter{appndx}{0}
newcommand loneappendix [1]{
clearpage
setcounter{appndx}{1}
setcounter{figure}{0}
renewcommandthefigure{Alph{appndx}-@arabicc@figure}
setcounter{table}{0}
renewcommandthetable{Alph{appndx}-arabic{table}}
setcounter{equation}{0}
renewcommandtheequation {Alph{appndx}-arabic{equation}}
defappendixtitle{appendixname. #1}
addcontentsline{toc}{section}appendixtitle
theappendixappendixtitle
setcounter{page}{1}
renewcommandthepage{Alph{appndx}.arabic{page}}
}
newcommand anappendix[1]{
clearpage
refstepcounter{appndx}
setcounter{equation}{0}
setcounter{figure}{0}
renewcommandthefigure{Alph{appndx}-@arabicc@figure}
setcounter{table}{0}
renewcommandthetable{Alph{appndx}-arabic{table}}
renewcommandtheequation {Alph{appndx}-arabic{equation}}
defappendixtitle{appendixname~Alph{appndx}. #1}
addcontentsline{toc}{section}appendixtitle
theappendixappendixtitle
setcounter{page}{1}
renewcommandthepage{Alph{appndx}.arabic{page}}
}
newcommandtheappendix[1]{
section*{#1}
}
makeatother

begin{document}
section{First section}
Hello world
section{Second Section}
Hello world, this is the offending equation.
begin{equation}
y =x^2
end{equation}

appendix{First}
I will want to reference this equation later.
begin{equation}label{eq1}
y =x^2
end{equation}

appendix{Second}
begin{equation}label{eq2}
y =x^2
end{equation}

I want to reference first equation from appendix A: cref{eq1}.

I also want to reference the first equation from appendix B: cref{eq2}

But both bring me back to the ``first'' first equation (in the main text).
end{document}


EDIT:



I think I can solve the problem if I introduce new custom counters for the appendix instead of re-using the equation, figure etc. counters. Then there wouldn't be a clash with the main text hyper-labels. But how can I implement this idea, especially with refstepcounter?







hyperref cross-referencing appendices






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 16 at 21:19

























asked Nov 16 at 20:33









ksgj1

321114




321114








  • 1




    Option hypertexnames=false should help: usepackage[hypertexnames=false]{hyperref}.
    – esdd
    Nov 16 at 21:29










  • @esdd yeah that works, thank you.
    – ksgj1
    Nov 16 at 23:28














  • 1




    Option hypertexnames=false should help: usepackage[hypertexnames=false]{hyperref}.
    – esdd
    Nov 16 at 21:29










  • @esdd yeah that works, thank you.
    – ksgj1
    Nov 16 at 23:28








1




1




Option hypertexnames=false should help: usepackage[hypertexnames=false]{hyperref}.
– esdd
Nov 16 at 21:29




Option hypertexnames=false should help: usepackage[hypertexnames=false]{hyperref}.
– esdd
Nov 16 at 21:29












@esdd yeah that works, thank you.
– ksgj1
Nov 16 at 23:28




@esdd yeah that works, thank you.
– ksgj1
Nov 16 at 23:28















active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














 

draft saved


draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f460375%2fdestination-with-the-same-identifier-error-with-a-custom-appendix%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes
















 

draft saved


draft discarded



















































 


draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f460375%2fdestination-with-the-same-identifier-error-with-a-custom-appendix%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

ComboBox Display Member on multiple fields

Is it possible to collect Nectar points via Trainline?