Generalhow to write numbered examples in lecture notes

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
nguyenvinhphu
Posts: 3
Joined: Thu Oct 23, 2008 4:35 pm

how to write numbered examples in lecture notes

Post by nguyenvinhphu »

Hello everybody,

I am writing a lecture note where I insert some examples to explain somethings.
I would like the examples to be appeared differently from the rest (distinguished from the rest). So, I have been
looking for an environment that can do this. Say, text in example should be smaller
or put in a box or having a vertical line on the right.

Could you please help me which environment should be used?

Many thanks in advance.

Vinh Phu

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

how to write numbered examples in lecture notes

Post by localghost »

Have a look at packages like amsthm or ntheorem. If these do not provide suitable environments, describe your ideas more precise. Perhaps we then could create an environment that fits your needs.


Best regards and welcome to the board
Thorsten¹
nguyenvinhphu
Posts: 3
Joined: Thu Oct 23, 2008 4:35 pm

Re: how to write numbered examples in lecture notes

Post by nguyenvinhphu »

Hi localghost,

It seemed that the ntheorem package is what I am looking for but when I used

\usepackage[framed,amsmath,thmmarks]{ntheorem}
\usepackage{framed}

I got the following error

Package ntheorem Error: Theorem style plain already defined.

How to remove it please.

Thanks.
nguyenvinhphu
Posts: 3
Joined: Thu Oct 23, 2008 4:35 pm

Re: how to write numbered examples in lecture notes

Post by nguyenvinhphu »

Sorry for stupid questions, I figured out how to do. That's it.

\usepackage{amsmath,amssymb,amsfonts,stmaryrd}
\usepackage[framed,amsmath,thmmarks]{ntheorem}

(can not put amsmath in both)

Then, the following define a Example environment with a vertical line along the left side:

\theoremstyle{example}
\theorembodyfont{\small}
\definecolor{gray}{rgb}{0.6,0.6,0.6}
\renewcommand*\FrameCommand{{\color{gray}\vrule width 5pt \hspace{10pt}}}
\newframedtheorem{exam}{Example}[section]

Thanks a lot.

P
Post Reply