Math & Science ⇒ amsthm example covered with box
amsthm example covered with box
I would like to ask you following question:
I would like to have example covered with box. I am using amsthm package, but inserting its example definition into \framebox is not possible. Do you know some way how to do this?
Thanks a lot.
Libor
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
amsthm example covered with box
you can use the ntheorem package instead of amsthm. There's a predefined framed theorem style if the heading and the body of the example should be boxed. If only the heading should be boxed, then you could easily define a new theorem style:
Code: Select all
\documentclass{article}
\usepackage{ntheorem}
\makeatletter
\newtheoremstyle{myframe}%
{\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
\fbox{##1\ ##2}\theorem@separator}\hbox{\strut}}}]\normalfont}%
{\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
\fbox{##1\ ##2\ (##3)}\theorem@separator}\hbox{\strut}}}]\normalfont}
\makeatother
\theoremstyle{myframe}
\newtheorem{exam}{Example}
\begin{document}
\begin{exam}
Test
\end{exam}
\end{document}