# Decompose theorems into parts

In the following code, the numbers of the theorem are 1 to 4. But I want to have the name wrote in the text : I want to decompose an hypothesis into many parts. I found some solution to have the two numerotation (number and letter) but I didn't find how to keep the number of the last theorem.

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{ntheorem}
\theoremseparator{:}
\newtheorem{hyp}{Hypothèse}

\begin{document}

\begin{hyp}
Hypothese 1
\end{hyp}

\begin{hyp}
Hypothese 2
\end{hyp}

\begin{hyp} %I have to change the environment
Hypothese 2 A
\end{hyp} %I have to change the environment

\begin{hyp} %I have to change the environment
Hypothese 2B
\end{hyp} %I have to change the environment
\end{document}


EDIT Here is the code of the first answer with a "new" problem : I have 4C 4D 4E instead of 4A 4B 4C

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{ntheorem}

\theoremseparator{:}
\newtheorem{hyp}{Hypothèse}

\newcounter{hyphelper}

\begin{document}

\begin{hyp}
Hypothese 1
\end{hyp}

\begin{hyp}
Hypothese 2
\end{hyp}

\makeatletter
\begingroup
\edef\hypval{\the\c@hyp}
\renewcommand{\thehyphelper}{\hypval\Alph{hyphelper}}

\let\thehyp\thehyphelper
\let\c@hyp\c@hyphelper

\begin{hyp}
Hypothese 2 A
\end{hyp}

\begin{hyp}
Hypothese 2B
\end{hyp}
\endgroup
\makeatother

\begin{hyp}
Hypothese 3
\end{hyp}

\begin{hyp}
Hypothese 4
\end{hyp}

\makeatletter
\begingroup
\edef\hypval{\the\c@hyp}
\renewcommand{\thehyphelper}{\hypval\Alph{hyphelper}}

\let\thehyp\thehyphelper
\let\c@hyp\c@hyphelper

\begin{hyp}
Hypothese 4 A
\end{hyp}

\begin{hyp}
Hypothese 4B
\end{hyp}
\begin{hyp}
Hypothese 4C
\end{hyp}
\endgroup
\makeatother

\end{document}


Here is the code with the accepted answer

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}

\usepackage{ntheorem}
\theoremseparator{:}
\newtheorem{hyp}{Hypothèse}
\newtheorem{hyp+}{Hypothèse}[hyp]
\expandafter\renewcommand\csname thehyp+\endcsname{\thehyp\Alph{hyp+}}

\begin{document}

\begin{hyp}
Hypothèse 1
\end{hyp}

\begin{hyp}
Hypothèse 2
\end{hyp}

\begin{hyp+}
Hypothèse 2A
\end{hyp+}

\begin{hyp+}
Hypothèse 2B
\end{hyp+}

\begin{hyp}
Hypothèse 3
\end{hyp}

\begin{hyp}
Hypothèse 4
\end{hyp}

\begin{hyp+}
Hypothese 4A
\end{hyp+}

\begin{hyp+}
Hypothese 4B
\end{hyp+}

\begin{hyp+}
Hypothese 4C
\end{hyp+}

\end{document}

• Your document misses \usepackage[utf8]{inputenc} – user31729 Sep 20 '17 at 18:20
• Oups ^^ It's an example and I forgot it. But this code works on my computer... – Ccile Sep 21 '17 at 9:29

## 2 Answers

The simplest way is to define a new environment.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[french]{babel}

\usepackage{ntheorem}
\theoremseparator{:}
\newtheorem{hyp}{Hypothèse}
\newtheorem{hyp+}{Hypothèse}[hyp]
\expandafter\renewcommand\csname thehyp+\endcsname{\thehyp\Alph{hyp+}}

\begin{document}

\begin{hyp}
Hypothèse 1
\end{hyp}

\begin{hyp}
Hypothèse 2
\end{hyp}

\begin{hyp+}
Hypothèse 2A
\end{hyp+}

\begin{hyp+}
Hypothèse 2B
\end{hyp+}

\begin{hyp}
Hypothèse 3
\end{hyp}

\end{document}


This is a way without additional packages, by storing the \c@hyp counter value and using another counter to be stepped, hyphelper.

\let\c@hyp\c@hyphelper 'forces' LaTeX to step hyphelper instead of hyp and \thehyphelper is formated as hypval\Alph{hyphelper} -- all used within a group in order to prevent 'pollution' of later hyp environments.

\documentclass[a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{ntheorem}

\theoremseparator{:}
\newtheorem{hyp}{Hypothèse}

\newcounter{hyphelper}

\begin{document}

\begin{hyp}
Hypothese 1
\end{hyp}

\begin{hyp}
Hypothese 2
\end{hyp}

\makeatletter
\begingroup
\edef\hypval{\the\c@hyp}
\renewcommand{\thehyphelper}{\hypval\Alph{hyphelper}}

\let\thehyp\thehyphelper
\let\c@hyp\c@hyphelper

\begin{hyp} %I have to change the environment
Hypothese 2 A
\end{hyp} %I have to change the environment

\begin{hyp} %I have to change the environment
Hypothese 2B
\end{hyp} %I have to change the environment
\endgroup
\makeatother

\end{document}


• The screen shot is from a previous version where I omitted \usepackage[utf8]{inputenc} – user31729 Sep 20 '17 at 18:22
• What is the difference between with and without inputenc ? With this solution, if I try to have another decomposed hypothesis the letter count continue with C D E instead of A B C (I edited the main post to give you the code I tested) – Ccile Sep 21 '17 at 12:13
• @Ccile: The difference is the missing é ;-) And the CDE is just because there is no resetting counter -- your question is not very clear regarding that, but you have made your decision already by unaccepting before providing the opportunity to react ... – user31729 Sep 21 '17 at 13:20
• Oups, there is an accent ^^ My question is not clear ? What is not clear ? You can always react... I accepted the other solution because it works but if you have more arguments, please I want to know them – Ccile Sep 21 '17 at 14:35