I have seen some nice functionality in the the latex files of certain math journals and I want to create that functionality in my own .tex file. Right now, I can write


and this will produce a numbered equation. Elsewhere, I can refer to "Equation \ref{eq:STUFF}," and it will take care of the numbering for me. Here is the new functionality I am looking for: I want to be able to write

   For example, this theorem is Theorem 2.5.1 because it is the first theorem in the fifth subsection of the second section.

I want to be able to write "Theorem \ref{thm:LATEX}" and have my PDF build with the numbers for the theorem's number in this format: [Section].[Subsection].[Item], in this case "2.5.1."

I also want to be able to toggle the numbering for unnumbered items such as a simple remark, or

     Proof of the above numbered theorem.

where I would refer to this as "proof of Theorem \ref{thm:LATEX}" and I would not want the item counter to count the proof, so that the item following the proof would be item "2.5.2"


\usepackage{graphicx}  % needed for figures
\usepackage{bm}        % for math
\usepackage{amssymb}   % for math

\title{{\LARGE{ \textbf{Proof of Latex}}}}

\author{\Large{Hodor P. Bojangleton}}




\section{SECTION 1}

Currently this starts with 0 because it is counting the chapters, but I only want to use sections and subsections.  I need to get rid of the counting for chapters.

Items in this space should be numbered 1.0.X

Here I create and equation with the "begin/end" syntax that I want for my new commands.


I want to add a zero for the subsection in the numbering of Equation \ref{eq:111}. 

\subsection{SUBSECTION 1.1}

Here we have the 0 chapter number than I want to get rid of.

Items in this space should be numbered 1.1.X

I want the item name and number to appear aesthetically like:\newline

\noindent {\Large \textbf{Theorem 1.1.1}} After I write "begin theorem" to mimic the "begin equation" functionality that I already have, I want the text I write between "begin" and "end" to show up on the same line as the large bold theorem header.\newline

\noindent {\Large \textit{Proof.}}  This is an unnumbered proof of the above theorem.\newline

\noindent {\Large \textbf{Lemma 1.1.2}} The item counter did not increment for the proof.

\section{SECTION 2}

Items in this space should be numbered 2.0.X

\subsection{SUBSECTION 2.1}

Items in this space should be numbered 2.1.X

\subsection{SUBSECTION 2.2}

Items in this space should be numbered 2.2.X

  • 1
    Use either amsthm or ntheorem, whichever you prefer. The documentation has many examples.
    – Davislor
    Apr 3, 2019 at 21:13
  • In the future, please indent code fragments with four spaces (or selecting them and then hitting the {} button in the post editor). It’d also help to make your examples minimal.
    – Davislor
    Apr 3, 2019 at 21:19
  • In particular, see section 2 of the ntheorem manual for information on the [section] option to \newtheorem and the \theoremnumbering, \theoremheaderfont and \theorembodyfont commands.
    – Davislor
    Apr 3, 2019 at 21:21
  • I've reformatted the code for you. @Davislor: why not make these good comments into an answer. Apr 3, 2019 at 21:35
  • Much better! I hope this answers your question.
    – Davislor
    Apr 3, 2019 at 23:35

1 Answer 1


You can accomplish this with the ntheorem package. The [section] option of newtheorem controls whether theorem labels contain a section number. See the ntheorem manual for details and more examples.

\usepackage[amsmath, thmmarks, thref]{ntheorem}

\defaultfontfeatures{Scale = MatchLowercase}
\setmathfont{Latin Modern Math}
\setmathfont[range=\QED]{XITS Math}




We will introduce theorem \thref{thm:112} shortly.  Wait for it!

\subsection*{The Theorem}\label{subsec:01}

\begin{Theorem}[An Exercise in Peano Arithmetic]\label{thm:112}[Theorem]
When I was young and brash, I would always ask on the first day of every math
class I took, “Is this where we finally learn why \(1+1=2\)?”

One day, a classmate said to me, “You \textbf{do} know that one plus one is \textbf{defined} as two?”

When I told this story later, it kicked off an argument over whether he should’ve said, “Two is defined as one plus one.”

Thus, by definition, \( 1 + 1 = 2 \).


Example theorem

This isn’t quite minimal, and I’ve taken a few liberties with your template. In particular, I loaded unicode-math and set the Q.E.D. symbol to the “tombstone” used in some editions of The Art of Computer Programming.

Adding the amsthm package option would allow you to use a proof environment within theorems.

Since this is a report, you could also start a \chapter.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .