7

I'm defining a newtheorem as follows:

 \newtheorem{definition}{Definition} 

the problem is when the definition name is long, it results in overruns. I've tried \\ to split the name in two lines, but it's not working.

Here is relevant part of my tex file:

 \documentclass{vldb} \usepackage{graphicx} \usepackage{subfigure} \usepackage{algorithmic} \usepackage{algorithm} \usepackage{url} \usepackage{times} \newtheorem{definition}{Definition} 

and then I use:

 \begin{definition}[anonymity non-reconstructible fragmentation] 

and anonymity non-reconstructible fragmentation causes overrun.

btw, vldb package is a pre-defined package I can't alter.

2
  • Which package are you using to define your structures? Can you please add a simple, complete document showing the definition and the problem in action? Commented Aug 25, 2013 at 16:51
  • Welcome to TeX.SX! Commented Aug 25, 2013 at 17:05

3 Answers 3

5

I don't know about the vldb class, but the clues you give suggest it's two column. With the amsthm package you get what you want and are also able to set the font in the body of the definition to upright, which is customary:

\documentclass[twocolumn]{article} \usepackage{amsthm} \theoremstyle{definition} \newtheorem{definition}{Definition} \begin{document} \begin{definition}[anonymity non-reconstructible fragmentation] aaa \end{definition} \end{document} 

enter image description here

By the way, subfigure has been obsolete for ten years; prefer subfig (possibly with the caption=false package, that might be required with the class you're using).

4

If the default \newtheorem is used, then the optional argument (your definition title) is set in a box as part of a list, hence being unbreakable. With minimal manual intervention, you can fix this:

enter image description here

\documentclass{article} \usepackage{lipsum}% http://ctan.org/pkg/lipsum \newtheorem{definition}{Definition} \begin{document} \begin{definition}[anonymity non-reconstructible fragmentation and then some] \lipsum[1] \end{definition} \begin{definition}\textbf{\upshape(anonymity non-reconstructible fragmentation and then some)} \lipsum[1] \end{definition} \end{document} 
4

The class vldb uses the kernel's \newtheorem, but with a redefinition of \@opargbegintheorem; as with the original definition, the annotation is placed as part of the optional argument of \item, so no line breaks are allowed. To correct this you can redefine \@opargbegintheorem so the annotation will be outside the optional argument for \item; with the appropriate settings you will respect the style used by the class.

Unfortunately, in this specific case, the word at the end of the line "fragmentation" will break at "frag" producing an overfull box (by 1.48pt), so perhaps a manual line break could be used. The example below shows two possible alternatives:

\documentclass{vldb} \usepackage{graphicx} \usepackage{subfigure} \usepackage{algorithmic} \usepackage{algorithm} \usepackage{url} \usepackage{times} \usepackage{lipsum} \makeatletter \def\@opargbegintheorem#1#2#3{\trivlist \item[\hskip\dimexpr\labelsep+10pt\relax{\scshape #1\ #2}](\textsc{#3}).\ \itshape} \makeatother \newtheorem{definition}{Definition} \begin{document} \begin{definition}[anonymity non-reconstructible fragmentation] \lipsum[4] \end{definition} \lipsum[4] \begin{definition}[anonymity non-reconstructible \\ fragmentation] \lipsum[4] \end{definition} \lipsum[4] \end{document} 

enter image description here

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.