TeX - LaTeX Asked by Mihir Mehta on July 12, 2021
I have few section*
in my latex file.
Now I need to reference that section*
in my other section*
.
How can I do that?
If required, do not hesitate ask for more details.
Cross-referencing things that have no numbers, e.g., starred sections, makes no sense with the cross-referencing-infrastructure of the LaTeX 2ε-kernel alone as that infrastructure is focussed on delivering the numbers of items of numbered sectioning.
Obtaining hyperlinks in the resulting .pdf-output-file is a different issue.
When loading the hyperref-package you can use the command phantomsection
for placing a named destination=an anchor=a target into the .pdf-file. Seems with more current releases of hyperref you don't need to as hyperref itself will do that for you. In any case the name of that destination will be created automatically by the hyperref-package.
If issued afterwards, the label
-command will make that named destination=anchor=target available for referencing-commands like pageref
or nameref
. You can also use hyperref[{⟨cross-referencing-label⟩}]{⟨text of hyperlink⟩}
for creating a hyperlink to the named destination=anchor=target associated to the cross-referencing-label in question.
documentclass{article}
usepackage{hyperref}
begin{document}
%section*{phantomsection First unnumbered section}
section*{First unnumbered section}
label{FirstLabel}%
%section*{phantomsection Second unnumbered section}
section*{Second unnumbered section}
label{SecondLabel}%
noindent Referencing:
verb|pageref{FirstLabel}|: pageref{FirstLabel}
verb|pageref{SecondLabel}|: pageref{SecondLabel}
verb|nameref{FirstLabel}|: nameref{FirstLabel}
verb|nameref{SecondLabel}|: nameref{SecondLabel}
bigskip
noindent Customized hyperlinks:
verb|hyperref[{FirstLabel}]{Text of the 1st link}|: hyperref[{FirstLabel}]{Text of the 1st link}
verb|hyperref[{SecondLabel}]{Text of the 2nd link}|: hyperref[{SecondLabel}]{Text of the 2nd link}
bigskip
noindent The following don't make sense and trigger messages on the console/terminal/shell:
verb|Package hyperref Warning: Suppressing empty link on input line 48.|
verb|Package hyperref Warning: Suppressing empty link on input line 50.|
verb|ref{FirstLabel}|: ref{FirstLabel}
verb|ref{SecondLabel}|: ref{SecondLabel}
end{document}
Answered by Ulrich Diez on July 12, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP