I'm trying to make cross referencing to a forward part in my document using \hyperref[<to_label>]{<link_text>} but it seems because of \label{} is ahead of \hyperref, that's not defined when code is compiled, so the link does not work properly.
I'm using this code to include enumerate environment items in equations numbering
\counterwithin*{equation}{section}
\counterwithin*{equation}{subsection}
\counterwithin*{equation}{enumi}
\usepackage{chngcntr,etoolbox}
\newif\ifinenumerate
\AtBeginEnvironment{enumerate}{\inenumeratetrue}
\makeatletter
\renewcommand\theequation{%
\ifnum\value{subsection}>0 \thesubsection.\else
\ifnum\value{section}>0 \thesection.\fi\fi
\ifinenumerate \theenumi\fi
\arabic{equation}}
\renewcommand\thefigure{%
\ifnum\value{subsection}>0 \thesubsection.\else
\ifnum\value{section}>0 \thesection.\fi\fi
\ifinenumerate \theenumi\fi
\roman{figure}}
\makeatother
And this is my hyperref setup
\usepackage[colorlinks=false]{hyperref}
\hypersetup{
pdftitle={...},
pdfauthor={...},
pdfsubject={...},
pdfkeywords={...},
}
Here is a working example; as you can check my cross reference carries to last equation referenced instead of \label what I've defined.
\documentclass[8pt,a4paper,dvipsnames]{article}
\usepackage[utf8]{inputenc}
\usepackage[a4paper,hmargin=2cm,vmargin={2cm,2.5cm}]{geometry}
\usepackage[colorlinks=false]{hyperref}
\hypersetup{
pdftitle={...},
pdfauthor={...},
pdfsubject={...},
pdfkeywords={...},
}
\usepackage{enumitem}
\usepackage{chngcntr}
\usepackage{cleveref}
\counterwithin*{equation}{section}
\counterwithin*{equation}{subsection}
\counterwithin*{equation}{enumi}
\usepackage{etoolbox}
\newif\ifinenumerate
\AtBeginEnvironment{enumerate}{\inenumeratetrue}
\makeatletter
\renewcommand\theequation{%
\ifnum\value{subsection}>0 \thesubsection.\else
\ifnum\value{section}>0 \thesection.\fi\fi
\ifinenumerate \theenumi\fi
\arabic{equation}}
\makeatother
\begin{document}
\section{test 1}
\subsection{test 1.1}
\begin{enumerate}[label=\alph*.]
\item item a
\begin{itemize}
\item item a case 1
\begin{equation}
a = b
\end{equation}
\begin{itemize}
\item item a case 1 subcase 1
\begin{equation}
a = b
\end{equation}
I need to reference \hyperref[not:Note1]{forward}
\end{itemize}
\end{itemize}
In here, for example \label{not:Note1}
\end{enumerate}
\end{document}
hyperrefis loaded. – Mico Nov 02 '16 at 13:02.auxfile, which is read in on subsequent runs, so after that is available, the reference should appear. – barbara beeton Nov 02 '16 at 13:12\documentclass{...}, the required\usepackage's,\begin{document}, and\end{document}. That may seem tedious to you, but think of the extra work it represents for TeX.SX users willing to give you a hand. Help them help you: remove that one hurdle between you and a solution to your problem. – samcarter_is_at_topanswers.xyz Nov 02 '16 at 13:24\label{not:Note1}. you need to establish a proper target. does this answer help: Link to arbitrary part of text?? – barbara beeton Nov 02 '16 at 14:23