[Tex/LaTex] Theorem title formatting

theorems

I want to display a theorem title, it is simple:

\begin{theorem}[Name]

I get

Theorem 4.5 (Name).

but I don't like the dot at the end. I want it to look like this:

Theorem 4.5. (Name)

Can you help me with that?

Best Answer

The amsthm package allows you to define custom theorem styles, with custom heading specifications. To get the formatting you desire, you can define a new style, say custom, and then declare a theorem environment using that style. Here's an example:

\documentclass{article}
\usepackage{amsthm}

% Create a `custom` theorem style.
\newtheoremstyle{custom}
  {\topsep}   % Space above
  {\topsep}   % Space below
  {\itshape}  % Body font
  {0pt}       % Indent amount (empty value is the same as 0pt)
  {\bfseries} % Theorem head font
  {}          % Punctuation after theorem head
  {5pt plus 1pt minus 1pt} % Space after theorem head
  {\thmname{#1}\thmnumber{ #2}.\thmnote{ (#3)}} % Theorem head spec

% Create a `theorem` environment using the `custom` style.
\theoremstyle{custom}
\newtheorem{theorem}{Theorem}

\begin{document}

\begin{theorem}[Name]
This is the new theorem environment.
\end{theorem}

\end{document}