When I modified the \newtheoremstyle
last parameter to get a list for a listoftheorems new command I want to define later, I got some unpleasant side effects I want to get rid of.
First unwanted side effect a blank space between the period and the theorem body or number appears !
Second unwanted side effect the period after the lemma name (which is in normal font when there is one) appears in bold not in normal font when there is an optional name for the lemma. And I want it to be in bold when there is no name.
Third unwanted side effect the name of the theorem is no more in normal font but get the same font than Theorem word (here, in small cap). I do not want this.
What should I do? Below is a MWE
\documentclass{amsbook}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{etoolbox}
\newtheoremstyle{mytheorem}
{6pt plus 0pt minus 2pt}
{0pt plus 0pt minus 2pt}
{\slshape}
{}{\scshape}
{.}
{5pt plus 1pt minus 1pt}
{\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}
\ifstrempty{#3}%
{\addcontentsline{def}{subsection}{#1~\thethm}}%
{\addcontentsline{def}{subsection}{#1~\thethm~(#3)}}}
\newtheoremstyle{mylemma}
{6pt plus 0pt minus 2pt}
{0pt plus 0pt minus 2pt}
{\slshape}
{}
{\bfseries}
{.}
{5pt plus 1pt minus 1pt}
{}
\theoremstyle{mytheorem}
\newtheorem{thm}{Theorem}
\theoremstyle{mylemma}
\newtheorem{lem}{Lemma}
\begin{document}
\begin{thm}
Bad effect
\end{thm}
\begin{thm}[Wrong2]
Double Bad effect
\end{thm}
\begin{lem}[Wrong4]
Bad effect
\end{lem}
\begin{lem}
Good
\end{lem}
\end{document}
\textsc
), not slanted. please clarify. (2) the extra spaces can be got rid of by adding%
at the end of all lines in the\newtheoremstyle
definition. (i don't think this should be necessary, but haven't yet investigated why it's happening.) (3) i am making a note that there's a request for the possibility of adding a "list of theorems"; providing such a facility could make these gymnastics unnecessary.