3

I've create an unnumbered amsthm environment problem, and a numbered amsthm environment example. Then I want to make the numbered example environment be unnumbered, so I typed \let\theexample=\relax (Why? Because I'm using a template that was already assigned the numbered example environment, and I just don't want to change the .cls file). Then I found that there's a space between the caption of the environment and the dot. So, how can I remove it?

The space between the caption and the dot.

The MWE is

\documentclass{article}

\usepackage{amsthm,lipsum} \theoremstyle{definition} \newtheorem*{problem}{Problem} \newtheorem{example}{Example}

\begin{document}

\begin{problem} \lipsum[6] \end{problem}

\begin{example} \lipsum[6] \end{example}

\let\theexample=\relax \begin{example} \lipsum[6] \end{example}

\end{document}

Axia
  • 514

2 Answers2

5

You can define a different environment, so you can also number other examples.

\documentclass{article}

\usepackage{amsthm,lipsum} \theoremstyle{definition} \newtheorem{problem}{Problem} \newtheorem{example}{Example} \newtheorem{example*}{Example}

\begin{document}

\begin{problem} \lipsum[6] \end{problem}

\begin{example} \lipsum[6] \end{example}

\begin{example} \lipsum[6] \end{example}

\end{document}

enter image description here

egreg
  • 1,121,712
4

Instead of messing with the example counter, you could use

\let\example\relax
\newtheorem*{example}{Example}

in your document to redefine the example environment as unnumbered theorem:

\documentclass{article}

\usepackage{amsthm,lipsum} \theoremstyle{definition} \newtheorem*{problem}{Problem} \newtheorem{example}{Example}

\let\example\relax \newtheorem*{example}{Example}

\begin{document}

\begin{problem} \lipsum[6] \end{problem}

\begin{example} \lipsum[6] \end{example}

\end{document}