Point manquant dans l'énumération des théorèmes

Sep 04 2020

J'utilise llncs(pas article!) Au fur \documentclasset à mesure des amspackages. Et maintenant, la numérotation ne fonctionne pas. Il est possible d'utiliser simplement \begin{theorem} et de numéroter mes théorèmes 1,2, ..., mais pas en ajoutant \newtheorem{mytheorem}{Theorem}[section]et \begin{mytheorem}car cela donne des choses comme 11,12,21,22 - sans point. Ce que je préfère évidemment, ce serait 1.1 ou même 1.1.1. Et un \renewcommandthéorème sur ne conduit qu'à TeXêtre stupide: l'erreur n'existe pas. Très bien, alors \newcommand:

Erreur, existe. (Soit cela a à voir avec que TeX a quelque chose d'un maître Zen, soit que \ newtheorem a des paramètres :-) MWE:

\documentclass[10pt,a4paper]{llncs}
\usepackage{amsmath}
\newtheorem{mytheorem}{Theorem}[section]
\begin{document}
\section{foo}
\begin{mytheorem} 
\end{mytheorem} 
\begin{theorem} 
\end{theorem} 
\section{bar}
\begin{mytheorem} 
\end{mytheorem} 
\begin{theorem} 
\end{theorem} 
\end{document}

Réponses

2 egreg Sep 04 2020 at 19:21

La llncsclasse a sa propre méthode pour définir des environnements de type théorème, en utilisant \spnewtheorem.

\documentclass[10pt,a4paper,envcountsect]{llncs}
\usepackage{amsmath}

%     \spnewtheorem{env_nam}{caption}[within]{cap_font}{body_font}
% or  \spnewtheorem{env_nam}[numbered_like]{caption}{cap_font}{body_font}
% or  \spnewtheorem*{env_nam}{caption}{cap_font}{body_font}

\spnewtheorem{mytheorem}{Theorem}[section]{\bfseries}{\itshape}

\begin{document}

\section{foo}

\begin{mytheorem}
Some text.
\end{mytheorem} 

\begin{theorem} 
Some text.
\end{theorem} 

\section{bar}

\begin{mytheorem} 
Some text.
\end{mytheorem} 

\begin{theorem} 
Some text.
\end{theorem} 

\end{document}