Created
July 10, 2022 06:23
-
-
Save ponte-vecchio/8d48a1f33cfa33dd2f8ce40fcd547f6a to your computer and use it in GitHub Desktop.
How to have boxes around theorem heading
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| \documentclass{article} | |
| \usepackage{amsthm} | |
| \usepackage{mathpazo} | |
| \catcode`@=11 | |
| % Define a custom theorem style | |
| \newtheoremstyle{custom}{3pt}{3pt}{\rmfamily}{}{\scshape}{}{.5em}{} | |
| % Redefine thmhead | |
| % `fbox` is the key macro here. | |
| % Alternatives include `fcolorbox` if you want coloured box around the heading. | |
| \def\thmhead#1#2#3{% | |
| \fbox{% | |
| \thmname{#1}~% | |
| \thmnumber{\@ifnotempty{#1}{}\@upn{#2}}~% | |
| \thmnote{{\the\thm@notefont (#3)}}% | |
| }% | |
| } | |
| % Apply the new theorem style to a new theorem definition | |
| \theoremstyle{custom} | |
| \newtheorem{theorem}{Theorem} | |
| \catcode`@=12 | |
| \begin{document} | |
| \section{Some Section} | |
| \begin{theorem}[Euler] | |
| We have $e^{i\pi}=0$. | |
| \end{theorem} | |
| \begin{theorem}[Ferm\'at] | |
| We do not have $e^{i\pi}=0$. | |
| \end{theorem} | |
| \begin{theorem}[Chernik\'off] | |
| Do we have $e^{i\pi}=0$? | |
| \end{theorem} | |
| \end{document} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment