# Not recognizing \begin{document}

I stumbled upon the following warning and error, consecutively. I see no reason why they would correlate.

LaTeX Warning: You have requested, on input line 447, version
2011/01/03' of package etoolbox,
but only version
2009/08/06 v1.8 e-TeX tools for LaTeX'
is available.


! Undefined control sequence.
\reserved@a ...x}[2011/01/03]\AfterEndEnvironment
l.447 }


! LaTeX Error: Missing \begin{document}.

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

l.447 }


Miminal working example:

\documentclass{article}

\usepackage{tablefootnote}

\begin{document}

\begin{table}[h]
\centering
\begin{minipage}{0.48\textwidth}
\centering
%\tablewidth=\textwidth
\begin{tabular}{ |l| }
content \tablefootnote{footnote content.}
\end{tabular}
\end{minipage}\hfill
\end{table}

\end{document}


What causes pdflatex not to recognize \begin{document}?

Moreover, the footnote is not printed at the bottom of the page.

• Your problem is: Your version of etoolbox is way outdated. – Johannes_B Mar 16 '17 at 17:17
• @Johannes_B yes but that wasn't the question, the question was why does that trigger a missing document error. – David Carlisle Mar 16 '17 at 17:18
• It is always the first error you need to fix. AtEndEnvironment wasn't yet implemented in 2009, hence the error. The missing begin document is the next error because LaTeX now thinks it needs to typeset something, and \begin{document} wasn't seen yet. – Johannes_B Mar 16 '17 at 17:18

It is best to ignore every error after the first.

! Undefined control sequence.
\reserved@a ...x}[2011/01/03]\AfterEndEnvironment

so TeX was reading \AfterEndEnvironment{table}
It gives the error that \AfterEndEnvironment is not defined, so if you do not stop there it carries on and sees {table} but this is (now) just text in a group, not the argument to a command, so it starts to typeset a paragraph, and latex flags that as an errror as you are not supposed to have text before \begin{document}