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.

2
  • I have already tried the solution given there and it didn't work @samcarter
    – Minkowski
    Nov 8, 2016 at 16:36
  • The solution given there doesn't fix the problem here. Adding hyperref makes that solution not fix the problem @StefanPinnow
    – Minkowski
    Nov 8, 2016 at 17:20

1 Answer 1

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}
6
  • 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 8, 2016 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. Nov 8, 2016 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 8, 2016 at 17:04
  • 1
    @Minkowski For the 11th Doctor you get this new version of my anwser :) Nov 8, 2016 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 8, 2016 at 17:25

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .