1

I'm currently trying to make the final amendments to a paper I've written and wondered if anyone could help.

I have a theorem and a number of definitions in a section (Section 4, for reference) and I want them labelled as :
Theorem 4.1,
Definition 4.2,
Definition 4.3, etc.

The issue is that it currently says Theorem 4.1 and then Definition 4.1, Definition 4.2 etc. How do I get it so that the labels are as stated above? i.e so that the Definition recognises the numbering of the previous Theorem?

I currently have

\documentclass[11pt, a4 paper]{article}        
\usepackage[utf8]{inputenc}        
\usepackage{geometry}        
\geometry{a4 paper, total={170mm, 257mm}, left=20mm, top=20mm,}        
\usepackage{amsthm}        
\usepackage{textcomp}        
\usepackage{amssymb}        
\usepackage{amsmath}        
\usepackage{tipa}        
\usepackage{graphicx}        
\usepackage{enumerate}        
\usepackage{ dsfont }        
\graphicspath{{Images/}}        
\newtheorem{theorem}{Theorem}[section]        
\theoremstyle{definition}        
\newtheorem{definition}{Definition}[section]        
\usepackage{soul}                

\tolerance=1
\emergencystretch=\maxdimen
\hyphenpenalty=10000
\hbadness=10000        

\begin{document}        
\maketitle        
\section{Section 4}        
\begin{theorem} Theorem \end{theorem}
\begin{definition} Definition \end{definition}                
\begin{definition} Definition \end{definition}                 
\end{document}         

I have tried to use \newtheorem{definition}[theorem]{definition}, as I read that this would fix the problem but instead it creates a new page at the start of my project that has "[theorem]definition" on it, and the rest of the page is blank.

Any advice or help would be greatly appreciated!!

AKCJ
  • 13
  • 1
    Welcome to TeX.SE. Do you have \usepackage{amsthm} as well? As far as I know the \newtheorem{}[]{} way is introduced by amsthm (and later by other packages as well) –  Mar 11 '17 at 18:28
  • yes, I have it included. Sorry, I must have forgotten to include it in my original question but have added it now. – AKCJ Mar 11 '17 at 18:32
  • And does it work then? –  Mar 11 '17 at 18:32
  • no it's still the same thing i'm afraid – AKCJ Mar 11 '17 at 18:34
  • Well, we have a rule here: Show compilable codes, not just fragments only ;-) –  Mar 11 '17 at 18:35
  • If nothing helps, try the approach in my answer to this question here: http://tex.stackexchange.com/questions/341473/continuous-counter-for-figures. Replace figure and table counters with definition and theorem –  Mar 11 '17 at 18:38
  • In my experience, this is usually an option to the journal style file. Which one are you using? – David Richerby Mar 11 '17 at 18:41
  • sorry for not including all the code, I'm new and didn't know that it was the norm to include all this, sorry! I hopefully have updated the question now – AKCJ Mar 11 '17 at 18:47
  • @AKCJ: Well, your 'document' contains typos etc, fixing that, \newtheorem{definition}[theorem]{Definition} works for me under TL 2016 –  Mar 11 '17 at 19:03
  • and can you tell me where these "typos etc" in my "document" are? as it's still not working for me - i've just told you I'm new so a little patience would be nice. – AKCJ Mar 11 '17 at 19:08
  • a4 paper and \maketitle without defining \title –  Mar 11 '17 at 21:19
  • Who toled you to set \tolerance=1 \emergencystretch=\maxdimen \hyphenpenalty=10000 \hbadness=10000? Are you trying to emulate MS Word?  ;-) – GuM Mar 11 '17 at 23:14

2 Answers2

2

As mentioned by @Christian Hupfer, try this code (I removed the \maketitle command since your code has no \title command):

\documentclass[11pt, a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{geometry}
\geometry{a4paper, total={170mm, 257mm}, left=20mm, top=20mm,}
\usepackage{amsthm}
\usepackage{textcomp}
\usepackage{amssymb}
\usepackage{amsmath}
\usepackage{tipa}
\usepackage{graphicx}
\usepackage{enumerate}
\usepackage{dsfont}
\graphicspath{{Images/}}
\newtheorem{theorem}{Theorem}[section]
\theoremstyle{definition}
\newtheorem{definition}[theorem]{Definition}
\usepackage{soul}

\tolerance=1
\emergencystretch=\maxdimen
\hyphenpenalty=10000
\hbadness=10000

\begin{document}

\setcounter{section}{3}
\section{Section 4}
\begin{theorem} Theorem. \end{theorem}
\begin{definition} A first definition. \end{definition}
\begin{definition} A second definition. \end{definition}
\begin{theorem} Another theorem. \end{theorem}

\end{document} 

enter image description here

Bernard
  • 271,350
1

Here's the way with establishing a group of coupled counters with xassoccnt, i.e. theorem, definition and lemma (just added that to show that it works for more than two counters) are coupled to form a group. If one of those counters is stepped, the other ones are increased as well in order to provide the same base.

\documentclass[11pt, a4 paper]{article}        
\usepackage[utf8]{inputenc}        
\usepackage{geometry}        
\geometry{a4paper, total={170mm, 257mm}, left=20mm, top=20mm,}        
\usepackage{amsthm}        
\usepackage{textcomp}        
\usepackage{amssymb}        
\usepackage{amsmath}        
\usepackage{tipa}        
\usepackage{graphicx}        
\usepackage{enumerate}        
\usepackage{dsfont}        
\usepackage{xassoccnt}
\graphicspath{{Images/}}        
\newtheorem{theorem}{Theorem}[section]        
\theoremstyle{definition}        

\newtheorem{definition}{Definition}[section]

\newtheorem{lemma}{Lemma}[section]

\DeclareCoupledCountersGroup{theorems}
\DeclareCoupledCounters[name=theorems]{theorem,definition,lemma}
\usepackage{soul}                

%\tolerance=1
%\emergencystretch=\maxdimen
%\hyphenpenalty=10000
%\hbadness=10000        

\begin{document}        
%\maketitle        
\section{Section 4}        
\begin{theorem} Theorem \end{theorem}
\begin{definition} Definition \end{definition}                
\begin{definition} Definition \end{definition}                 

\begin{lemma} Foo \end{lemma}                 
\end{document}  

enter image description here