假設編號

假設編號

假設我想要一個假設為的標題Assumption 1-$\mathcal F$.Assumption 2-$\mathcal F$.依此類推,在文本中用不同於 的符號進一步調用$\mathcal F$。讓我舉一個例子:

\documentclass[10pt, a4paper]{amsart}
\usepackage{amsmath}               
  {
      \theoremstyle{plain}
      \newtheorem{assumption}{Assumption}
  }
\begin{document}
\section{The first section}
\subsection{The first subsection}
There are three classes of interest: $\mathcal a$, $\mathcal b$ and $\mathcal c$.
Let $\mathcal f$ be a symbolic variable which takes its values 
from the set $\{\mathcal a,\mathcal b,\mathcal c\}$.

\begin{assumption}-$\mathcal f$\label{as:1}
  The class $\mathcal f$ is not empty.
\end{assumption}

\begin{assumption}-$\mathcal f$\label{as:2}
  The derivative $\mathrm d(\mathcal f)$ is positive.
\end{assumption}

Examples of using the assumptions above are as follows:
\begin{itemize}
  \item By saying that Assumption \ref{as:1}-$\mathcal a$ is satisfied,
we mean that the class $\a$ is not empty.
  \item By saying that Assumption \ref{as:2}-$\mathcal c$ is satisfied,
we mean that the derivative $\mathrm d(\mathcal c)$ is positive.
\end{itemize}
\end{document}

在此輸入影像描述


在這個例子中,除了假設的標題之外,一切都很好。目前他們是Assumption 1. -$\mathcal F$,而我需要$\mathcal F$成為標題的一部分。如下。但是,每當我\ref在正文中使用時,引用都是形式Assumption 1.1而不是Assumption 1.事實上,編號效果不佳:它似乎只取決於此處定義假設的部分/小節的數量。

  {
      \theoremstyle{plain}
      \newtheorem*{assumption1f}{Assumption 1-$\mathcal f$}
      \newtheorem*{assumption2f}{Assumption 2-$\mathcal f$}
  }
\begin{document}
\section{The first section}
\subsection{The first subsection}
There are three classes of interest: $\mathcal a$, $\mathcal b$ and $\mathcal c$.
Let $\mathcal f$ be a symbolic variable which takes its values 
from the set $\{\mathcal a,\mathcal b,\mathcal c\}$.

\begin{assumption1f}\label{as:1}
  The class $\mathcal f$ is not empty.
\end{assumption1f}

\begin{assumption2f}\label{as:2}
  The derivative $\mathrm d(\mathcal f)$ is positive.
\end{assumption2f}

Examples of using the assumptions above are as follows:
\begin{itemize}
  \item By saying that Assumption \ref{as:1}-$\mathcal a$ is satisfied,
we mean that the class $\mathcal a$ is not empty.
  \item By saying that Assumption \ref{as:2}-$\mathcal c$ is satisfied,
we mean that the derivative $\mathrm d(\mathcal c)$ is positive.
\end{itemize}
\end{document}

在此輸入影像描述


有什麼辦法可以解決這個問題嗎?根據egreg的建議,我實作了以下程式碼。標題現在很好,如上所述 - 但編號仍然不好:而不是Assumption 1-$\mathcal A$指第一個假設,我必須在參考文獻中得到 $\mathcal F$ 。

\newtheorem*{assumption*}{\assumptionnumber}
\providecommand{\assumptionnumber}{}
\makeatletter
\newenvironment{assumption}[2]
 {%
  \renewcommand{\assumptionnumber}{Assumption #1-$\mathcal{#2}$}%
  \begin{assumption*}%
  \protected@edef\@currentlabel{#1-$\mathcal{#2}$}%
 }
 {%
  \end{assumption*}
 }
\makeatother

\begin{document}
\section{The first section}
\subsection{The first subsection}

There are three classes of interest: $\mathcal a$, $\mathcal b$ and $\mathcal c$.
Let $\mathcal f$ be a symbolic variable which takes its values 
from the set $\{\mathcal a,\mathcal b,\mathcal c\}$.

\begin{assumption}{1}{F}\label{as:1}
  The class $\mathcal f$ is not empty.
\end{assumption}

\begin{assumption}{2}{F}\label{as:2}
  The derivative $\mathrm d(\mathcal f)$ is positive.
\end{assumption}

Examples of using the assumptions above are as follows:
\begin{itemize}
  \item By saying that Assumption \ref{as:1}-$\mathcal a$ is satisfied,
we mean that the class $\mathcal a$ is not empty.
  \item By saying that Assumption \ref{as:2}-$\mathcal c$ is satisfied,
we mean that the derivative $\mathrm d(\mathcal c)$ is positive.
\end{itemize}
\end{document}

在此輸入影像描述


總結一下:在第一個版本中,參考文獻是我想要的方式,但標題不是。在另外兩個案例中(我自己的嘗試和@egreg建議的程式碼),標題很好,但引用與第一個案例不同。

答案1

\newtheorem*我猜你正在使用amsthm.這是一種方法:

\documentclass{article}
\usepackage{amsthm}

\newtheorem*{assumption*}{\assumptionnumber}
\providecommand{\assumptionnumber}{}
\makeatletter
\newenvironment{assumption}[2]
 {%
  \renewcommand{\assumptionnumber}{Assumption #1-$\mathcal{#2}$}%
  \begin{assumption*}%
  \protected@edef\@currentlabel{#1-$\mathcal{#2}$}%
 }
 {%
  \end{assumption*}
 }
\makeatother

\begin{document}

\begin{assumption}{1}{F}\label{1F}
Something
\end{assumption}

Here's the reference: \ref{1F}

\end{document}

\newtheorem*需要一個。環境assumption將數字和標籤作為參數;它還設定當前參考文字。

在此輸入影像描述


這是一個似乎正在做你想做的修改。也許:規格仍然模糊。

\documentclass{article}
\usepackage{amsthm}

\newtheorem*{assumption*}{\assumptionnumber}
\providecommand{\assumptionnumber}{}
\makeatletter
\newenvironment{assumption}[2]
 {%
  \renewcommand{\assumptionnumber}{Assumption #1-$\mathcal{#2}$}%
  \begin{assumption*}%
  \protected@edef\@currentlabel{#1}%
 }
 {%
  \end{assumption*}
 }
\makeatother
\newcommand{\asref}[2]{\ref{#1}-$\mathcal{#2}$}

\begin{document}

\section{The first section}
\subsection{The first subsection}

There are three classes of interest: $\mathcal{A}$, $\mathcal{B}$ and $\mathcal{C}$.
Let $\mathcal{F}$ be a symbolic variable which takes its values 
from the set $\{\mathcal{A},\mathcal{B},\mathcal{C}\}$.

\begin{assumption}{1}{F}\label{as:1}
  The class $\mathcal{F}$ is not empty.
\end{assumption}

\begin{assumption}{2}{F}\label{as:2}
  The derivative $\mathrm{d}(\mathcal{F})$ is positive.
\end{assumption}

Examples of using the assumptions above are as follows:
\begin{itemize}
\item By saying that Assumption \asref{as:1}{A} is satisfied,
we mean that the class $\mathcal{A}$ is not empty.

\item By saying that Assumption \asref{as:2}{C} is satisfied,
we mean that the derivative $\mathrm d(\mathcal{C})$ is positive.
\end{itemize}
\end{document}

在此輸入影像描述

相關內容