# change the style of numbering the theorem, definition in sections

enter code hereCould you help me please to create a paper which appears in the following way:

The Newton's Law - section

1 Definition - \begin{definition} \end{definition}

2 Theorem - \begin{theorem} \end{theorem}

The conjecture of Poincare - section

1 Definition - \begin{definition} \end{definition}

2 Theorem - \begin{theorem} \end{theorem}

For me it is hard to create different sections which have same numbering, and also to put the number in front of the theorem or of the definition. Thanks!

\documentclass[a4paper,12pt]{article}
\usepackage{amsfonts}
\usepackage{amssymb}
%\usepackage{amsthm}
\usepackage{mathrsfs}
\usepackage{amsmath}
\usepackage[usenames,dvipsnames]{color}
\usepackage{color,graphicx}
\usepackage{algorithmic}
\usepackage{algorithm}
\usepackage{hyperref}

\usepackage{variations}
\usepackage[romanian]{babel}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{graphicx}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern,amsthm}
\swapnumbers
\newtheorem{definition}{Definition}
\newtheorem{theorem}[definition]{Theorem}
\let\origsection\section
\renewcommand\section{\setcounter{definition}{0}\origsection}
\newtheorem{lemma}[theorem]{Lem\u a}

\newtheorem{corollary}[theorem]{Corolar}
\newtheorem{proposition}[theorem]{Not\u a}

%\theoremstyle{definition}

\theoremstyle{remark}
\newtheorem{remark}[theorem]{Consecin\c t\u a}
\newtheorem{example}[theorem]{Exemplul}
\newtheorem*{acknowledgements}{Observa\c{t}ie}

• Will the sections themselves be numbered, and should the section's number be included in the number of the definitions and theorems? – Mico Mar 2 '14 at 20:37
• the section's number won't be included in the number of definitions and theorems – Iuli Mar 2 '14 at 20:42
• If you replace the instances of [theorem] with [definition], you'll get what you're looking for. Also, do remember to load the hyperref package last. – Mico Mar 3 '14 at 6:27

One way to achieve your objective would be to (i) make sure that the definition and theorem environments share the same counter and (ii) redefine the \section command in a way that resets this counter to 0, regardless of whether the sections are numbered or not. The example below does these things, while using the amsthm package.

\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{lmodern,amsthm}
\swapnumbers % place definition/theorem number *before* name
\newtheorem{definition}{Definition}
\let\origsection\section % save the original section definition
\renewcommand\section{\setcounter{definition}{0}\origsection}

\begin{document}
\section*{Newton's Law}
\begin{definition}[Here we go] bla bla bla\end{definition}
\begin{theorem}[Deep thoughts] more bla bla \end{theorem}

\section*{The Poincaré Conjecture}
\begin{definition}[More to say] bla bla bla\end{definition}
\begin{theorem}[Random thoughts] Still more bla bla \end{theorem}

\end{document}

• don't work. I will add in my question the beginning of my latex program. – Iuli Mar 2 '14 at 21:13
• It's crucial to key all theorem-like environments to the same counter. In my answer, it's the counter of the definition counter. What happens if you key all environments to the counter named definition (rather than, say, theorem). – Mico Mar 2 '14 at 21:22