I am trying to create a theorem-like environment that delivers a
theorem to be indented except for the first line, ie hanging indent:
Example 1.1. Bla bla
Bla bla
Bla bla
Is there something I could modify the following code to make it work?
\theoremstyle{definition}
\newtheorem{example}{Example}[section]
Alternatively, I tried with ntheorem (see below). However, I cannot
make the first line to be not indented.
\documentclass{article}
\usepackage{ntheorem}
\theoremstyle{plain} \theorembodyfont{\normalfont}
\theoremheaderfont{\bfseries} \theoremseparator{.}
\setlength\theoremindent{2cm}
\newtheorem{example}{Example}[section]
\begin{document}
\begin{example} bla bla bla bla bla bla bla bla bla
bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla bla
bla bla
\end{example}
\end{document}
Any suggestion is appreciated.
Thanks in advance,
Herman
> Hello,
>
> I am trying to create a theorem-like environment that delivers a
> theorem to be indented except for the first line, ie hanging indent:
>
> Example 1.1. Bla bla
> Bla bla
> Bla bla
How about the following:
\documentclass{article}
\usepackage{hanging, tocloft, lipsum}
\newcommand{\listexname}{List of Examples}
\newlistof[section]{example}{lox}{\listexname}
\newenvironment{example}{\refstepcounter{example}\bigskip\noindent\textbf
{Example \theexample.}\hspace{1em}\hangpara{.25in}{1}}{\bigskip}
\begin{document}
\section{}
\begin{example} \lipsum[1]
\end{example}
\lipsum[3]
\begin{example}\lipsum[2]
\end{example}
\end{document}
One caveat: this will only work with a single paragraph in the example.
Maybe there's a simpler way to do this.
Alan
Thanks Alan. Actually, I have more than one paragraph in the example,
and as you said, the solution above allows for only one.
Herman
Not pretty, but this can be fixed if you are willing to separate
paragraphs within the example by a separate command rather than just a
blank line.
\documentclass{article}
\usepackage{hanging, tocloft, lipsum}
\newcommand{\listexname}{List of Examples}
\newlistof[section]{example}{lox}{\listexname}
\newenvironment{example}{\refstepcounter{example}\bigskip\begin{hangparas
}{.25in}{1}\noindent\textbf{Example
\theexample.}\hspace{1em}}{\end{hangparas}\par\bigskip}
\newcommand{\hpar}{\hspace{.5in}}
\begin{document}
\section{}
\begin{example}
\lipsum[1]\hpar
\lipsum[2]\hpar
\lipsum[3]
\end{example}
\end{document}
Alan