在这个 MWE 中,创建的链接hyperref
指向第一页,但应该指向第二页。
我该如何修复此问题?
\documentclass{article}
\usepackage{hyperref}
\usepackage{varioref}
\newcounter{counterOne}
\newcounter{counterTwo}
\renewcommand{\thecounterTwo}{\alph{counterTwo}}
\labelformat{counterTwo}{\textbf{\thecounterOne.#1)}}
\begin{document}
\refstepcounter{counterOne}
\refstepcounter{counterTwo}
\section{Part 1}
\begin{itemize}
\item
\label{first} This is the first point
\item
\label{second} This is the second point
\end{itemize}
\newpage
\section{Part 2}
\setcounter{counterTwo}{0}
\refstepcounter{counterOne}
\refstepcounter{counterTwo}
\begin{itemize}
\item
\label{third} This is the third point
\end{itemize}
\newpage
\section{Part 3}
It was \ref{third}.
\end{document}
(图片显示链接应指向的位置)
答案1
跟随这是另一个问题的答案,这里有一个解决方案:
\documentclass{article}
\usepackage{hyperref}
\usepackage{varioref}
\newcounter{counterOne}
\newcounter{counterTwo}
\newcounter{counterTotal}
\renewcommand{\thecounterTwo}{\alph{counterTwo}}
\labelformat{counterTotal}{\textbf{\thecounterOne.\thecounterTwo)}}
\begin{document}
\refstepcounter{counterOne}
\refstepcounter{counterTwo}
\refstepcounter{counterTotal}
\section{Part 1}
\begin{itemize}
\item
\label{first} This is the first point
\item
\label{second} This is the second point
\end{itemize}
\newpage
\section{Part 2}
\setcounter{counterTwo}{0}
\refstepcounter{counterOne}
\refstepcounter{counterTwo}
\refstepcounter{counterTotal}
\begin{itemize}
\item
\label{third} This is the third point
\end{itemize}
\newpage
\section{Part 3}
It was \ref{third}.
\end{document}