섹션 번호를 표시하지 않고 라벨을 유지합니다.

섹션 번호를 표시하지 않고 라벨을 유지합니다.

나는 ~을 찾고 있다단순한\label동시에 사용하는 방법 \section*. 내 목표는라벨이 있는 번호가 없는 섹션그것을 할 수 있도록 \autoref.

문제는 을 \label사용할 때 작동하지 않는다는 것입니다 \section*. 물론 을 사용할 때는 작동 \section하지만 섹션에 번호가 매겨집니다.

문서에 다음이 있습니다.

\RequirePackage[colorlinks=true, allcolors=blue]{hyperref}
\section*{Criterion} \label{sec:crit}
\section*{My new section}
Blah blah refers to \autoref{sec:crit}

편집하다:

저는 Overleaf의 이 템플릿을 사용하고 있습니다:https://www.overleaf.com/latex/templates/template-for-data-descriptor-submissions-to-scientific-data/ygdzkjcqzmbp

나는 ~을 찾고 있다단순한이 템플릿과 동시에 \label사용 하는 방법입니다 .\section*

이 독립 실행형 코드는 제대로 작동하므로 문제는 "wlscirep.cls" 파일에 있어야 합니다.

\documentclass[10pt]{article}
\RequirePackage[colorlinks=true, allcolors=blue]{hyperref}
\begin{document}
\section*{Criterion} \label{sec:crit}
Here is section one
\section*{My new section}
Here is section two. This refers back to \hyperref[sec:crit]{Criterion~\ref*{sec:crit}}.
\end{document}

하지만 \hyperref[sec:crit]{Criterion~\ref*{sec:crit}}해당 템플릿에 있으면 작동하지 않습니다.


답변1

\phantomsection위의 작업을 추가하면 됩니다 \section*{Criterion} \label{sec:crit}.

\RequirePackage[colorlinks=true, allcolors=blue]{hyperref}
\begin{document}
\phantomsection
\section*{Criterion} \label{sec:crit}
Here is section one
\section*{My new section}
Here is section two. This refers back to \hyperref[sec:crit]{Criterion~\ref*{sec:crit}}.
\end{document}

관련 정보