[Tex/LaTex] Remove dot after theorem with amsthm and hyperref

amsthmpunctuationtheorems

I would like to know how to remove the dot that amsthm adds after the number of the theorem (it gives Theorem 1.1. instead of Theorem 1.1 ).

MWE:

\documentclass{article}
\usepackage{hyperref}
\newtheorem{theorem}{Theorem}[section]

\usepackage{xpatch}
\makeatletter
\xpatchcmd{\@thm}{\thm@headpunct{.}}{\thm@headpunct{}}{}{}
\makeatother

\begin{document}
\section{Introduction}

\begin{theorem}
Let ...
\end{theorem}

\end{document}

gives

enter image description here

while

\documentclass{article}
\usepackage{amsthm}
\usepackage{hyperref}
\newtheorem{theorem}{Theorem}[section]

\usepackage{xpatch}
\makeatletter
\xpatchcmd{\@thm}{\thm@headpunct{.}}{\thm@headpunct{}}{}{}
\makeatother

\begin{document}
\section{Introduction}

\begin{theorem}
Let ...
\end{theorem}

\end{document}

gives

enter image description here

It turns out that if \usepackage{hyperref} is not included, then adding

\usepackage{xpatch}
\makeatletter
\xpatchcmd{\@thm}{\thm@headpunct{.}}{\thm@headpunct{}}{}{}
\makeatother

fixes the problem, but when it is then the problem is still there.

I need to use amsthm but I don't want the dot to appear.

Thanks in advance.

Best Answer

\documentclass{article}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}[section]

\usepackage{xpatch}
\makeatletter
\xpatchcmd{\@thm}{\thm@headpunct{.}}{\thm@headpunct{}}{}{}
\makeatother

\begin{document}
\section{Introduction}

\begin{theorem}
Let ...
\end{theorem}

\end{document}

enter image description here


EDIT:

Including hyperref you have to use the patch at the beginning of the document, see texlive 2016 hyperref/cleverref incompatibility

\documentclass{article}
\usepackage{amsthm}
\usepackage{hyperref}
\newtheorem{theorem}{Theorem}[section]

\usepackage{xpatch}
\makeatletter
\AtBeginDocument{\xpatchcmd{\@thm}{\thm@headpunct{.}}{\thm@headpunct{}}{}{}}
\makeatother

\begin{document}
\section{Introduction}

\begin{theorem}
Let ...
\end{theorem}

\end{document}