4

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}

1 Answer 1

7

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}
4
  • How can I put a list of tables after each chapter, rather than just once at the end of the document? Commented Jan 30, 2014 at 12:12
  • @user2146441 That's a completely different question.
    – egreg
    Commented Jan 30, 2014 at 13:04
  • I had the following environment set up for landscape pages. How can I add this to your example above? \fancypagestyle{myplain} { \fancyhf{} \renewcommand\headrulewidth{0pt} \renewcommand\footrulewidth{0pt} \fancyfoot[R]{\thepage} } Commented Jan 30, 2014 at 18:17
  • 1
    @user2146441 Add \thispagestyle{myplain} after \begin{landscape}
    – egreg
    Commented Jan 30, 2014 at 18:22

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .