10

I am using an continuous example in my text, but I don't know how to do define the corresponding nice environment.

I am using the amsmath and ntheorem package and defined my own example-environment:

\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{example}[theorem]{Example}

I am using the following documentclass:

\documentclass[11pt,a4paper,twoside,openright]{book}

What I would like is a possibility to continue the example maybe like this

\begin{example} \label{ex1}
 This is an example.
\end{example}

Some text stands here. And then there is some space between this and the continued example. 
Further should the continued example not be intended but start at the beginning of the line.

\begin{continuance}[\ref{ex1}]
This is the continued example.
\end{continuance}

Some more text, which should follow after a little vertical space.

With the result:

Example 1.1 This is an example.

Some text stands here. And then there is some space between this and the continued example. Further should the continued example not be intended but start at the beginning of the line.

Continuance of Example 1.1 This is the continued example.

Some more text, which should follow after a little vertical space.

How can I define this continuance-environment?

Edit: The problem now is that it looks like this

Example 1.1 This is an example.

Some text stands here. And then there is some space between this and the continued example. Further should the continued example not be intended but start at the beginning of the line.
[Here is an indention] Continuance of Example 1.1 This is the continued example.
Some more text, which should follow after a little vertical space.

egreg
  • 1,121,712
Jana
  • 2,254
  • 6
  • 21
  • 32

2 Answers2

9

You can use \newtheorem*:

\documentclass{book}
\usepackage{amsthm}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{example}[theorem]{Example}
\newtheorem*{continuancex}{Continuance of Example \continuanceref}
\newenvironment{continuance}[1]
  {\newcommand\continuanceref{\ref{#1}}\continuancex}
  {\endcontinuancex}

\begin{document}
\chapter{Title}
\begin{example} \label{ex1}
 This is an example.
\end{example}

Some text stands here. And then there is some space between this and the continued example.
Further should the continued example not be intended but start at the beginning of the line.

\begin{continuance}{ex1}
This is the continued example.
\end{continuance}

Some more text, which should follow after a little vertical space.
\end{document}

In this way you'll be using the overall theorem style.


The following version works with ntheorem

\documentclass{book}
\usepackage{ntheorem}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{example}[theorem]{Example}
\newcommand{\continuanceref}{}
\newtheorem{continuancex}{Continuance of Example}
\renewcommand{\thecontinuancex}{\continuanceref}
\newenvironment{continuance}[1]
  {\renewcommand\continuanceref{\ref{#1}}\continuancex}
  {\endcontinuancex}

\begin{document}
\chapter{Title}
\begin{example} \label{ex1}
 This is an example.
\end{example}

Some text stands here. And then there is some space between this and the continued example.
Further should the continued example not be intended but start at the beginning of the line.

\begin{continuance}{ex1}
This is the continued example.
\end{continuance}

Some more text, which should follow after a little vertical space.
\end{document}

Here's a working version for babel

\documentclass{book}
\usepackage[english]{babel}
\usepackage{ntheorem,refcount}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{example}[theorem]{Example}
\newtheorem{continuancex}{Continuance of Example}
\renewcommand{\thecontinuancex}{\continuanceref}
\newenvironment{continuance}[1]
  {\edef\continuanceref{\getrefnumber{#1}}\begin{continuancex}}
  {\end{continuancex}}

\begin{document}
\chapter{Title}
\begin{example}\label{ex1}
 This is an example.
\end{example}

Some text stands here. And then there is some space between this and the continued example.
Further should the continued example not be intended but start at the beginning of the line.

\begin{continuance}{ex1}
This is the continued example.
\end{continuance}

Some more text, which should follow after a little vertical space.
\end{document}
egreg
  • 1,121,712
6

needs two LaTeX runs for correct references:

\documentclass[11pt,a4paper,twoside,openright]{book}
\usepackage{amsmath}
\newtheorem{theorem}{Theorem}[chapter]
\newtheorem{example}[theorem]{Example}
\newenvironment{continuance}[1]
  {\par\bigskip\noindent\textbf{Continuence of Example #1. }\itshape}
  {\par}
\begin{document}

\begin{example} \label{ex1}
 This is an example.
\end{example}

Some text stands here. And then there is some space between this and the continued example. 
Further should the continued example not be intended but start at the beginning of the line.

\begin{continuance}{\ref{ex1}}
This is the continued example.
\end{continuance}

\end{document}

enter image description here

  • This is almost perfect. How do I get 'This is the continued example.' to be also written emphasized? – Jana Aug 26 '12 at 10:33
  • use \textsc{Continuence of Example \ref{#1}. }\itshape in the definition –  Aug 26 '12 at 11:14
  • I am sorry but it doesn't work. I tried \newenvironment{continuance}[1] {\textsc{Continuence of Example \ref{#1}. }} {\itshape} and \newenvironment{continuance}[1] {\textsc{Continuence of Example \ref{#1}. }} \itshape. – Jana Aug 26 '12 at 11:25
  • Furthermore it is intended but there is no space above. I would like space above and no indention. How can I do that? – Jana Aug 26 '12 at 11:45
  • see my edited answer for \itshape. And what is indented? Advance your example code in the question to a complete document that shows what's going wrong. –  Aug 26 '12 at 11:46
  • @Jana: see my edited answer –  Aug 26 '12 at 12:57