# \begin{proof} and \begin{problem} don't work in new section

I've encountered with the following problem. So in my document, I defined the new theorem environment problem, using the following preamble codes

\theoremstyle{plain}
\newtheorem{eg}[theorem]{Example}

\theoremstyle{definition}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{problem}[theorem]{Problem}


And the code work for the first three sections. But when I add the fourth section, the \begin{problem} command instead of giving me something like in the following figure, it gives me this The same problem also happened with the proof environment. I want to get this (by using the command \begin{proof}[Euler's argument]) but this is what I got The weird thing here is that this problem only occurs in the section fourth, not with the first three sections.

That's my problem. I'd be really appreciate if someone can help me resolve this. Thanks in advanced.

PS. Just in case, here is my full preamble

\documentclass[12pt]{article}
\usepackage{amsmath,amssymb,amsthm,amscd,graphicx,enumerate}
\usepackage{asymptote}

\usepackage{graphicx}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz,tkz-tab}
\usepackage{tkz-euclide}
\usetkzobj{all}

\usepackage{thmtools}
\usepackage[framemethod=TikZ]{mdframed}

\mdfdefinestyle{mdwhitebox}{%
roundcorner = 10pt,
linewidth=1pt,
skipabove=12pt,
innerbottommargin=9pt,
skipbelow=2pt,
linecolor=black,
nobreak=true,
backgroundcolor=White!5,
}
\declaretheoremstyle[
mdframed={style=mdwhitebox},
]{lembox}

\mdfdefinestyle{mdrecbox}{%
linewidth=0.5pt,
skipabove=12pt,
frametitleaboveskip=5pt,
frametitlebelowskip=0pt,
skipbelow=2pt,
frametitlefont=\bfseries,
innertopmargin=4pt,
innerbottommargin=8pt,
nobreak=true,
backgroundcolor=White!5,
}
\declaretheoremstyle[
mdframed={style=mdrecbox},
]{defbox}

\mdfdefinestyle{mdbluebox}{%
roundcorner = 10pt,
linewidth=1pt,
skipabove=12pt,
innerbottommargin=9pt,
skipbelow=2pt,
linecolor=blue,
nobreak=true,
backgroundcolor=TealBlue!5,
}
\declaretheoremstyle[
mdframed={style=mdbluebox},
]{thmbluebox}

\declaretheorem[style=thmbluebox,name=Theorem,numberwithin=section]{theorem}
\declaretheorem[style=defbox,name=Definition,numberwithin=section]{defn}
\declaretheorem[style=lembox,name=Lemma,sibling=theorem]{lemma}

\newenvironment{soln}{\begin{proof}[Solution]}{\end{proof}}

\theoremstyle{plain}
\newtheorem{eg}[theorem]{Example}

\theoremstyle{definition}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{problem}[theorem]{Problem}

\numberwithin{equation}{section}

\oddsidemargin 0in
\textwidth 6.5in
\textheight 9in
\topmargin 0in

\usepackage{xcolor}

\newcommand{\vocab}[1]{\textbf{\color{blue} #1}}


EDIT 1: Here's the MWE that people are asking for.

\documentclass[12pt]{article}
\usepackage{amsmath,amssymb,amsthm,amscd,graphicx,enumerate}
\usepackage{asymptote}

\usepackage{graphicx}
\usepackage[dvipsnames]{xcolor}
\usepackage{tikz,tkz-tab}
\usepackage{tkz-euclide}
\usetkzobj{all}

\usepackage{thmtools}
\usepackage[framemethod=TikZ]{mdframed}

\mdfdefinestyle{mdwhitebox}{%
roundcorner = 10pt,
linewidth=1pt,
skipabove=12pt,
innerbottommargin=9pt,
skipbelow=2pt,
linecolor=black,
nobreak=true,
backgroundcolor=White!5,
}
\declaretheoremstyle[
mdframed={style=mdwhitebox},
]{lembox}

\mdfdefinestyle{mdrecbox}{%
linewidth=0.5pt,
skipabove=12pt,
frametitleaboveskip=5pt,
frametitlebelowskip=0pt,
skipbelow=2pt,
frametitlefont=\bfseries,
innertopmargin=4pt,
innerbottommargin=8pt,
nobreak=true,
backgroundcolor=White!5,
}
\declaretheoremstyle[
mdframed={style=mdrecbox},
]{defbox}

\mdfdefinestyle{mdbluebox}{%
roundcorner = 10pt,
linewidth=1pt,
skipabove=12pt,
innerbottommargin=9pt,
skipbelow=2pt,
linecolor=blue,
nobreak=true,
backgroundcolor=TealBlue!5,
}
\declaretheoremstyle[
mdframed={style=mdbluebox},
]{thmbluebox}

\declaretheorem[style=thmbluebox,name=Theorem,numberwithin=section]{theorem}
\declaretheorem[style=defbox,name=Definition,numberwithin=section]{defn}
\declaretheorem[style=lembox,name=Lemma,sibling=theorem]{lemma}

\newenvironment{soln}{\begin{proof}[Solution]}{\end{proof}}

\theoremstyle{plain}
\newtheorem{eg}[theorem]{Example}

\theoremstyle{definition}
\newtheorem{remark}[theorem]{Remark}
\newtheorem{problem}[theorem]{Problem}

\numberwithin{equation}{section}

\oddsidemargin 0in
\textwidth 6.5in
\textheight 9in
\topmargin 0in

\usepackage{xcolor}

\newcommand{\vocab}[1]{\textbf{\color{blue} #1}}

\begin{document}
\title{Notes}
\author{}
\date{}
\maketitle

\tableofcontents
\eject

\section{Section 1}

\begin{problem}
Works fine here
\end{problem}

\newpage

\section{Section 2}

\begin{problem}
Works fine here
\end{problem}

\newpage

\section{Section 3}

\begin{problem}
Works fine here
\end{problem}

\begin{remark}
A tikz diagram
\begin{center}
\begin{tikzpicture}
\tkzInit[xmin=-0.8,ymin=-1.3,xmax=5.2,ymax=1.3]
\tkzAxeX[
label=\hspace{4mm}{$x$},
very thick, % increase width of axes lines
label options={font=\Large}, % increase font size
orig=false % don't print zeros
]

\tkzAxeY[
label=\raisebox{4mm}{$y$},
very thick, % increase width of axes lines
label options={font=\Large,}, % increase font size
orig=false % don't print zeros
]

\draw (0,1)--(2,1)--(2.5,-1)--(3,1)--(10/3,-1)--(11/3,1)--(4,1)--(17/4,-1)--
(18/4,1)--(19/4,-1)--(5,1);
\end{tikzpicture}
\end{center}
Something happen after this tikz diagram
\end{remark}

\section{Test}

\begin{problem}
Fails here
\end{problem}

\end{document}

• please provide small, but complete document (mwe: minimal working example), which demonstrate your problem. preamble limit to only to relevant packages and your definitions. without a mwe we can only guess what is cause of your problem. does for example \begin{proof} is terminated by \end{proof}? – Zarko Jun 9 '18 at 3:33
• Off-topic: Loading packages more than once doesn't make them work twice as well. It should be avoided. Consider using e.g. geometry. On-topic: there is something wrong with the code you've not shown us. – cfr Jun 9 '18 at 4:06
• it's the \tkzInit[xmin=-0.8,ymin=-1.3,xmax=5.2,ymax=1.3] that's having a global effect – David Carlisle Jun 9 '18 at 7:56
• Possibly related: tex.stackexchange.com/a/305196/226 and tex.stackexchange.com/a/211182/226. The first solution solves only the proof and not for custom-declared theorem environments; the second solutions seems to work well. tkz-euclide and tkz-fct are by the same author, so they may both be suffering from the same problem. – imnothere Jun 9 '18 at 13:53