セクション番号を抑制し、ラベルを保持

セクション番号を抑制し、ラベルを保持

私は探しています単純\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}

関連情報