Escribir condiciones de teoremas con numeración y etiquetas automáticas.

Escribir condiciones de teoremas con numeración y etiquetas automáticas.

Estoy tratando de escribir las condiciones necesarias para que un teorema sea válido de modo que la condición se numere automáticamente Y se pueda hacer referencia a ella más adelante (por ejemplo, se puede usar un enlace para volver a la definición de la condición inicial).

El formato que estoy intentando obtener es:

(C1) Statement about the required process

Y la referencia en el documento sería:

Following from (C1), we have that blah.

He probado algo como:

\documentclass{article}
\usepackage{cleveref}

\usepackage{amsthm}

% Define new theorem environment that works only with conditions
\newtheorem{Condition}{C}


\crefname{Condition}{C}{C} % singular and plural forms of label


\begin{document}

% Attempt 1
\begin{Condition}
\begin{enumerate}
\item Statement about the required process. \label{cond:test}
\item Next statement about the required process. \label{cond:test2}
\end{enumerate}
\end{Condition}

% Attempt 2
\begin{Condition}
Statement about the required process. \label{cond:test3}
\end{Condition}

(C\ref{cond:test}, \ref{cond:test2}, \ref{cond:test3}

\end{document}

¿Alguna sugerencia?

Respuesta1

Aquí hay una forma posible de usar los elementos de enumeratey convertirlos en un subcondition, usando el Conditioncontador como padre.

Las condiciones 'sin elemento' deben usar una etiqueta de referencia similar, impresa como (C2)etc. Para lograr esto, uno tiene que cambiar la \p@Conditionmacro, para tomar el nombre del contador primero y agregarlo )después.

\documentclass{article}
\usepackage{amsthm}
\usepackage{enumitem}


\newtheorem{Condition}{C}



\usepackage{hyperref}
\usepackage{cleveref}



\setlist[enumerate,1]{leftmargin={40pt},label=(C\theCondition.\arabic*),ref=(C\theCondition.\arabic*),before={\leavevmode}}

\makeatletter
\def\@grabconditioncounter\csname #1\endcsname{%
  (C\csname#1\endcsname)%
}

\renewcommand\p@Condition{\@grabconditioncounter}

\makeatother



\begin{document}


\begin{Condition}
\begin{enumerate}
\item Statement about the required process. \label{cond:test}

\item Next statement about the required process. \label{cond:test2}
\end{enumerate}
\end{Condition}

% Attempt 2
\begin{Condition}
Statement about the required process. \label{cond:test3}
\end{Condition}


Following from \ref{cond:test}, we have that\dots, but \ref{cond:test2} and \ref{cond:test3} are important also. 


\end{document}

ingrese la descripción de la imagen aquí

ActualizarUna versión con numeración (C1) como cabeza de 'teorema' con un entorno.

Puse los \setlistcambios de enumerate dentro del Conditionentorno de modo que otros usos de enumerateno tengan etiquetas de enumeración "extrañas".

\documentclass{article}
\usepackage{enumitem}

\newcounter{Condition}
\newenvironment{Condition}{%
\setlist[enumerate,1]{font={\itshape},leftmargin={40pt},label=(C\theCondition.\arabic*),ref=(C\theCondition.\arabic*)}%,before={\leavevmode}}
\parindent=0em
  \refstepcounter{Condition}%
  \textbf{(C\theCondition)} 

  %Explicit newline above
}{%
}

\usepackage{hyperref}
\usepackage{cleveref}

\makeatletter
\def\@grabconditioncounter\csname #1\endcsname{%
  (C\csname#1\endcsname)%
}
\renewcommand\p@Condition{\@grabconditioncounter}
\makeatother

\begin{document}
\begin{Condition}
\begin{enumerate}
\item Statement about the required process. \label{cond:test}

\item Next statement about the required process. \label{cond:test2}
\end{enumerate}
\end{Condition}

% Attempt 2
\begin{Condition}
Statement about the required process. \label{cond:test3}
\end{Condition}


Following from \ref{cond:test}, we have that\dots, but \ref{cond:test2} and \ref{cond:test3} are important also. 

\begin{enumerate}
\item A 
\item B
\end{enumerate}


\end{document}

información relacionada