如何自訂\標籤{}

如何自訂\標籤{}

我想更改命令的顯示方式\label{}。更準確地說是 的定理ntheorem

事實上,我創建了一個名為「假設」的定理,我想用字母而不是數字來引用假設。

所以我在序言中

\newtheorem*{hyp}{Assumption}}

我在我的文章中聲明

\begin{hyp}[\ref{H}]\label{H}
\end{hyp}

當我引用 時H(1)會列印出來,但我的目標是獲得(H)動態連結。我知道\tag{}環境中的命令\begin{equation},但僅此而已。

我提出這個最小的例子。

\documentclass[11pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}  
\usepackage{amsmath,amssymb,mathrsfs}
\usepackage[colorlinks=true,linkcolor=blue,citecolor=red,backref=page]{hyperref}
\usepackage[hyperref]{ntheorem}

{\theoremheaderfont{\normalfont\bfseries}
\theorembodyfont{\itshape}
\theoremseparator{:}
\newtheorem*{hyp}{Assumption}}

\begin{document}

\begin{hyp}[\ref{sheme}]\label{sheme}
Bla bla
\end{hyp}

\begin{hyp}[H]
Bla bla
\end{hyp}

\begin{equation} 1=1, \tag{\textbf{H}$_{Mon}$} \label{mono} \end{equation}
Reference to mono: (\ref{mono}), with an hyperlink
\end{document}

可以更改equation環境中的標籤。我可以在其他地方做什麼?

答案1

這裡光說\usepackage[hyperref]{ntheorem}還不夠。包hyperref也必須載入!

\documentclass[11pt]{article}
\usepackage[utf8x]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[english]{babel}  
\usepackage{amsmath,amssymb,mathrsfs}
\usepackage[hyperref]{ntheorem}
\usepackage{hyperref}

{\theoremheaderfont{\normalfont\bfseries}
\theorembodyfont{\itshape}
\theoremseparator{:}
\newtheorem*{hyp}{Assumption}}

\begin{document}

\begin{hyp}[\ref{sheme}]\label{sheme}
Bla bla
\end{hyp}

\begin{hyp}[H]
Bla bla
\end{hyp}


\begin{equation} 1=1, \tag{\textbf{H}$_{Mon}$} \label{mono} \end{equation}
Reference to mono: (\ref{mono}), with an hyperlink

\end{document}

答案2

最後我創建了以下環境

\newenvironment{assumption}[1][\unskip]{%
\begin{enumerate}[label=(\textbf{#1}),leftmargin=60pt] 
\item\label{#1}}
{\end{enumerate}}

並且得到我想要的。

相關內容