7

Suppose I would like to have a title of assumption being Assumption 1-$\mathcal F$., Assumption 2-$\mathcal F$. and so on to be further called in the text with symbols different from $\mathcal F$. Let me give you an example:

\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}

enter image description here


In this example everything is fine but the titles of assumptions. Currently they are Assumption 1. -$\mathcal F$ whereas I need $\mathcal F$ to be the part of the title. As below. However, whenever I use \ref in the body text, the reference is of the form Assumption 1.1 rather than Assumption 1. In fact, the numbering does not work well: it seem to depend only on the number of section/subsection where the assumption was defined as here.

  {
      \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}

enter image description here


Is there any way to fix that? As suggested by egreg, I've implemented the following code. The titles are now fine, as above - but the numbering is still not ok: instead of Assumption 1-$\mathcal A$ that refers to the first assumption, I necessarily get $\mathcal F$ in the reference.

\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}

enter image description here


To summarize: in the first version references are the way I want, but titles are not. In the other two (my own attempt, and the code suggested by @egreg) the titles are good, but the references differ from the first case.

SBF
  • 1,418
  • 1
    Please post a complete (non-)Working example. This makes it a lot easier to help! For example, post the code you used to produce the second picture. – cfr Mar 23 '14 at 20:40
  • @Ilya Please, state clearly what you expect from \ref to produce when the assumption is called 1-F, and possibly in other cases. – egreg Mar 24 '14 at 09:50
  • @egreg: this is stated in the first example in the OP. I would like the assumption's title to be exactly Assumption 1-$\mathcal F$ and Assumption 2-$\mathcal F$. At the same time, I would like to write in the text Assumption 1-$\mathcal A$, Assumption 1-$\mathcal B$ and Assumption 1-$\mathcal C$ so that each of them refers to the assumption Assumption 1-$\mathcal F$. The same I would like to be able to do for Assumption 2-$\mathcal F$. Please, tell me whether this is clear. – SBF Mar 24 '14 at 10:15
  • @Ilya Now it is. Does the final solution please you? – egreg Mar 24 '14 at 10:17

1 Answers1

9

From \newtheorem* I guess you're using amsthm. Here's a way to do it:

\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}

Only one \newtheorem* is needed. The assumption environment takes as argument the number and the label; it also sets the current reference text.

enter image description here


Here's a modification that seems to be doing what you'd like. Perhaps: the specifications continue to be vague.

\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}

enter image description here

egreg
  • 1,121,712
  • Thanks a lot, though I've need to refer to this assumption in the body text with $\mathcal A$ taking different values. Say, I would like Assumption 1-$\mathcal B$ and Assumption 1-$\mathcal C$ both refer to Assumption 1. In the way I was trying to do this everything goes fine but the fact that the numbering is 1.1 rather than just 1. Moreover, the numbering does not go automatically - e.g. there never appears even Assumption 1.2 (Assumption 2 would be desired here). Unfortunately, if I do they way you proposed, the reference is 1-$\mathcal F$ rather than just 1. Please tell me, if I'm clear. – SBF Mar 23 '14 at 12:16
  • For example, when I am using \begin{assumption}[$-\mathcal A$] everything goes besides the point the parentheses are present in the title: Assumption 1 ($-\mathcal A$), but at least I can call refer to this Assumption in text the way I desire. Perhaps, there is a chance to fix these parentheses? Otherwise, I can just start using Assumption 1 ($\mathcal A$) both in the title and in text. – SBF Mar 23 '14 at 12:37
  • @Ilya Please, give a specification of how you want the title to appear and what the reference should point to. – egreg Mar 23 '14 at 13:08
  • I've updated the OP - hope it is clear now. – SBF Mar 23 '14 at 20:09
  • @Ilya Isn't what you want exactly what my macros do? – egreg Mar 23 '14 at 20:36
  • I've added all three cases: the first one (titles are bad, references are ideal for me), the second one (my own attempt, titles are the way I want, references differ from the first case) and the third one (your suggestion, titles are good, references differ from the first case again). Did I implement your code correctly? – SBF Mar 24 '14 at 09:45
  • Thanks, for some reason it now works well even if I don't use \asref and just write Assumption \ref{as:1}-$\mathcal A$. Many thanks for your effort and patience with this question. – SBF Mar 24 '14 at 10:45