# Endfloat compilation error

Why is the following MWE giving me an error? I want use endfloat to number the tables in each chapter with I, II, III etc. I also want to print a list of tables and figures at the end of each chapter rather than the end of the document.

Also, I can't get the table that is on a landscape page in the document to display as landscape on it's own page in the list of tables at the end. The table is very wide, so I need to keep it on a landscape page on its own.

\documentclass[a4paper,12pt,twoside]{book}
\usepackage{pdflscape}

\usepackage[]{endfloat}
\renewcommand{\theposttable}{\Roman{theposttbl}}
\renewcommand{\thepostfigure}{\Roman{postfig}}
\renewcommand{\thefigure}{\Roman{figure}}
\renewcommand{\thetable}{\Roman{table}}

\begin{document}

\chapter{This is Chapter 1}
Some text in chapter 1.  See my figure \ref{tab:table1}.

\begin{table}
\caption{First Table} \label{tab:table1}
\end{table}

\let\cleardoublepage\clearpage
\chapter{This is Chapter 2}
Some text in chapter 2.  See my figure \ref{tab:table2}.

\begin{landscape}
\begin{table}
\caption{First Table} \label{tab:table2}
\end{table}
\end{landscape}

\end{document}


You can't use landscape in this way, because endfloat wouldn't be able to catch it. However, the endfloat package knows how to manage new environments.

Note that you had an error in the redefinition of \theposttable.

\documentclass[a4paper,12pt,twoside]{book}
\usepackage{pdflscape}

\usepackage{endfloat}

\renewcommand{\theposttable}{\Roman{posttbl}}
\renewcommand{\thepostfigure}{\Roman{postfig}}
\renewcommand{\thefigure}{\Roman{figure}}
\renewcommand{\thetable}{\Roman{table}}

% new environment for landscape tables
\newenvironment{ltable}
{\begin{landscape}\begin{table}}
{\end{table}\end{landscape}}

% make it known to endfloat
\DeclareDelayedFloatFlavor{ltable}{table}

\begin{document}

\chapter{This is Chapter 1}
Some text in chapter 1.  See my figure \ref{tab:table1}.

\begin{table}
\caption{First Table} \label{tab:table1}
\end{table}

\chapter{This is Chapter 2}
Some text in chapter 2.  See my figure \ref{tab:table2}.

\begin{ltable}
\caption{First Table} \label{tab:table2}
\end{ltable}

\end{document}

• How can I put a list of tables after each chapter, rather than just once at the end of the document? – user2146441 Jan 30 '14 at 12:12
• @user2146441 That's a completely different question. – egreg Jan 30 '14 at 13:04
• @user2146441 Add \thispagestyle{myplain} after \begin{landscape} – egreg Jan 30 '14 at 18:22