No; it's not a bug, although it could be considered a bad design choice; ntheorem
uses the optional argument of \item
to typeset the theorem header (name, number and annotation), and that causes the problem (I guess that the package author thought that an annotation shouldn't be too long). You can define your own style, imitating the existing plain
style but modifying the undesired behaviour, so that you can now have annotations spanning several lines; the definition would be something along these lines, I used a checkmark (\Checkmark
from bbding
) as the endmark:
\documentclass[12pt]{article}
\usepackage{bbding}
\usepackage{amsmath}
\usepackage[thmmarks,amsmath,amsthm,thref]{ntheorem}
\makeatletter
\newtheoremstyle{Myplain}%
{\item[\hskip\labelsep \theorem@headerfont ##1\ ##2\theorem@separator]}%
{\item[\hskip\labelsep \theorem@headerfont ##1\ ##2]\theorem@headerfont (##3)\theorem@separator\newline\normalfont\itshape}
\newtheoremstyle{nonumberMyplain}%
{\item[\theorem@headerfont\hskip\labelsep ##1\theorem@separator]}%
{\item[\theorem@headerfont\hskip \labelsep ##1]\theorem@headerfont (##3)\theorem@separator\newline\normalfont\itshape}
\makeatother
\theoremstyle{Myplain}
\theoremsymbol{\Checkmark}
\newtheorem{example}{Example}
\begin{document}
\begin{example}[blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah]
Content
\end{example}
\end{document}
Another option would be to use the thmtools package which doesn't use \item
to build its theorem-like structures, thus providing an easier solution (the same checkmark was used in this example):
\documentclass[12pt]{article}
\usepackage{amsthm}
\usepackage{thmtools}
\usepackage{bbding}
\declaretheoremstyle[
spaceabove=6pt, spacebelow=6pt,
headfont=\normalfont\bfseries,
notefont=\mdseries\bfseries,
qed=\Checkmark,
notebraces={(}{)},
bodyfont=\itshape,
]{mystyle}
\declaretheorem[style=mystyle]{Example}
\begin{document}
\begin{Example}[blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah blah]
Content
\end{Example}
\end{document}
Set the paragraph \hangindent
:
\documentclass{article}
\usepackage{algorithm,algpseudocode}% http://ctan.org/pkg/{algorithms,algorithmicx}
\begin{document}
\begin{algorithmic}
%\raggedright
\State Define \texttt{N\_crf} as the number of points on the circumference
of the hyperstreamline, which will define its cross-sectional area at each~$r$
\For {$n = 1$ : number of tracts}
\State \parbox[t]{\dimexpr\linewidth-\algorithmicindent\relax}{%
\setlength{\hangindent}{\algorithmicindent}%
define N\_crf points creating a unit circle around $r(n,i)$, in the plane
perpendicular to $t(n,i)$.}\strut
\EndFor
\end{algorithmic}
\end{document}
You could define yourself a \hangparbox
:
\newcommand{\hangparbox}[3][t]{\parbox[#1]{\dimexpr#2}{%
\setlength{\hangindent}{\algorithmicindent}#3}}
Another crude method to obtain this would be to insert and remove an \algorithmicindent
before/after the \parbox
:
\State \hspace*{\algorithmicindent}\parbox[t]{\dimexpr\linewidth-\algorithmicindent}{%
\hspace*{-\algorithmicindent}
%...
}
This may come in handy when dealing with deeply-nested parts of your algorithm.
Best Answer
You can use the predefined commands of ntheorem to manipulate the style. In the example I uses
\theoremstyle{break}
do set the global style.\theoremindent
is used to set the indention of the whole environment.theoremheaderfont
is used befor every header. So I use this command to "reindent" the\theoremindent