0

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,     
        headsepline,    
        ]{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{headercolor}{rgb}{0,0,0}
\definecolor{white2}{rgb}{255,255,255}



\begin{document}                    



\begin{titlepage}
test

\end{titlepage}

\onehalfspacing 

\fancypagestyle{plain}{%
  %% Clear all headers and footers
  \fancyhf{}
\fancyhead[L]{\hspace{5.5mm}\textcolor{white2}{\leftmark}\\ \text{ }\textcolor{white2}{\hspace{0.4cm}\rightmark}\hfill\textcolor{white2}{}\hspace{2mm}}
\renewcommand{\headrule}{\vspace{-\headheight}\textcolor{white2}{\vrule height \headheight width 2pt\relax\rule{\textwidth}{2pt}\vrule height \headheight width 2pt\relax}}
\fancyfoot[C]{-\thepage -}
}

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


\fancyhead[L]{\hspace{5.5mm}\textcolor{headercolor}{\leftmark}\\ \text{ }\textcolor{headercolor}{\hspace{0.4cm}\rightmark}\hfill\textcolor{headercolor}{}\hspace{2mm}}
\renewcommand{\headrule}{\vspace{-\headheight}\textcolor{headercolor}{\vrule height \headheight width 2pt\relax\rule{\textwidth}{2pt}\vrule height \headheight width 2pt\relax}}
\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
\fancyhead[L]{\hspace{4mm}\textcolor{headercolor}{}\text{ }\textcolor{headercolor}{\rightmark}\hfill\textcolor{headercolor}{}\hspace{2mm}}
\renewcommand{\headrule}{\vspace{-\headheight}\textcolor{headercolor}{\vrule height \headheight width 2pt\relax\rule{\textwidth}{2pt}\vrule height \headheight width 2pt\relax}}
\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!

  • 4
    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
1

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
  • 1
    @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
0

This is not an complete answer, but it contains a needed MWE and some notes. Also, note that others who land here because of that error message, may be instead interested to look at: Modifying \everydisplay causes the align* environment to stop working

Below is the MWE and some notes about it.

\documentclass{scrreprt}
\usepackage{dblfnote}
\begin{document}
  This seems to be a irrelevant\footnote{footnote one}

  \vspace*{20cm}

  \hspace*{14cm} text text\footnote{footnote two}\footnote{footnote three}
\begin{eqnarray}
a & = & b
\end{eqnarray}
\end{document}

The above code produces the error. My guess is that it is related to a line break near to the end of a page, the package dblfnote and the eqnarray environment. Let us see.

Replacing "text text" by "xxxxxxxxxxx" the code will compile with no error, even for any other values of hspace. However, changing "text text" word that can be hyphenated, like "important", will lead to the error.

Changing \hspace*{14cm} to \hspace*{13cm} produces no error, even if we change the value of vspace to anything else (for large values, the text will not be displayed correctly, but LaTeX does no complain). On the other hand, keeping \hspace*{14cm} (or larger) and decreasing the \vspace value to \vspace*{20cm} will produces no error.

It is very puzzling...

  • You are right. Probably, the best think to do is not use dblfnote. I actually ended up here searching for the error message "! Improper \halign inside $$'s.", which was happening to me in a completely different set up. Then, I was just puzzled by the question on the thread and was trying to replicate his error on a MWE (so, I kept his eqnarray). By simply removing dblfnote, there is no MWE (and maybe the OP needed it). – Fabricio Feb 9 at 1:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.