# Turn off appendix header in list of figures/tables when there are no tables or figures in any appendix

My list of tables and list of figures are showing correctly for my main document, but after the main list I get a header for the appendix that looks like:

4.1 Last Figure...................................whatever page

Appendix

Figure

I do not have any figures in any of my appendices, but the header still shows. If I add a fake figure to an appendix it appears after the header.

I have tried using \addtocontents{lof}{\protect\setcounter{tocdepth}{0}} to turn off the list of figures in appendices, and it works in that no more figures are shown after the header, but the header is still there.

I'm using a thesis .cls that I didn't write, so I'm not sure what everything does. The section that covers the list of tables/figures/contents looks like this:

\def\tableofcontents{\@tableof{TABLE OF CONTENTS}{}{tocpage}{toc}{}}

\def\listoffigures{
\@tableof{LIST OF FIGURES}{Figure}{lofpage}{lof}

\def\listoftables{
\@tableof{LIST OF TABLES}{Table}{lotpage}{lot}

\def\@tableof#1#2#3#4#5{
{ % limit scope of following declarations!!
\@restonecolfalse\if@twocolumn\@restonecoltrue\onecolumn\fi
\begin{center}
\chapter*{#1}
\end{center}
#5
\relax\markboth{#1}{#1}
\hbox to \hsize{#2 \hfil Page}
\singlespace
\setcounter{#3}{0}
\setcounter{listofheading}{1}  % change from 0 to 1
\hbox to \hsize{\hfil\rm\thepage} \vfil
\ifnum\value{#3}=1
\hbox to \hsize{Appendix\hfil} \vspace{4pt} \fi
\hbox to \hsize{#2 \hfil Page}
\else
\setcounter{#3}{1}
\fi
}}
\hbox to \hsize{\rm\thepage\hfil} \vfil
\ifnum\value{#3}=1
\hbox to \hsize{Appendix\hfil} \vspace{4pt} \fi
\hbox to \hsize{#2 \hfil Page}
\else
\setcounter{#3}{1}
\fi
}}
\@starttoc{#4}  \if@restonecol\twocolumn\fi
% \newpage
}}


I have tried removing everything in the @tableof definition except the @starttoc line and the header still appears. How do I get the lists to not show headers for sections that are empty?

-

Without a compilable example or at least a link to your class file, it's hard to say what's going on. The \@tableof macro isn't the culprit -- it temporarily switches to \onecolumn, changes the page margins and sets up the headers for even and odd LoF/LoT pages. I suggest to have a look at the definition of \appendix in your class file -- if this macro includes a line like
\addtocontents{lof}{Appendix}

copy the \appendix definition into the preamble of your document (to be sure, enclose it within \makeatletter/\makeatother) and comment out the above-mentioned line.