Why do all of my hyperrefs take me to the same page?
up vote
5
down vote
favorite
I can't reproduce this in miniature outside of my document, so I'm asking more debugging help on how I can fix it within the document I have.
The problem is, I have a section with something like:
First is hyperref[P1]{Item I}, go there. hyperref[P2]{Next} is item 2, and finally is hyperref[P3]{Item III}.
newpage
%% later...
section*{Item I}
label{P1}
stuff
section*{Item II}
label{P2}
stuff
section*{Item III}
label{P3}
stuff
Suppose
- Item I, P1 is on page 1.
- Item II, P2 is on page 6.
- Item III, P3 is on page 20.
No matter what I change, hyperref[P3]{Item III}
points to page 5, instead of 20.
I have tried the following debugs:
Did I actually mislabel P3 as P2? No, it's P3.
Did I actually fail to update the original hyperref, so it still says P2? No, it says P3.
Am I sure? How about I call it something totally different, like LOCATION.hyperref[LOCATION]{Item III} section*{Item III}label{LOCATION}
Still points to page 5, not page 20!
Is there an error I'm missing, such as: LaTeX Warning: There were undefined references.
? Nope, there are no missing references.
How about completely removelabel{P2}
and see if P3 is still pointing there? Removed, yes, it still points to page 5, which now has zero labels intentionally pointing to it.
What about debugging the pages themselves?pageref{P1} pageref{P2} pageref{P3}
prints2 7 21
Close enough, but this tells me in fact pageref{P2} is also incorrect. It's not pointing at P2, but at the end of P1, just as P3 is pointing at the end of P1.
Beyond this, I have no idea how to make any refs defined after the first one work, and by that I mean point elsewhere than at page 5. What could be going on?
hyperref cross-referencing href
add a comment |
up vote
5
down vote
favorite
I can't reproduce this in miniature outside of my document, so I'm asking more debugging help on how I can fix it within the document I have.
The problem is, I have a section with something like:
First is hyperref[P1]{Item I}, go there. hyperref[P2]{Next} is item 2, and finally is hyperref[P3]{Item III}.
newpage
%% later...
section*{Item I}
label{P1}
stuff
section*{Item II}
label{P2}
stuff
section*{Item III}
label{P3}
stuff
Suppose
- Item I, P1 is on page 1.
- Item II, P2 is on page 6.
- Item III, P3 is on page 20.
No matter what I change, hyperref[P3]{Item III}
points to page 5, instead of 20.
I have tried the following debugs:
Did I actually mislabel P3 as P2? No, it's P3.
Did I actually fail to update the original hyperref, so it still says P2? No, it says P3.
Am I sure? How about I call it something totally different, like LOCATION.hyperref[LOCATION]{Item III} section*{Item III}label{LOCATION}
Still points to page 5, not page 20!
Is there an error I'm missing, such as: LaTeX Warning: There were undefined references.
? Nope, there are no missing references.
How about completely removelabel{P2}
and see if P3 is still pointing there? Removed, yes, it still points to page 5, which now has zero labels intentionally pointing to it.
What about debugging the pages themselves?pageref{P1} pageref{P2} pageref{P3}
prints2 7 21
Close enough, but this tells me in fact pageref{P2} is also incorrect. It's not pointing at P2, but at the end of P1, just as P3 is pointing at the end of P1.
Beyond this, I have no idea how to make any refs defined after the first one work, and by that I mean point elsewhere than at page 5. What could be going on?
hyperref cross-referencing href
add a comment |
up vote
5
down vote
favorite
up vote
5
down vote
favorite
I can't reproduce this in miniature outside of my document, so I'm asking more debugging help on how I can fix it within the document I have.
The problem is, I have a section with something like:
First is hyperref[P1]{Item I}, go there. hyperref[P2]{Next} is item 2, and finally is hyperref[P3]{Item III}.
newpage
%% later...
section*{Item I}
label{P1}
stuff
section*{Item II}
label{P2}
stuff
section*{Item III}
label{P3}
stuff
Suppose
- Item I, P1 is on page 1.
- Item II, P2 is on page 6.
- Item III, P3 is on page 20.
No matter what I change, hyperref[P3]{Item III}
points to page 5, instead of 20.
I have tried the following debugs:
Did I actually mislabel P3 as P2? No, it's P3.
Did I actually fail to update the original hyperref, so it still says P2? No, it says P3.
Am I sure? How about I call it something totally different, like LOCATION.hyperref[LOCATION]{Item III} section*{Item III}label{LOCATION}
Still points to page 5, not page 20!
Is there an error I'm missing, such as: LaTeX Warning: There were undefined references.
? Nope, there are no missing references.
How about completely removelabel{P2}
and see if P3 is still pointing there? Removed, yes, it still points to page 5, which now has zero labels intentionally pointing to it.
What about debugging the pages themselves?pageref{P1} pageref{P2} pageref{P3}
prints2 7 21
Close enough, but this tells me in fact pageref{P2} is also incorrect. It's not pointing at P2, but at the end of P1, just as P3 is pointing at the end of P1.
Beyond this, I have no idea how to make any refs defined after the first one work, and by that I mean point elsewhere than at page 5. What could be going on?
hyperref cross-referencing href
I can't reproduce this in miniature outside of my document, so I'm asking more debugging help on how I can fix it within the document I have.
The problem is, I have a section with something like:
First is hyperref[P1]{Item I}, go there. hyperref[P2]{Next} is item 2, and finally is hyperref[P3]{Item III}.
newpage
%% later...
section*{Item I}
label{P1}
stuff
section*{Item II}
label{P2}
stuff
section*{Item III}
label{P3}
stuff
Suppose
- Item I, P1 is on page 1.
- Item II, P2 is on page 6.
- Item III, P3 is on page 20.
No matter what I change, hyperref[P3]{Item III}
points to page 5, instead of 20.
I have tried the following debugs:
Did I actually mislabel P3 as P2? No, it's P3.
Did I actually fail to update the original hyperref, so it still says P2? No, it says P3.
Am I sure? How about I call it something totally different, like LOCATION.hyperref[LOCATION]{Item III} section*{Item III}label{LOCATION}
Still points to page 5, not page 20!
Is there an error I'm missing, such as: LaTeX Warning: There were undefined references.
? Nope, there are no missing references.
How about completely removelabel{P2}
and see if P3 is still pointing there? Removed, yes, it still points to page 5, which now has zero labels intentionally pointing to it.
What about debugging the pages themselves?pageref{P1} pageref{P2} pageref{P3}
prints2 7 21
Close enough, but this tells me in fact pageref{P2} is also incorrect. It's not pointing at P2, but at the end of P1, just as P3 is pointing at the end of P1.
Beyond this, I have no idea how to make any refs defined after the first one work, and by that I mean point elsewhere than at page 5. What could be going on?
hyperref cross-referencing href
hyperref cross-referencing href
asked Nov 6 at 16:26
Mittenchops
444149
444149
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
7
down vote
accepted
You need to use
phantomsection
section*{<title>}
label{<label>}
since there is no hyper target set with section*
like there is with section
. If you're only using section*
within your document, you could automate this process using
letoldsectionsection % Copy section into oldsection
renewcommand{section}{%
phantomsection % Set hyper target
oldsection*
}
in your preamble
This is so reasonable I wish it were the default. The macro helps a lot, thank you!
– Mittenchops
Nov 6 at 18:19
3
@Mittenchops: The default forsection
is to issuerefstepcounter
. This sets aref
erence point and alsostep
s thecounter
(section
in this case). However, withsection*
there is no counter to step. Moreover, if you uselabel
-ref
, the result is the previous counter that was stepped. So, it's just that there's nothing appropriate to reference in general. The onus is therefore shifted to the end-user.
– Werner
Nov 6 at 18:22
add a comment |
up vote
3
down vote
Another approachs with hyperref
and nameref
that do not need phantomsection
s:
documentclass{article}
usepackage[colorlinks,linkcolor=blue]{hyperref}
usepackage{lipsum}
usepackage{nameref}
begin{document}
First is Nameref{P1}, go there. par
hyperlink{X}{Here} is nameref{P2} (Nameref{P2}).par
But there are a Nameref{P3}.par
And there are not three without hyperlink{Y}{four} in page pageref{P4}
newpage
section*{Item I}
label{P1}
lipsum[1-20]
section*{Item II}
label{P2}hypertarget{X}
lipsum[21-40]
section*{Item III}
label{P3}
lipsum[41-50]
section*{Item IV}
label{P4}
hypertarget{Y}
lipsum[1]
end{document}
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
7
down vote
accepted
You need to use
phantomsection
section*{<title>}
label{<label>}
since there is no hyper target set with section*
like there is with section
. If you're only using section*
within your document, you could automate this process using
letoldsectionsection % Copy section into oldsection
renewcommand{section}{%
phantomsection % Set hyper target
oldsection*
}
in your preamble
This is so reasonable I wish it were the default. The macro helps a lot, thank you!
– Mittenchops
Nov 6 at 18:19
3
@Mittenchops: The default forsection
is to issuerefstepcounter
. This sets aref
erence point and alsostep
s thecounter
(section
in this case). However, withsection*
there is no counter to step. Moreover, if you uselabel
-ref
, the result is the previous counter that was stepped. So, it's just that there's nothing appropriate to reference in general. The onus is therefore shifted to the end-user.
– Werner
Nov 6 at 18:22
add a comment |
up vote
7
down vote
accepted
You need to use
phantomsection
section*{<title>}
label{<label>}
since there is no hyper target set with section*
like there is with section
. If you're only using section*
within your document, you could automate this process using
letoldsectionsection % Copy section into oldsection
renewcommand{section}{%
phantomsection % Set hyper target
oldsection*
}
in your preamble
This is so reasonable I wish it were the default. The macro helps a lot, thank you!
– Mittenchops
Nov 6 at 18:19
3
@Mittenchops: The default forsection
is to issuerefstepcounter
. This sets aref
erence point and alsostep
s thecounter
(section
in this case). However, withsection*
there is no counter to step. Moreover, if you uselabel
-ref
, the result is the previous counter that was stepped. So, it's just that there's nothing appropriate to reference in general. The onus is therefore shifted to the end-user.
– Werner
Nov 6 at 18:22
add a comment |
up vote
7
down vote
accepted
up vote
7
down vote
accepted
You need to use
phantomsection
section*{<title>}
label{<label>}
since there is no hyper target set with section*
like there is with section
. If you're only using section*
within your document, you could automate this process using
letoldsectionsection % Copy section into oldsection
renewcommand{section}{%
phantomsection % Set hyper target
oldsection*
}
in your preamble
You need to use
phantomsection
section*{<title>}
label{<label>}
since there is no hyper target set with section*
like there is with section
. If you're only using section*
within your document, you could automate this process using
letoldsectionsection % Copy section into oldsection
renewcommand{section}{%
phantomsection % Set hyper target
oldsection*
}
in your preamble
answered Nov 6 at 16:55
Werner
430k599441621
430k599441621
This is so reasonable I wish it were the default. The macro helps a lot, thank you!
– Mittenchops
Nov 6 at 18:19
3
@Mittenchops: The default forsection
is to issuerefstepcounter
. This sets aref
erence point and alsostep
s thecounter
(section
in this case). However, withsection*
there is no counter to step. Moreover, if you uselabel
-ref
, the result is the previous counter that was stepped. So, it's just that there's nothing appropriate to reference in general. The onus is therefore shifted to the end-user.
– Werner
Nov 6 at 18:22
add a comment |
This is so reasonable I wish it were the default. The macro helps a lot, thank you!
– Mittenchops
Nov 6 at 18:19
3
@Mittenchops: The default forsection
is to issuerefstepcounter
. This sets aref
erence point and alsostep
s thecounter
(section
in this case). However, withsection*
there is no counter to step. Moreover, if you uselabel
-ref
, the result is the previous counter that was stepped. So, it's just that there's nothing appropriate to reference in general. The onus is therefore shifted to the end-user.
– Werner
Nov 6 at 18:22
This is so reasonable I wish it were the default. The macro helps a lot, thank you!
– Mittenchops
Nov 6 at 18:19
This is so reasonable I wish it were the default. The macro helps a lot, thank you!
– Mittenchops
Nov 6 at 18:19
3
3
@Mittenchops: The default for
section
is to issue refstepcounter
. This sets a ref
erence point and also step
s the counter
(section
in this case). However, with section*
there is no counter to step. Moreover, if you use label
-ref
, the result is the previous counter that was stepped. So, it's just that there's nothing appropriate to reference in general. The onus is therefore shifted to the end-user.– Werner
Nov 6 at 18:22
@Mittenchops: The default for
section
is to issue refstepcounter
. This sets a ref
erence point and also step
s the counter
(section
in this case). However, with section*
there is no counter to step. Moreover, if you use label
-ref
, the result is the previous counter that was stepped. So, it's just that there's nothing appropriate to reference in general. The onus is therefore shifted to the end-user.– Werner
Nov 6 at 18:22
add a comment |
up vote
3
down vote
Another approachs with hyperref
and nameref
that do not need phantomsection
s:
documentclass{article}
usepackage[colorlinks,linkcolor=blue]{hyperref}
usepackage{lipsum}
usepackage{nameref}
begin{document}
First is Nameref{P1}, go there. par
hyperlink{X}{Here} is nameref{P2} (Nameref{P2}).par
But there are a Nameref{P3}.par
And there are not three without hyperlink{Y}{four} in page pageref{P4}
newpage
section*{Item I}
label{P1}
lipsum[1-20]
section*{Item II}
label{P2}hypertarget{X}
lipsum[21-40]
section*{Item III}
label{P3}
lipsum[41-50]
section*{Item IV}
label{P4}
hypertarget{Y}
lipsum[1]
end{document}
add a comment |
up vote
3
down vote
Another approachs with hyperref
and nameref
that do not need phantomsection
s:
documentclass{article}
usepackage[colorlinks,linkcolor=blue]{hyperref}
usepackage{lipsum}
usepackage{nameref}
begin{document}
First is Nameref{P1}, go there. par
hyperlink{X}{Here} is nameref{P2} (Nameref{P2}).par
But there are a Nameref{P3}.par
And there are not three without hyperlink{Y}{four} in page pageref{P4}
newpage
section*{Item I}
label{P1}
lipsum[1-20]
section*{Item II}
label{P2}hypertarget{X}
lipsum[21-40]
section*{Item III}
label{P3}
lipsum[41-50]
section*{Item IV}
label{P4}
hypertarget{Y}
lipsum[1]
end{document}
add a comment |
up vote
3
down vote
up vote
3
down vote
Another approachs with hyperref
and nameref
that do not need phantomsection
s:
documentclass{article}
usepackage[colorlinks,linkcolor=blue]{hyperref}
usepackage{lipsum}
usepackage{nameref}
begin{document}
First is Nameref{P1}, go there. par
hyperlink{X}{Here} is nameref{P2} (Nameref{P2}).par
But there are a Nameref{P3}.par
And there are not three without hyperlink{Y}{four} in page pageref{P4}
newpage
section*{Item I}
label{P1}
lipsum[1-20]
section*{Item II}
label{P2}hypertarget{X}
lipsum[21-40]
section*{Item III}
label{P3}
lipsum[41-50]
section*{Item IV}
label{P4}
hypertarget{Y}
lipsum[1]
end{document}
Another approachs with hyperref
and nameref
that do not need phantomsection
s:
documentclass{article}
usepackage[colorlinks,linkcolor=blue]{hyperref}
usepackage{lipsum}
usepackage{nameref}
begin{document}
First is Nameref{P1}, go there. par
hyperlink{X}{Here} is nameref{P2} (Nameref{P2}).par
But there are a Nameref{P3}.par
And there are not three without hyperlink{Y}{four} in page pageref{P4}
newpage
section*{Item I}
label{P1}
lipsum[1-20]
section*{Item II}
label{P2}hypertarget{X}
lipsum[21-40]
section*{Item III}
label{P3}
lipsum[41-50]
section*{Item IV}
label{P4}
hypertarget{Y}
lipsum[1]
end{document}
answered Nov 6 at 22:35
Fran
49.6k6110172
49.6k6110172
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f458674%2fwhy-do-all-of-my-hyperrefs-take-me-to-the-same-page%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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