# Package caption Error: No float type 'noticebox' defined

I took the NIPS 2018 paper template from here, which I can compile (via pdflatex).

However, when I add this package (before \title):

\usepackage{caption}


I get the error:

! Package caption Error: No float type 'noticebox' defined.


Why? How can I fix this? I'm using MacOSX with Texlive 2011.

A reduced example (still using the NIPS style file):

\documentclass{article}
\usepackage{nips_2018}
\usepackage[utf8]{inputenc} % allow utf-8 input
\usepackage[T1]{fontenc}    % use 8-bit T1 fonts
\usepackage{url}            % simple URL typesetting
\usepackage{booktabs}       % professional-quality tables
\usepackage{amsfonts}       % blackboard math symbols
\usepackage{nicefrac}       % compact symbols for 1/2, etc.
\usepackage{microtype}      % microtypography
\usepackage{caption}

\title{Foo}
\author{foo}

\begin{document}
\maketitle
\end{document}


(Maybe this is related. Or this.)

Adding this additional command (inspired via this) solves it, but not sure if that is a good solution, or what it does:

\DeclareCaptionType{noticebox}

• I downloaded the .sty file and the .tex template, to which I added \usepackage{caption}. I get no error. Please add a minimal example that shows the issue. – egreg Oct 17 '18 at 14:52
• I can reproduce the issue with TeX Live 2010, not with a fully updated TL 2011. Since the last revision of the style file is dated 2018/03/03, old TeX distributions are quite likely unsupported. Is there a reason for not upgrading your MacTeX/TeX Live? – egreg Oct 17 '18 at 15:22
• @egreg Not really. But I was also posting this here in case anyone else stumbles upon this problem, because there was no single Google hit for this error. – Albert Oct 17 '18 at 15:23
• BTW: This incompatibility was fixed (by me) on 2010/10/26, i.e. 8 years ago. – Axel Sommerfeldt Oct 17 '18 at 20:21

There is a way to solve the issue, anyhow.

\documentclass{article}
\usepackage{nips_2018}
\usepackage[utf8]{inputenc} % allow utf-8 input
\usepackage[T1]{fontenc}    % use 8-bit T1 fonts
\usepackage{caption}
\usepackage{booktabs}       % professional-quality tables
\usepackage{amsfonts}       % blackboard math symbols
\usepackage{nicefrac}       % compact symbols for 1/2, etc.
\usepackage{microtype}      % microtypography

\makeatletter
\@ifpackagelater{caption}{2011/01/01}
{}
{\usepackage{float}\newfloat{noticebox}{htbp}{.nb}}
\makeatother

\title{Foo}
\author{foo}

\begin{document}
\maketitle
\end{document}


I also loaded hyperref last, which is its proper position, notwithstanding what the authors of nips2018 think.

With the \@ifpackagelater instruction we only do the patch if caption is pre-2011.