4

I'm working with a memoir based template and I have an list of figures which is just over a page in length. For page layout purposes it would be useful to remove some white-space between the list of figures title and the actual list to get this onto one page.Demonstration on real world example I have included what I think should be a MWE, with the solution I would expect to work from the tocloft package in comment. Uncommenting this gives me an undefined control sequence error for \cftafterloftitleskip. Can anyone tell me what my mistake is with this approach, or if the approach itself is wrong, how I should go about this?

\documentclass{memoir}

\usepackage{capt-of}
%\usepackage{tocloft}
%\setlength{\cftafterloftitleskip}{0pt}

\begin{document}

\listoffigures
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}
\captionof{figure}{A}

\end{document}
  • You need ` \newlength{\cftafterloftitleskip}` to remove the error but this does not solve the problem. Anyway, for consistency with another chapter-like titles, is not a good idea remove spaces only in this page. What about simply {\small\listoffigures}? – Fran Jun 8 '17 at 4:25
  • It looks like the issue is the interaction between memoir and tocloft. If you use book instead, you get what you want. If you look at the log file after compiling with book, you'll see a line like Package tocloft Info: The document has chapter divisions.... If you compile with memoir, you'll see Package tocloft [2008/07/23] emulated by memoir. – TH. Jun 8 '17 at 4:26
  • @TeXnician: As I noted, tocloft is being emulated by memoir, the actual implementation in tocloft.sty is not used. – TH. Jun 8 '17 at 4:30
  • @TH. You're right, I just was slow writing the comment, so I did not see yours beforehand. Just forgot the memoir emulation... – TeXnician Jun 8 '17 at 4:31
  • You can change the space after all chapter titles (and you probably do want them to be uniform across all chapters, including the list of figures), with \setlength\afterchapskip{0pt} (although that looks pretty bad). – TH. Jun 8 '17 at 4:31
2

The memoir class emulates the tocloft package but does so imperfectly. Thus lengths like \cftafterloftitleskip are not defined or used.

Instead of modifying just a single chapter (the List of Figures) which is likely to look strange since all of the other chapters will have different spacing, you can modify the spacing for all chapters.

I'm not sure that I recommend setting the layout of chapter headers based on the contents of a single chapter, but it is an option.

The two parameters which seem easiest to modify are \beforechapskip and \afterchapskip.

In your MWE, the list was two lines over so as a reasonable starting point, you might consider shrinking those two parameters a combined total of 2\baselineskip. For example, putting \addtolength\beforechapskip{-2\baselineskip} in the preamble yields this. Image of the List of Figures

Of course, you might choose to change \beforechapskip by -1.5\baselineskip and \afterchapskip by .5\baselineskip. In my (completely amateurish) opinion, reducing the space above the chapter header looks better than reducing the space below it.

(As an aside, when compiling this particular example, the list of figures isn't quite correct. Figure 0.1 is on page 2 and Figure 0.24 is on page 3. You also have to run pdflatex three times to get this result.)

4

The problem is that every \chapter command writes \addvspace{10pt} to the lof file (and also lot).

Thus the lof file always begins with at least one \addvspace{10pt} that pushes the first caption down.

A solution is to add at the start a macro that recursively kills these unwanted vertical spaces.

The openany option is just to show the pages face to face; lipsum is for adding contents.

How does it work? The macro \killaddvspace checks whether the next token is \addvspace and, in this case it calls \killedaddvspace that gobbles \addvspace{10pt} and calls \killaddvspace again. When there's no more \addvspace lines to kill, the macro does nothing.

\documentclass[a4paper,openany]{memoir}

\usepackage{lipsum}

\makeatletter
\newcommand{\killaddvspace}{%
  \@ifnextchar\addvspace{\killedaddvspace}{}%
}
\newcommand{\killedaddvspace}[2]{\killaddvspace}
\AtBeginDocument{\addtocontents{lof}{\protect\killaddvspace}}
\makeatother

\begin{document}

\frontmatter

\chapter{Abstract}

\lipsum[1-2]

\clearpage
\listoffigures

\mainmatter

\chapter{No figures}

\newcommand{\testchapter}{%
  \chapter{Test}
  \lipsum[2]
  \begin{figure}
  \caption{Caption}
  \end{figure}
  \lipsum[3]
  \begin{figure}
  \caption{Caption}
  \end{figure}
  \lipsum[4]
  \begin{figure}
  \caption{Caption}
  \end{figure}
  \lipsum[5-8]
}

\testchapter
\testchapter
\testchapter
\testchapter
\testchapter

\end{document}

enter image description here

  • I descided to accept TH's answer as it lies more closly inline with my original question which specified \cftafterloftitleskip. +1 for tackling the reason why the whitespace is larger than it should be. If I am correct, this will only work to bring the space after the list of figures title to the same size as other chapters? But, I guess you could add negative vspace to go even further? – Emil Andre Løvbak Jun 11 '17 at 19:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.