Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

latex theorem does not wrap text in 2-column

Tags:

latex

The following latex code produces a definition that its text overlaps to the 2nd column. The ijcai18 package makes it a 2-column article, so perhaps the problem is there ? I do not know how to read it.

\documentclass{article}

\usepackage{ijcai18}


\usepackage{lipsum}

\newtheorem{theorem}{Theorem}[section]    
\newtheorem{definition}[theorem]{Definition}

\begin{document}

\begin{definition} [This is a long definition title that does not wrap to the next line]

...
\end{definition}
\lipsum[1-5]    
\end{document}
like image 275
Ofer strichman Avatar asked Sep 17 '25 07:09

Ofer strichman


1 Answers

The ijcai18 conference style does not add any theorem-related functionality. As such, \newtheorem{definition}[.]{Definition} still relies on LaTeX's original definition for creating the theorem-like environments.

In LaTeX, theorems as defined via \newtheorem is set as a list, with the entire theorem consisting of a singular \item. The title of the theorem is passed as the optional argument to \item (that is, \item[<theorem title stuff>], and this optional argument is set inside a box that doesn't allow for line-breaking.

Below I redefine the part that sets the \item specifically for a theorem that has an optional argument (like in your case, \begin{definition}[..]). Here's the original definition (from the LaTeX kernel):

\def\@opargbegintheorem#1#2#3{\trivlist
  \item[\hskip \labelsep{\bfseries #1\ #2\ (#3)}]\itshape}

enter image description here

and here's the changed definition:

\def\@opargbegintheorem#1#2#3{\trivlist
   \item[]{\bfseries #1\ #2\ (#3)} \itshape}

enter image description here

\documentclass{article}

\usepackage{ijcai18}% http://www.ijcai.org/authors_kit
\usepackage{lipsum}

\newtheorem{definition}{Definition}

\makeatletter
\def\@opargbegintheorem#1#2#3{\trivlist
   \item[]{\bfseries #1\ #2\ (#3)} \itshape}
\makeatother

\begin{document}

\begin{definition}[This is a long definition title that does not wrap to the next line]
\lipsum[1]
\end{definition}

\lipsum[2-5]

\end{document}
like image 128
Werner Avatar answered Sep 19 '25 15:09

Werner