9

I've created a new float environment and new list-of as described in the memoir manual. My issue is that the spacing between the title of the list and its items isn't the same as for list of figures. Here's an example that shows what I mean:

test.tex

\documentclass[a4paper]{memoir}

\usepackage{xltxtra}
\usepackage{polyglossia}

% New list of source code listings
\newcommand{\sourcename}{Source Code Listing}
\newcommand{\listsourcename}{List of Source Code}

\newfloat[chapter]{source}{los}{\sourcename}
\newlistof{listofsources}{los}{\listsourcename}
\newlistentry{source}{los}{0}

\chapterstyle{pedersen}

\begin{document}

\frontmatter

\listoffigures
\clearpage
\listofsources

\mainmatter

\chapter{One}   

\begin{figure} \caption{Some  fig} \end{figure}
\begin{figure} \caption{Other fig} \end{figure}

\begin{source} \caption{Some  src} \end{source}
\begin{source} \caption{Other src} \end{source}

\end{document}

Compile with:

xelatex test.tex && xelatex test.tex

Below are images of what the titles look like.

Is there any easy way to style the new list the same as list of figures?

1 Answer 1

9

\insertchapterspace must be redefined so that it also adds some vertical space to the los whenever a new chapter starts. EDIT: memoir provides the \addtodef macro which can be used to amend the definition of \insertchapterspace.

\documentclass[a4paper]{memoir}

\newcommand{\sourcename}{Source Code Listing}
\newcommand{\listsourcename}{List of Source Code}

\newfloat[chapter]{source}{los}{\sourcename}
\newlistof{listofsources}{los}{\listsourcename}
\newlistentry{source}{los}{0}

\addtodef{\insertchapterspace}{}%
    {\addtocontents{los}{\protect\addvspace{10pt}}}

\usepackage{graphicx}

\chapterstyle{pedersen}

\begin{document}

\frontmatter

\listoffigures
\clearpage
\listofsources

\mainmatter

\chapter{One}   

\begin{figure} \caption{Some  fig} \end{figure}
\begin{figure} \caption{Other fig} \end{figure}

\begin{source} \caption{Some  src} \end{source}
\begin{source} \caption{Other src} \end{source}

\end{document}
2
  • Now that I knew what to look for, it's been under my nose the whole time, it's in section 9.3 bottom of page 173.
    – Thor
    Sep 2, 2012 at 21:11
  • 1
    @Thor Thanks for the tip -- example now uses \addtodef.
    – lockstep
    Sep 2, 2012 at 21:17

You must log in to answer this question.

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