This is a follow-up to this question and this one. Basically, I would like to avoid the sequence ([...]) in theorem's optional arguments, as shown below:
To obtain this result, as suggested by this answer, I used the \patchcmd macro of the etoolbox package. However, I have to switch from
\patchcmd{\thmhead}{(#3)}{#3}{}{}
to
\patchcmd{\thmhead}{#3}{(#3)}{}{} on every change, which is not very convenient for a large book with many theorems. Thus I was wondering whether a single command would be possible. Note that I am using the two forms \cite{} and \cite[]{}, which makes things a bit more complex.
\documentclass[10pt]{article}
\usepackage[]{amsmath, amssymb, amsthm}
\newtheorem{theorem}{Theorem}[section]
\usepackage{etoolbox}% http://ctan.org/pkg/etoolbox
\begin{document}
\section{Pythagoras' theorem}
\noindent Correct versions:
\begin{theorem}[Pythagoras]
$a^2 + b^2 = c^2$.
\end{theorem}
\begin{theorem}[Pythagoras, \cite{Pythagoras}]
$a^2 + b^2 = c^2$.
\end{theorem}
\begin{theorem}[Pythagoras, {\cite[p.\ 345]{Pythagoras}}]
$a^2 + b^2 = c^2$.
\end{theorem}
\patchcmd{\thmhead}{(#3)}{#3}{}{}
\begin{theorem}[\cite{Pythagoras}]
$a^2 + b^2 = c^2$.
\end{theorem}
\begin{theorem}[{\cite[p.\ 21]{Pythagoras}}]
$a^2 + b^2 = c^2$.
\end{theorem}
\noindent To be avoided:
\patchcmd{\thmhead}{#3}{(#3)}{}{}
\begin{theorem}[\cite{Pythagoras}]
$a^2 + b^2 = c^2$.
\end{theorem}
\begin{theorem}[{\cite[p.\ 21]{Pythagoras}}]
$a^2 + b^2 = c^2$.
\end{theorem}
\begin{thebibliography}{HD}
\bibitem[1]{Pythagoras}
Pythagoras' theorem.
\end{thebibliography}
\end{document}

\listoftheorems). – Marijn Sep 09 '20 at 14:49\footcite? – Bernard Sep 09 '20 at 15:15