Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
add comment

2 Answers

up vote 7 down vote accepted

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}
share|improve this answer
    
Can this also be done with the package ntheorem? –  Jana Aug 26 '12 at 14:19
    
Yes, I'll add the suitable version –  egreg Aug 26 '12 at 15:35
    
Somehow this does not work when I also use the package babel with option english. Do you have any idea why that might be? –  Jana Aug 26 '12 at 16:13
1  
@Jana One more reason not to use ntheorem :) –  egreg Aug 26 '12 at 18:03
add comment

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

share|improve this answer
    
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 –  Herbert 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. –  Herbert Aug 26 '12 at 11:46
show 1 more comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.