4

The following code can remove the trailing dot from all theorem environments.

\makeatletter
\xpatchcmd{\@thm}{\thm@headpunct{.}}{\thm@headpunct{}}{}{}
\makeatother

See Remove dot after theorem with amsthm and hyperref

The issue here is a bit different. Sometimes we only need to remove the dot from certain theorem environments, such as definitions and the text within the "sta" environment below.

\documentclass{article}
\usepackage{amsthm}
\usepackage{xpatch}
\newtheorem{theorem}{Theorem}
\newtheorem{definition}{Definition}

\newtheorem{sta}{\normalfont} \renewcommand{\thesta}{(\arabic{sta})\unskip}

\makeatletter \xpatchcmd{@thm}{\thm@headpunct{.}}{\thm@headpunct{}}{}{} \makeatother \begin{document}

\begin{definition} A {\it cycle} in a graph is a non-empty trail in which only the first and last vertices are equal. \end{definition}

\begin{theorem} An undirected graph is bipartite if and only if it does not contain an odd cycle. \end{theorem}

First, we note that: \begin{sta}\label{seesall} Every bipartite graph contains no odd cycles. \end{sta}

This prove \ref{seesall}. \end{document}

enter image description here

licheng
  • 773
  • 2
    Unrelated, note that this has been wrong in LaTeX siden the early 90s: {\it cycle}. Use \emph{cycle} as it adjusts it self if the context is italic and includes italic correction (AFAIR). – daleif Jan 08 '24 at 14:33
  • 1
    I do not understand why one would even remove the dot. It is there for a reason. – daleif Jan 08 '24 at 14:33
  • @daleif Sure, they should be consistent. My question may be a bit deliberate. I mainly want to see if there are ways to modify them for specific circumstances. – licheng Jan 08 '24 at 16:36

2 Answers2

6

I'm not sure why you wouldn't want the period in definitions. I see no reason for breaking the uniformity.

Anyway, the correct way is to define suitable theorem styles.

\documentclass{article}
\usepackage{amsthm}

% see https://tex.stackexchange.com/a/17555/4427 \newtheoremstyle{definitionnoperiod} {\topsep} % ABOVESPACE {\topsep} % BELOWSPACE {\normalfont} % BODYFONT {0pt} % INDENT (empty value is the same as 0pt) {\bfseries} % HEADFONT {} % HEADPUNCT {5pt plus 1pt minus 1pt} % HEADSPACE {} % CUSTOM-HEAD-SPEC \newtheoremstyle{empty} {\topsep} % ABOVESPACE {\topsep} % BELOWSPACE {\itshape} % BODYFONT {0pt} % INDENT (empty value is the same as 0pt) {\normalfont} % HEADFONT {} % HEADPUNCT {5pt plus 1pt minus 1pt} % HEADSPACE {\thmnumber{#2}} % CUSTOM-HEAD-SPEC

\newtheorem{theorem}{Theorem}

\theoremstyle{definitionnoperiod} \newtheorem{definition}{Definition}

\theoremstyle{empty} \newtheorem{sta}{} \renewcommand{\thesta}{(\arabic{sta})}

\begin{document}

\begin{definition} A \emph{cycle} in a graph is a non-empty trail in which only the first and last vertices are equal. \end{definition}

\begin{theorem} An undirected graph is bipartite if and only if it does not contain an odd cycle. \end{theorem}

First, we note that: \begin{sta}\label{seesall} Every bipartite graph contains no odd cycles. \end{sta}

This proves \ref{seesall}. \end{document}

enter image description here

Please, note that {\it cycle} is wrong for two reasons:

  1. \it has been deprecated for about 30 years;
  2. the higher level \emph command is the choice for such cases.
egreg
  • 1,121,712
2
\documentclass[12pt]{article}
\usepackage{mathtools,amsthm,amssymb}

\newtheorem{theorem}{Theorem}

\newtheoremstyle{definitionstyle}% name
  {0pt}% space above
  {0pt}% space below
  {}% body font
  {}% indent amount
  {\bfseries}% theorem head font
  {}% punctuation after theorem head
  {0.5em}% space after theorem head
  {}% theorem head spec

\theoremstyle{definitionstyle}
\newtheorem{definition}{Definition}


\begin{document}

\begin{definition}
A function $f: A \to \mathbb{R}$ is said to be \emph{continuous at a point} $c$ in its domain $A$ if, for every $\epsilon > 0$, there exists a $\delta > 0$ such that for all $x$ in $A$, if $|x - c| < \delta$, then $|f(x) - f(c)| < \epsilon$.
\end{definition}

\begin{theorem}
If $f: [a, b] \to \mathbb{R}$ is continuous on $[a, b]$ and differentiable on $(a, b)$, then there exists at least one $c$ in $(a, b)$ such that
\[ f'(c) = \frac{f(b) - f(a)}{b - a}. \]
\end{theorem}

\end{document}

enter image description here

Sebastiano
  • 54,118