2

How can I get the chapter prefix into the Endfloat marker in 'Table/Figure X about here'? For example, rather than have 'Table 1 about here' in the text of chapter 2, how can I have 'Table 2.1 about here'? Is there a workaround for this?

\documentclass[a4paper,12pt,twoside]{book}
\usepackage{pdflscape}
\usepackage[tablesfirst]{endfloat}
%\usepackage{titletoc}

%\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}
\startlist{lot}
Some text in chapter 1.  See my figure \ref{tab:table1}.

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

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

\processdelayedfloats

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

\begin{ltable}
\caption{Third Table} \label{tab:table3}
\end{ltable}

\begin{ltable}
\caption{Fourth Table} \label{tab:table4}
\end{ltable}

\begin{figure}
\caption{Fifth Table} \label{fig:table5}
\end{figure}

\processdelayedfloats

\end{document}

I'd be happy to modify Endfloat.sty if absolutely necessary, but don't know how.

user2146441
  • 1,226

1 Answers1

3

You need to redefine \theposttable:

\renewcommand\theposttable{\arabic{chapter}.\arabic{posttbl}}

An example:

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

\renewcommand{\theposttable}{\arabic{chapter}.\arabic{posttbl}}

% 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}
\startlist{lot}
Some text in chapter 1.  See my figure \ref{tab:table1}.

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

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

\processdelayedfloats

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

\begin{ltable}
\caption{Third Table} \label{tab:table3}
\end{ltable}

\begin{ltable}
\caption{Fourth Table} \label{tab:table4}
\end{ltable}

\begin{figure}
\caption{Fifth Table} \label{fig:table5}
\end{figure}

\processdelayedfloats

\end{document}

enter image description here

Another option would be to redefine \floatplace:

\makeatletter
\renewcommand\floatplace[1]{%
\begin{center}
[\csname #1name\endcsname~\thechapter.\csname thepost#1\endcsname\ about here.]
\end{center}}
\makeatother
Gonzalo Medina
  • 505,128