Document ClassesFramed and indented theorem's with ntheorem

Information and discussion about specific document classes and how to create your own document classes.
Post Reply
User avatar
Bozack
Posts: 117
Joined: Wed Feb 06, 2008 4:21 pm

Framed and indented theorem's with ntheorem

Post by Bozack »

Hi

I'm using the package ntheorem to make theorems - and I would like a special layout to these, which I'm not really sure is possible (but I'll ask anyway ;) ).

I'd like the theorems to be like the default theorems made by

Code: Select all

\usepackage[amsmath,thmmarks]{ntheorem}
\theoremstyle{plain}
\theorembodyfont{\small}
only with half a centimeter of indentation and a grayish line following the theorem vertically on the left side. It's important that this gray line follow the theorem also over page-breaks.

I've tried to draw what I want it to look like:
page.png
page.png (98.71 KiB) Viewed 10907 times
I hope someone has an idea of how this can be done :)
OS, LaTeX-system, editor: Arch Linux 64bit, TeXlive, Kile | Windows 10 Professional 64bit, MikTeX 4.9, TeXnicCenter 2.02 64bit

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
User avatar
Stefan Kottwitz
Site Admin
Posts: 10308
Joined: Mon Mar 10, 2008 9:44 pm

Framed and indented theorem's with ntheorem

Post by Stefan Kottwitz »

Hi Bozack,

that should be possible. Load ntheorem with the framed option, define a framed theorem, redefine the frame command used. You will get details from the ntheorem documentation.
It could look like:

Code: Select all

\usepackage[amsmath,thmmarks,framed]{ntheorem}
\theoremstyle{plain}
\theorembodyfont{\small}
\usepackage{framed}
\usepackage{color}
\definecolor{gray}{rgb}{0.6,0.6,0.6}
\renewcommand*\FrameCommand{{\color{gray}\vrule width 5pt \hspace{10pt}}}
\newframedtheorem{defn}{Definition}
It would work also with page breaks.

Stefan
LaTeX.org admin
User avatar
Bozack
Posts: 117
Joined: Wed Feb 06, 2008 4:21 pm

Framed and indented theorem's with ntheorem

Post by Bozack »

hm, my ntheorem doesn't recognize the command "framed". I get the error

Code: Select all

("C:\Program Files\MiKTeX 2.5\tex\latex\ntheorem\ntheorem.sty"
Style `ntheorem', Version 1.203 <2002/01/07>
Package: ntheorem 2002/01/07 1.203
\theorem@style=\toks27
\theorem@@style=\toks28
\theorembodyfont=\toks29
\theoremnumbering=\toks30
\theorempreskipamount=\skip72
\theorempostskipamount=\skip73
\theoremindent=\dimen164
\theorem@indent=\dimen165
\theoremheaderfont=\toks31
\theoremseparator=\toks32
\theoremsymbol=\toks33
\qedsymbol=\toks34
\theoremkeyword=\toks35
\qedsymbol=\toks36
\thm@topsepadd=\skip74
Package ntheorem Info: Option `thmmarks' loaded on input line 975.
\c@endNonectr=\count139
\c@currNonectr=\count140
\mysavskip=\skip75
Package ntheorem Info: option `amsmath' handling for `thmmarks' loaded on input
 line 975.
\thm@amstmpdepth=\dimen166

! LaTeX Error: Unknown option `framed' for package `ntheorem'.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              
                                                  
l.975 \ProcessOptions\relax
                           
The option `framed' was not declared in package `ntheorem', perhaps you
misspelled its name. Try typing  <return>  to proceed.

)
OS, LaTeX-system, editor: Arch Linux 64bit, TeXlive, Kile | Windows 10 Professional 64bit, MikTeX 4.9, TeXnicCenter 2.02 64bit
User avatar
Stefan Kottwitz
Site Admin
Posts: 10308
Joined: Mon Mar 10, 2008 9:44 pm

Re: Framed and indented theorem's with ntheorem

Post by Stefan Kottwitz »

In that case you probably have to update your ntheorem package, you are using v1.203 from 2002/01/07, it would work with 1.25 or higher.

Stefan
LaTeX.org admin
User avatar
Bozack
Posts: 117
Joined: Wed Feb 06, 2008 4:21 pm

Framed and indented theorem's with ntheorem

Post by Bozack »

Stefan_K wrote:In that case you probably have to update your ntheorem package, you are using v1.203 from 2002/01/07, it would work with 1.25 or higher.
After an update it worked :) thanks

How did you come up with the command

Code: Select all

\renewcommand*\FrameCommand{{\color{gray}\vrule width 4pt \hspace{10pt}}}
?

If I want to edit it somehow. Or, where is the \FrameCommand defined?
OS, LaTeX-system, editor: Arch Linux 64bit, TeXlive, Kile | Windows 10 Professional 64bit, MikTeX 4.9, TeXnicCenter 2.02 64bit
User avatar
Stefan Kottwitz
Site Admin
Posts: 10308
Joined: Mon Mar 10, 2008 9:44 pm

Re: Framed and indented theorem's with ntheorem

Post by Stefan Kottwitz »

Though ntheorem defines the macro \theoremframecommand I didn't use it, it seemed quicker to me just to use features of the framed package. I've taken \FrameCommand from the source of that package, you could look for it inside framed.sty on your computer or on CTAN.
The documentation of framed is contained in it's source file.

Stefan
LaTeX.org admin
Post Reply