In my project, in the section 1.1, I want to create a definition. When I use

\begin{definition} abc \end{definition}

the output goes as "Definition 1.11. abc"

I want to change the format of my definition to "1.1.1. Definition. abc"

How can I do that ? Thank you.

  • Do you use a package such as amsthm or ntheorem to help manage the appearance of theorem-like environments, including an environment named definition? If so, how do you define the definition environment, and is its definition (pun intended) tied to the definition of another theorem-like environment? Finally, is section "1.1" contained in chapter numbered "1"?
    – Mico
    Nov 23, 2023 at 4:53
  • yeah I use package amsthm, my section 1.1 is contained in chapter 1. So what I look for is just kind of 1.1.1. Definition. 1.1.2. Theorem. 1.1.3. Lemma. 1.1.4. Example ...
    – PermQi
    Nov 23, 2023 at 6:26

1 Answer 1


If you're using one of the standard document classes, your current preamble code likely contains an instruction similar to


I suggest you change it to


If that doesn't work for you (possibly because you use an uncommon document class), I suggest you execute


after setting up the theorem-like environments.

enter image description here

\documentclass{report} % or some other suitable document class

\theoremstyle{definition} % optional

%\counterwithin{theorem}{section} % alternate solution


\stepcounter{chapter} % just for this example

\begin{theorem}    aaa aaa \end{theorem}
\begin{lemma}      bbb bbb \end{lemma}
\begin{definition} ccc ccc \end{definition}
\begin{example}    ddd ddd \end{example}

  • how can I swtitch the number of the theorem to the front and then the word "Definition" goes to the back ? Like "1.1.1. Theorem." ?
    – PermQi
    Nov 23, 2023 at 9:01
  • @PermQi - Your follow-up question is answered in Section 4.2, "Number swapping", of the user guide of the amsthm package. To bring up the user guide in a pdf viewer, type texdoc amsthm at a command prompt. (Remark: Give executing \swapnumbers immediately after \usepackage{amsthm} a try. Observe that a period (aka full stop) will be placed after the name of the theorem-like environment rather than after the number.)
    – Mico
    Nov 23, 2023 at 9:06
  • I did just like your guidance and my output goes as "1.11 Definition. " The output is missing a dot in the number "1.11" while it should have been "1.1.1", and I don't know why. Maybe I did some code related to the counting inside the section. So how can I fix this without doing anything to the rest of my project ?
    – PermQi
    Nov 23, 2023 at 10:09
  • 1
    you are right, my problem is gone ! this is insane
    – PermQi
    Nov 23, 2023 at 12:16
  • 1
    wow thank you, I really appreciate. By the way your English is so good, I want to be that good too
    – PermQi
    Nov 23, 2023 at 20:46

You must log in to answer this question.

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