11

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.

lockstep
  • 250,273
Minkowski
  • 365

1 Answers1

10
\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}
  • You were completely right. The MWE I wrote was fixed with the code you wrote, but in my thesis (where I have this problem) it wasn't fixed. I have been trying to see what is different and I have just found it: if \usepackage{hyperref} is added (I have this package in my thesis) then the problem is still there. How could I fix it? Thanks for your quick answer, by the way. – Minkowski Nov 08 '16 at 16:57
  • 1
    @Minkowski Just a guess: by changing the order the packages are loaded. But if you want a real answer, make a MWE that shows the problem. – samcarter_is_at_topanswers.xyz Nov 08 '16 at 17:00
  • I have just changed the question and the MWE. [The 11th Doctor is actually my Doctor, but the 12th is also fantastic] – Minkowski Nov 08 '16 at 17:04
  • 1
    @Minkowski For the 11th Doctor you get this new version of my anwser :) – samcarter_is_at_topanswers.xyz Nov 08 '16 at 17:15
  • Geronimo! You nailed it! Now it works perfecty. I have to tell you that I have been searching the solution to this problem for months. Thank you very much @samcarter . – Minkowski Nov 08 '16 at 17:25
  • @Minkowski You're welcome! A simple question that turned out to be more interesting than I first thought! – samcarter_is_at_topanswers.xyz Nov 08 '16 at 17:27