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 have defined a new environment called "example"

 \newenvironment{ex}{\begin{quote}%
    \refstepcounter{examplecounter}%
  \textbf{Example \arabic{chapter}.\arabic{examplecounter}}%
  \quad
}{%
\end{quote}%
}

However the outcome would be like that

Example 1.2 The function x blah blah blah...(till the right of the page)
*AND it continues here....

What i want is this... the (AND) will align exactly where the "The" words starts in the 1st line...

Example 1.2 The function x blah blah blah...(till the right of the page)
            *AND it continues here....

How can it be done?

share|improve this question
    
Should the rest of the example content all be indented according to your display, even if you have multiple paragraphs in the example? What about Example 1.11 (double-digit numbering)? –  Werner Sep 4 '12 at 16:23
add comment

1 Answer

enter image description here

\documentclass{report}
\newcounter{examplecounter}[chapter]
 \newenvironment{ex}{%
    \refstepcounter{examplecounter}%
   \list{}{%
    \rightmargin\leftmargin
    \settowidth\labelwidth{Example \arabic{chapter}.\arabic{examplecounter}}%
    }
  \item[Example \arabic{chapter}.\arabic{examplecounter}]
}{%
\endlist
}

\begin{document}

\begin{ex}
One two three One two three One two three One two three
One two three One two three One two three One two three
One two three One two three One two three One two three 
\end{ex}

\end{document}
share|improve this answer
add 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.