General ⇒ how to write numbered examples in lecture notes
-
- Posts: 3
- Joined: Thu Oct 23, 2008 4:35 pm
how to write numbered examples in lecture notes
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
Learn LaTeX easily with newest books:
The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis
The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more
LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis
- localghost
- Site Moderator
- Posts: 9202
- Joined: Fri Feb 02, 2007 12:06 pm
how to write numbered examples in lecture notes
Best regards and welcome to the board
Thorsten¹
Board Rules
Avoidable Mistakes
¹ System: TeX Live 2025 (vanilla), TeXworks 0.6.10
-
- Posts: 3
- Joined: Thu Oct 23, 2008 4:35 pm
Re: how to write numbered examples in lecture notes
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.
-
- Posts: 3
- Joined: Thu Oct 23, 2008 4:35 pm
Re: how to write numbered examples in lecture notes
\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