I'm strugeling with the theorem package thmtools and its features. I've declared several theorem styles with \declaretheoremstyle and \declaretheorem.

How can I add a hanging paragraph margin on the left relative to the length of the theorem type and an absoulte margin on the right? As shown in the picture, the first line containing the theorem header, should be indented as in the rest of the document. The acctual content of the theorem however, should have a margin on the left as wide as the theorem type "Example". The margin on the right should be defined by an absoulte value. While I have found solutions on indenting the left margin (e.g. here), I have not found anything on doing so with the exact length of the theorem type and nothing on an absoulte margin on the right.

illustration of (1)

A minimal example of the theorem style above in action:






\begin{example}[First Example]


I'm grateful for any help!


1 Answer 1


You can do that easily with ntheorem:

\usepackage[showframe, nomarginpar]{geometry}

% spaceabove=\topsep,
% spacebelow=\topsep,
% headfont=\normalfont\bfseries,
% notefont=\normalfont\mdseries,
%% notebraces={$\lbrack$}{$\rbrack$},
% bodyfont=\normalfont\itshape,
% % postheadspace=\newline

\settowidth{\exampleindent}{\bfseries Example}
  {\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
          \llap{##1}\ ##2\theorem@separator}\hbox{\strut\vspace{1pt}}}}]}%
  {\item[\rlap{\vbox{\hbox{\hskip\labelsep \theorem@headerfont
          \llap{##1}\ ##2\ \normalfont\mdseries[##3]\theorem@separator}\hbox{\strut\vspace{1pt}}}}]}
\theoremrightindent 1.5cm


\begin{example}[First Example]

\begin{example}%[First Example]

enter image description here

  • Looks good! But would it be totally irrational of me if I wanted to stick with the thmtools package? I have declared roundabout 10 theorems and I'll probably run into some different looking styles whed using nthoerem. Will I not? Aug 22, 2015 at 7:43
  • thmtools can use ntheorem as a backend, with some restrictions. Also, probably most of what you set with thmtools can be set with ntheorem. Ntheorem default layout, as far as I know, is LaTeX default and its normal use is to modify LaTeX default from scratch.
    – Bernard
    Aug 22, 2015 at 8:16
  • Okay. How would I do that and does it mean I can use thmtools and ntheorem concurrently? Because as of now if I add \usepackage{ntheorem} to my preample all \declaretheoremstyle created theorems produce errors. So I guess I would have to convert them all to the ntheroem syntax?! Aug 22, 2015 at 10:04
  • Probably some of the keys are not recognized by ntheorem. That was the problem in your post: the notefont key is not known to ntheorem, hence I had to patch the closest ntheorem style (which is plainbreak) and insert the necessary commands to realise what you want.Very useful, ntheorem defines the theoremindent and \theoremrightindent lengths/commands. Note one of the strengths of ntheorem is its automatic placement of the end-of-proof symbols.
    – Bernard
    Aug 22, 2015 at 13:25
  • Having converted all thmtools int ntheorem definitions I must say I'm not cinviced, or maybe I just don't get it. ;) E.g. once I have added \theoremindent to one of the definitions, all other theorems also have the same ident no matter if the tag is used in that definition. What am I doing wrong here? Aug 22, 2015 at 18:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .