Q:

Extend theorem header with title by citation

How can I redefine the theorem style, so that I can provide two "optional" arguments (I'm fine with using \begin{Definition}[title]{} if no citation is wanted.)
I guess I'm quite flexible with the used package, right now I use \listtheorems{Definition} from ntheorem, but I'm unsure, if I want to keep this.
\documentclass{article}

\usepackage[amsthm,thmmarks,hyperref]{ntheorem}

\theoremstyle{definition}
\newtheorem{Definition}{Definition}[section]

\begin{document}
\begin{Definition}[title]
content
\end{Definition}

%goal:
\noindent\textbf{Definition 0.1 (title) \cite{testA}.} content

\cite{testA} %should not be bold here, so redefining \@cite wouldn't work?!

\begin{thebibliography}{9}
\bibitem{testA} Author A. Title A. 2019
\end{thebibliography}
\end{document}

A:

You can use the argument pattern syntax of \def to split the optional argument in two using a separator character. This is conceptually not very clean (it would be better to actually use a second optional argument) and has practical issues (you can't use the separator character in the title or in the cite key) but it may be sufficient for the intended application.
In the MWE below the command \thcite is defined that takes as argument a |, some characters, another |, some characters, and another |. In the definition of the new theorem style there is a test (using \IfSubStr from the xstring package) to see if there is a | in the optional argument. If so, the \thcite command is used (adding | characters at the start and end of the argument), if not then the argument is just repeated between parentheses. A Definition without optional argument is handled by the first part of the new theorem style which just prints the label name and number in bold.
If you want to use \listtheorems then the easiest solution is to use starred theorems (which do not appear in the list) for titles with a reference, and to add a separate line to the list with the correctly formatted list entry.
Code:
\documentclass{article}
\usepackage[colorlinks,allcolors=black]{hyperref}
\usepackage[amsthm,thmmarks,hyperref]{ntheorem}
\usepackage{xstring}

% addtheoremline for use with \listtheorems
\def\thcite|#1|#2|{(#1) \cite{#2}\addtheoremline{citedef}{#1 \cite{#2}}}

\makeatletter
\newtheoremstyle{citedef}%
{\item[\normalfont\bfseries \hskip\labelsep ##1 ##2\theorem@separator]\normalfont}%
{\item[\normalfont\bfseries \hskip\labelsep ##1 ##2 \IfSubStr{##3}{|}{\thcite|##3|}{(##3)}.\theorem@separator]\normalfont}%
\makeatother

\theoremstyle{citedef}

\newtheorem{citedef}{Definition}[section]

\begin{document}
\begin{citedef}
content
\end{citedef}

\begin{citedef}[title]
content
\end{citedef}

% starred environment for use with \listtheorems
\begin{citedef*}[title|testA]
content
\end{citedef*}

\cite{testA} %should not be bold here

\listtheorems{citedef}

\begin{thebibliography}{9}
\bibitem{testA} Author A. Title A. 2019
\end{thebibliography}
\end{document}

Result:

