# Error message because of eqnarray, footnotes, tables or caption?

I know this is not a minimal example, but I have to have this much code, in order to create my error. I had this error already several times and I cannot get rid of it?! I don't know where the problem is. Something is not correct with align and footnotes, at least this seems to be the reason for me?

Here is my code:

\documentclass[a4paper,
12pt,
bibliography=totoc,
index=totoc,
abstracton,
]{scrreprt}
\usepackage{latexsym}
\usepackage[latin1]{inputenc}
\usepackage[ngerman,english]{babel}
\usepackage{amsmath}
\usepackage{subfig}
\usepackage{float}
\usepackage{graphicx}
\usepackage{rotating}
\usepackage{mathrsfs}
\usepackage{eurosym,bm,amsmath,amssymb,verbatim}
\usepackage{listings}
\usepackage[T1]{fontenc}
\usepackage{setspace}
\usepackage [round,authoryear] {natbib}
\usepackage{amsthm}
\usepackage{graphicx,eso-pic,lipsum}
\usepackage{url}
\usepackage{tikz}
\usepackage{tocstyle}
\usetocstyle{allwithdot}
\usepackage[bookmarksopen,hyperfootnotes=false,pdftitle=test, pdfauthor=test,pdfsubject=test]{hyperref}
\usepackage{fancyhdr}
\usepackage{listings}
\usepackage{remreset}
\makeatletter
\@removefromreset{footnote}{chapter}
\makeatother
\usepackage{dblfnote}
\usepackage{booktabs}
\KOMAoption{footnotes}{multiple}
\usepackage[top=2cm,bottom=2cm]{geometry}
\usepackage{cleveref}

\definecolor{white2}{rgb}{255,255,255}

\begin{document}

\begin{titlepage}
test

\end{titlepage}

\onehalfspacing

\fancypagestyle{plain}{%
%% Clear all headers and footers
\fancyhf{}
\fancyfoot[C]{-\thepage -}
}

\pagestyle{fancy}
\fancyhf{}
%\renewcommand{\chaptername}{}
\renewcommand{\chaptermark}[1]{%
\markboth{\MakeUppercase{\thechapter. \hspace{1.5mm} \  #1}}{}}

\fancyfoot[C]{-\thepage -}

\begin{appendix}
\clearpage
\chapter{Appendix}

\subsection[Text]{Text}
\label{parameterestimation}
text texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext text\footnote{\citep[pp. 7-8]{Author1:1993}}. text texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext text\footnote{\citep[para. 4]{Author2:2002}}.

\subsubsection[Textn]{Text}
text texttext texttext texttext texttext texttext texttext texttext texttext texttext text\footnote{\citep[para. 4] {Hazewinkel:2002}}.
\paragraph{ML}\footnote{Text \citep[p. 12-13]{A:2006}}
text texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext text
\begin{align*}
54=54
\end{align*}
and the log likelihood by
\begin{align*}
54=54
\end{align*}
vtext texttext texttext texttext texttext texttext text
\begin{align*}
54=54
\end{align*}
text texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext text\footnote{\citep[p. 3] {Author1:2006} text texttext text}. text texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext text\footnote{\citep[para. Details] {Author2}}. text texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext text\footnote{\citep[para. Details] {RDocumentationoptim}} text texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext text\footnote{\citep[para. Details] {RDocumentationfitdistr}}). \\ \newline
text texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext text\footnote{\citep[p. 53] {Ruppert:2004}}:
\begin{align*}
54 = 45
\end{align*}
text texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext texttext text\footnote{\citep[p. 7] {Steenbergen:2006}}:

\end{appendix}

\clearpage
\fancyfoot[C]{-\thepage -}

\end{document}


I get the error:

! Improper \halign inside 's. \halign

This is NOT due to a specific align environment, e.g. a typo error in an align environment, I have this problem throughout my complete thesis!

-
May be "hacking down" the full code makes a good MWE and hope you know the consequences of eqnarray –  texenthusiast Mar 15 '13 at 9:34
@texenthusiast I tried to hack it down as best as possible, so that the error ist stille there. The problem stays the same, if I change eqanarray into align. No difference, same problem! –  Stat Tistician Mar 15 '13 at 10:18
@StatTistician sry I was wrong, I can reproduce the error when I add or don't add a free line between the lines I mentioned in my answer –  Dominic Michaelis Mar 15 '13 at 11:30
@Dominic Michaelis Thanks for that first hint with the free line. But I have the same problem, when I try to add a footnote in my figures. So I have a caption and I want to add a footnote, then I get the same error message. If I then insert another line in the other formula, Latex compiles, but "runs endless". So So it starts with an message like this and the number in the [] increases, it runs endless, what is my mistake? <use logosblack.jpg> [964] Overfull \hbox (4.0pt too wide) has occurred while \output is active –  Stat Tistician Mar 15 '13 at 11:40

This is not an answer, but ... I condensed your code to

\documentclass[12pt]{scrreprt}
\usepackage{setspace}
\usepackage{dblfnote}
\usepackage{booktabs}

%------------------------------------------------------------------------

\textheight245mm
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
\onehalfspacing

text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
\footnote{text}
\begin{table}[h]
\begin{tabular}{llr}
\toprule
a & b & c \\
a & b & c \\
a & b & c \\
a & b & c \\
a & b & c \\
a & b & c \\
a & b & c \\
\bottomrule
\end{tabular}
\end{table}
test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text
text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text
text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test
test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text
text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text
text test test test test text text text test test test test
text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text.
\subsection{Sec}

test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text
\footnote{text}
\footnote{text}
\begin{eqnarray}
a & = & b
\end{eqnarray}
test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text\footnote{text} text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text test test test test text text text.
\footnote{text}
\begin{eqnarray}
a & = & b
\end{eqnarray}
\end{document}


which looks quite innocent apart from setting the \textheight manually. Changing any detail makes the error go away, so I guess something fishy is going on here. I provide this for others as a better starting point.

-
So no \textheight manually, what should I do instead? @mafp –  Stat Tistician Mar 15 '13 at 11:43
I guess it has a problem with a page break, because else it wouldn't make differences to delete text wihtout any syntax –  Dominic Michaelis Mar 15 '13 at 11:58
@StatTistician the purpose of removing stuff in a Minimal Example is not that you should not use those features in your real document, just to make a document suitable for debugging. Your posted example is very difficult to use as it loads tikz and other unrelated packages that are bigger than latex itself so introduce a lot of code, removing them means that whoever looks at this only need look at the reduced example. (The problem is an interaction with the headings if the page breaks (or might break) within the eqnarray. –  David Carlisle Mar 15 '13 at 12:12
if I change all eqnarray to align, it is still not working @David Carlisle –  Stat Tistician Mar 15 '13 at 12:19
@StatTistician quite possibly (although it isn't clear why you are using either eqnarray or align since you have no alignment points & in all the cases shown. –  David Carlisle Mar 15 '13 at 12:36