Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle beamer's \qedsymbol #17

Open
muzimuzhi opened this issue Oct 7, 2020 · 1 comment
Open

Handle beamer's \qedsymbol #17

muzimuzhi opened this issue Oct 7, 2020 · 1 comment
Labels
bug Something isn't working

Comments

@muzimuzhi
Copy link
Owner

beamer has

\def\qedsymbol{\leavevmode\hbox{\usebeamertemplate*{qed symbol}}}

This makes

\declaretheoremstyle[qed=\qedsymbol]{my style}

fail because currently thmtools does

\define@key{thmdef}{qed}[\qedsymbol]{%
\thmt@trytwice{}{%
\addtotheorempostheadhook[\thmt@envname]{%
\protected@edef\qedsymbol{#1}%
\pushQED{\qed}%
}%
\addtotheoremprefoothook[\thmt@envname]{%
\protected@edef\qedsymbol{#1}%
\popQED
}%
}%
}

See TeX-SX question https://tex.stackexchange.com/q/565808.

@muzimuzhi muzimuzhi added the bug Something isn't working label Oct 7, 2020
@muzimuzhi
Copy link
Owner Author

qed=<value> will redefine \qedsymbol to <value>. To allow input qed=\qedsymbol and avoid self-reference, currently thmtools uses \protected@edef\qedsymbol{<value>}. This makes strong assumption on not only the definition of \qedsymbol, but also the whole <value>.

A possible fix: always use mirrored \thmqedsymbol in qed=<value>

diff --git a/source/thm-amsthm.dtx b/source/thm-amsthm.dtx
index b45a6c2..3d6c081 100644
--- a/source/thm-amsthm.dtx
+++ b/source/thm-amsthm.dtx
@@ -137,14 +137,19 @@
 %  }
 }
 
+\@ifl@t@r\fmtversion{2020/10/01}
+  {\def\thmt@let{\DeclareCommandCopy}}
+  {\def\thmt@let{\let}}
+
 \define@key{thmdef}{qed}[\qedsymbol]{%
+  \thmt@let\thmqedsymbol\qedsymbol
   \thmt@trytwice{}{%
     \addtotheorempostheadhook[\thmt@envname]{%
-      \protected@edef\qedsymbol{#1}%
+      \def\qedsymbol{#1}%
       \pushQED{\qed}%
     }%
     \addtotheoremprefoothook[\thmt@envname]{%
-      \protected@edef\qedsymbol{#1}%
+      \def\qedsymbol{#1}%
       \popQED
     }%
   }%

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant