# Not in outer par mode…How can I know which mode am I in?

I got this error message "not in outer par mode" for \begin{figure} or \begin{table} after I use \footnote.

The \footnote is correct.

Presumably a package I am using has problem.

Is there any way to know where this issue came from?

\documentclass[14pt,fleqn,twoside,openright]{book}
\usepackage[square,sort,comma,numbers]{natbib}
\bibliographystyle{siam}
\usepackage{amsmath,amsfonts}\usepackage{amssymb}
\usepackage[bottom]{footmisc}
\usepackage{graphicx,xcolor}
\usepackage{multicol,enumerate}
\usepackage{wrapfig}
\usepackage{framed}
\usepackage{fancybox}
\usepackage{enumerate}

\usepackage{subfigure}
\usepackage[avantgarde]{quotchap}
\usepackage{makeidx}
\makeindex
\usepackage{fancyhdr}
bindingoffset=1.4 cm,left=1.4cm,right=1.5cm,top=3cm,bottom=3.5cm]{geometry}

\usepackage{float}
\newfloat{insert}{tbh}{lop}
\floatname{insert}{insert}
\newfloat{program}{tbhp}{lop}
\floatname{program}{Program}
\begin{document}
\footnote{test}
\begin{insert}[tb]
\centering
\includegraphics[width=0.7\textwidth, angle=0]{insertion}
\end{insert}
\end{document}

• You want to display an image inside a \footnote? Then don't but the image inside a figure environment. If you want a caption as part of a complete figure, then you need to not let the figure float. For this add \usepackage{float} to your preamble and use the [H] float specifier. – Werner Feb 17 '18 at 0:22
• no!! I am not using figure or table inside footnote. It is after the footnote is closed. – latra Feb 17 '18 at 0:23
• @latra: Okay, so show us the offending code that allows us to replicate the behaviour. – Werner Feb 17 '18 at 0:26
• @latra TeX is a very singular language, in the sense that its behavior can be changed beyond recognition. So without the code that causes the issue, it is quite hard (and sometimes impossible) to say what's the problem. My guess is that you try to move the \footnote after the \end{figure} and change it to \footnotetext. Then, in the place where the footnote was, you put only a \footnotemark. But to tell you something certain we would have to see some of your code. – Phelype Oleinik Feb 17 '18 at 0:39

\insert is a TeX primitive. Therefore, defining an insert float, redefines \insert (and \endinsert) which is the cause of your issue.

To resolve it, rather define the float as insertion:

\usepackage{float}
\newfloat{insertion}{tbh}{lop}
\floatname{insertion}{insert}

%...

\begin{insertion}
%...
\end{insertion}

• Many thanks. So...I violate the keyword usage? – latra Feb 17 '18 at 2:18
• @latra the float package \newfloat command really should have warned you about that it is worth contacting the author and asking for the package to add a check that \newfloat really is defining a new name. – David Carlisle Feb 17 '18 at 12:22
• @DavidCarlisle: Dear author... could you add a check that \newfloat really is defining a new name? ;) – Werner Feb 18 '18 at 4:38

You can fix float.sty so it warns you about a risky definition. Since \begin{whatever} requires \whatever to be defined. In your case the package, as it stands, will redefine \insert and this is a very bad thing to do, because \insert is a primitive (which is used in the context of floats, but this is not really relevant, although it's the reason for the puzzling error message).

\documentclass{book}

\usepackage{float}

% fix \newfloat
\makeatletter
\let\@float@newfloat\newfloat
\renewcommand{\newfloat}[3]{%
\expandafter\@ifdefinable\csname #1\endcsname{%
\@float@newfloat{#1}{#2}{#3}%
}%
}
\makeatother
% end of fix

\newfloat{insert}{tbh}{lop}
\floatname{insert}{insert}
\newfloat{program}{tbhp}{lop}
\floatname{program}{Program}
\begin{document}
\footnote{test}
\begin{insert}[tb]
\centering
\includegraphics[width=0.7\textwidth, angle=0]{insertion}
\end{insert}
\end{document}


With this fix you'd get the error

! LaTeX Error: Command \insert already defined.
Or name \end... illegal, see p.192 of the manual.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
...

l.16 \newfloat{insert}{tbh}{lop}


that will make clear you cannot define a float type named insert. Now choose a different name.

I recommend to use the more modern newfloat package, if you don't need the \restylefloat feature.

\documentclass{book}

\usepackage{newfloat}

\DeclareFloatingEnvironment[
filext=lop,
listname={List of Inserts},
name=Insert,
placement=htbp,
]{insertion}

\begin{document}
\footnote{test}

\begin{insertion}[tbp]
\centering
\includegraphics[width=0.7\textwidth, angle=0]{insertion}
\end{insertion}

\end{document}


This package would by default warn if the chosen environment name is already taken.

• but wouldn't any float within a footnote be a problem? – barbara beeton Feb 17 '18 at 18:29
• @barbarabeeton My comment to the OP was based on a guess about the problem, before a MWE was added. It turns out that the footnote just triggered a weird error, because \insert got redefined. – egreg Feb 17 '18 at 18:35
• @egreg thanks for the fix code. A naive question: why do you need a % after the end of each line? – latra Feb 19 '18 at 1:25