# How to end an unnumbered subsection?

I cannot find a way to end an unnumbered subsection. I either have an unnumbered subsection \subsection*{} with no end or an environment

\begin{subsection}
This is some arbitrary content.
\end{subsection}


that is numbered. Here is a MWE:

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{amsthm}
\newtheorem{theoreme}{Théorème}
\begin{document}
\section{First section}
\subsection*{Unnumbered subsection}
Here comes some content that should be in First section but not in the Unnumbered subsection
\begin{theoreme}
This is some arbitrary content. the theoremes number should correspond with the First section but not with the "Unnumbered subsection".
\end{theoreme}
\section{Second section}
\end{document}


The question is how to make everything comming before the Second section but after the Unnumbered subsection not part of the Unnumbered subsection.

• LaTeX2e subsections are always commands not _environments: there is not really an 'end subsection' concept at all! – Joseph Wright Apr 9 '14 at 13:34
• To amplify Joseph's comment, the \subsection will "end" (in a logical sense only) when you issue the next \section, or \subsection. You could also dive deeper into a \subsubsection. – Steven B. Segletes Apr 9 '14 at 13:36
• thank you, does that really mean that I actually cannot to get back to the section in which the unnumbered subsection is, whitout opening a new section or subsection? – Eliz Apr 9 '14 at 13:42
• Welcome to TeX.SX! The question is of high quality. You can have a look at our starter guide to familiarize yourself further with our format. – strpeter Apr 9 '14 at 13:46
• Well, yes. I have a feeling though that you are trying to effect something that is still very much possible, just maybe not in the way that you'd immediately expect. What problem are you actually trying to solve? (See meta.stackexchange.com/q/66377.) – Sean Allred Apr 9 '14 at 13:51

LaTeX does not directly regard \section(s) etc as having "ends": a section "ends" when a new section begins. So \section{} and its ilk are not environments, but commands which mark the beginning of a new section.

What you are really concerned about here is with the way counters are used in labels. But in this your question seems to be under a misapprehension, or perhaps a number of misapprehensions.

In general, if you use a combination of \label{} and \ref{} to refer back to a section number, the number used will be the last number set. So if, for instance, you have:

\section{Numbered}% <- Section 1
...
\section*{Unnumbered}% <- No number
... \label{mylabel}
... See section \ref{mylabel}


You will still get a reference to "section 1". (If you set the label without any section having been used, you would get no reference: but what is LaTeX to do!.)

If you have, as you suggest, a subsection that is unnumbered, the behaviour is similar. If, before your unnumbered subsection there is a numbered subsection, then the label will refer to that -- i.e. the unnumbered subsection is treated as if it didn't exist.

\section{Numbered}% <- Section 1
\subsection{Numbered}% <- Subs 1.1
...
\subsection*{Unnumbered}%
\label{mylabel}
...
See subsection \ref{mylabel}


You will get "subsection 1.1". In other words, the unnumbered section or subsection commands don't "reset" anything, they just leave the label intact. If, however, you had the unnumbered subsection first, you would get just a reference to the section.

\section{Numbered}% <- Section 1
\subsection*{Unnumbered}%
\label{mylabel}
...
See subsection \ref{mylabel}


would give you "subsection 1".

In other words An unnumbered heading leaves the counters unchanged: you will get whatever reference was "active" immediately before the unnumbered heading, and no reference is none was active.

This means, in fact, that if you had a numbered section and subsection "active" (let's suppose your counters were sitting at "1.3") and then start a new unnumbered section, a reference within that unnumbered subsection will still be "1.3".

Odd as this all seems, most of the time it makes reasonable sense, and in fact in your example it probably does more or less what you want it to. A reference within the unnumbered subsection will just give you a reference to the section. This is probably, usually, correct. In any case, it's not clear what "the right thing" to do with mixtures of numbered and unnumbered sections is, and if you have unnumbered sections you should probably be referring to pages anyway!

Now your theorem is a different story. In principle, a theorem has a counter which is quite independent of the section in which it appears. In your MWE, the théorème will be numbered 1 because it is the first theorem, no matter that it appears in an unnumbered subsection.

You can, however, set your theorems up so that the numbering resets with each section.

\newtheorem{theoreme}{Théorème}[section]


If you do that, then:

• The subsection makes no difference, so in your MWE the theorems will be numbered 1.1, 1.2 etc, even if they come in unnumbered subsections.
• An unnumbered section would leave the counter unchanged, so that the numbering would continue from the previous section. So ...

\newtheorem{theoreme}{Théorème}[section]
\section{One}
\begin{theoreme}
Theorem numbered 1.1
\end{theoreme}
\section*{Unnumbered}
\begin{theoreme}
Theorem numbered 1.2, because section was not reset.
\end{theorem}

• If you start a theorem before any numbered section has begun, it will get numbered 0.1, etc.

If you decided to include subsection numbering in your theorems and then mix numbered and unnumbered subsections, your readers will probably kill you, but in principle the same approach will be taken: the previous (numbered) subsection counter will be applied until a new numbered subsection begins.