I need help writing an Example environment. I just want it to look like the figure below which I took from an old book I have in my library.

enter image description here

This is what I have done.


    0\textwidth \textwidth
    0.25\textwidth 0.74\textwidth
    0pt \textwidth \begin{exem} \rm \hspace{0.2cm}}{\end{exem}}


However this code fails when the text is very long in the defined environment. Then I start having problems with right margin. I have no idea how to solve it. Please, can you help me to define that environment?

  • Welcome to TeX.SX! Questions about how to draw specific graphics that just post an image of the desired result would be greatly improved by adding a MWE. Please post a minimal compilable document showing that you've tried to produce the image and then people will be more disposed to help you with any specific problems you may have. See minimal working example (MWE) for what needs to go into such a document. – Adam Liter Dec 24 '13 at 23:57

Here is an example environment that sets the paragraph alignment/shape using \parshape:

enter image description here

\usepackage{lipsum}% http://ctan.org/pkg/lipsum
  {\refstepcounter{example}% Step example counter
   \sbox\@tempboxa{\examplename~\theexample.~}% Store environment title
   % Set paragraph alignment
   \parshape 3 \wd\@tempboxa \dimexpr\linewidth-\wd\@tempboxa % Line 1
     \wd\@tempboxa \dimexpr\linewidth-\wd\@tempboxa % Line 2
     0pt \linewidth% Line 3+
    \noindent% No indent
    \leavevmode% Start paragraph
    \llap{\usebox\@tempboxa}% Insert environment title
    \ignorespaces}% Remove spaces
  Some example content
  Some more example content
  • 1
    @limber Instead of---or in addition to---posting a “Thank you” as a comment, you should thank Werner by upvoting his answer (with the upward pointing arrow to the left of it; you need 15 reputation points before you can upvote) and accepting it (by clicking on the checkmark ✓). – Adam Liter Dec 25 '13 at 2:41

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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