0

I have a long list of figures that spans two pages. My school's editor wants me to include 'figure page' at the top of the new page.

As far as I can tell, the below code is what pulls my list of figures, descriptions and page numbers and lists them out.

  \def\listoffigures{\chapter*{List of Figures}
 {\setlength{\parskip}{12\p@}
 \@starttoc{lof}
}
 \addtocontents{lof}{\noindent Figure\hfill Page\par}
 }
\renewcommand*\l@table{\@dottedtocline{1}{0em}{2.3em}}

What I would like to have happen is, after figure 18 is displayed, I want latex to include the new page header. Something like this:

psuedo code:
if figure_number = 18 
%do this code
{\noindent Figure\hfill Page\par}

In my list of figures, figure number 18 is the one at the top of the second page.

JamesT
  • 3,169
  • See also https://tex.stackexchange.com/questions/520802/how-to-add-headings-to-the-different-parts-in-a-list-of-figures-tables and https://tex.stackexchange.com/questions/306938/force-figures-page-header-to-appear-on-every-page-of-list-of-figures – John Kormylo Apr 19 '22 at 20:22
  • @JohnKormylo, your hint helped the best. – CakeMaster Apr 21 '22 at 19:15

2 Answers2

1

Try this.

% lofpsprob.tex  SE 641301
\documentclass{book}

%%% using basic LaTeX to define a lof pagestyle (could use fancyhdr instead) \makeatletter \newcommand{\ps@lof}{% \renewcommand{@oddhead}{\noindent Figure \hfill Page\par} \let@evenhead@oddhead \renewcommand{@evenfoot}{% \hfil\normalfont\textrm{\thepage}\hfil}% \let@oddfoot@evenfoot } \makeatother

\begin{document} \pagestyle{lof} % use the lof pagestyle for the second and later LoF pages \listoffigures \addtocontents{lof}{\noindent Figure \hfill Page\par} % put this after the LoF title

\chapter{First} \pagestyle{headings} % revert from lof pagestyle

\begin{figure} \centering FIG \caption{Fig} \end{figure} \addtocontents{lof}{\vspace*{5.25in}} % extend LoF to 2nd page

\begin{figure} \centering GRAPHIC \caption{Graphic} \end{figure}

\begin{figure} \centering CHART \caption{Chart} \end{figure}

\end{document}

The above produces the second page of the LoF how I think you have asked for it.

enter image description here

Peter Wilson
  • 28,066
  • Thank you for your reply. This does not work for me. It just posts 2 'figure page' lines one after the other (not on separate pages). – CakeMaster Apr 19 '22 at 21:20
  • @CakeMaster It works for me in my MWE. If the idea doesn't work for you than ask another question with an MWE, including my suggested code, that exhibits your problem. My answer provided what you asked for (figure --- page lines) on after the first LoF page. – Peter Wilson Apr 23 '22 at 18:33
0

I think I got it.

Note, for me, I wanted the 'figure page' to appear at the top of the second page. This occurs for figure page number 32 (so when macro input #2 = 32).

Use the below:

    \renewcommand*\l@figure[2]{
  \ifnum \c@tocdepth >\z@
    \addpenalty{-\@highpenalty}%
    \setlength\@tempdima{2.5em}
    \begingroup

\ifstrequal{#2}{32}{ \hfill \hfill \newline {\noindent Figure\hfill Page\par} } \parindent \z@ \rightskip @pnumwidth \parfillskip -@pnumwidth \leavevmode \advance\leftskip@tempdima \hskip -\leftskip #1\nobreak\dotfill \nobreak\hb@xt@@pnumwidth{\hss #2}\par \penalty@highpenalty \endgroup \fi}

  • Your question asks about figure 18 but your "answer" is to do with page 32. -GOM – Peter Wilson Apr 20 '22 at 17:55
  • Peter, in this case, figure 18 is on page 32. If you try to look at the macro argument #1, you get the figure number and the label of the figure (because that's how latex handles lof). However, this makes it hard to use #1 in a conditional assignment. Instead, macro argument #2 just has the page number that the figure is on. This is easy to add a conditional assignment that adds my "figure page" break. Though, it might not work if you have multiple figures on one page :\ – CakeMaster Apr 21 '22 at 19:14