muzimuzhi / thmtools

New home for LaTeX package bundle thmtools
LaTeX Project Public License v1.3c
16 stars 3 forks source link

thmbox key causes "Proof" to be repeated in proof environment #32

Closed mbertucci47 closed 1 year ago

mbertucci47 commented 1 year ago

Loading thmbox via the option to \declaretheorem causes "Proof" to be repeated in a proof environment. For example,

\documentclass{article}
\usepackage{amsthm,thmtools}
\declaretheorem[thmbox]{theorem}

\begin{document}

\begin{proof}
some text
\end{proof}

\end{document}

produces

Screenshot 2023-01-30 123639
muzimuzhi commented 1 year ago

Please check if the patch below works. thmtools forgot to undo thmbox's change to \\proof.

\documentclass{article}
\usepackage{amsthm,thmtools}

\usepackage{thmdef-thmbox}
\usepackage{xpatch}

\makeatletter
% patch key `thmbox` family `thmdef` defined in thmdef-thmbox.sty
\xpatchcmd\KV@thmdef@thmbox
  {\RequirePackage[nothm]{thmbox}}
  {% undo thmbox's modification to \\proof (undo \\example also?)
    \csletcs{old\@backslashchar proof}{\@backslashchar proof}%
    \RequirePackage[nothm]{thmbox}%
    \csletcs{\@backslashchar proof}{old\@backslashchar proof}%
  }
  {}{\PatchFailed}
\makeatother

\declaretheorem[thmbox]{theorem}

\begin{document}
\begin{proof}
  some text
\end{proof}
\end{document}
image
mbertucci47 commented 1 year ago

Indeed, fixes the issue. Thanks for the fast reponse!