6

I found this redefinition of a table of contents very useful for my very long table of contents within my two-column book. With a slightly modified version of the command in the link, I got what I wanted:

\makeatletter
\renewcommand\tableofcontents{%
    \section*{\huge\contentsname
        \@mkboth{%
           \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}
    \@starttoc{toc}%
}
\makeatother

The problem is that I can't figure out how to do the same for listoffigures and listoftables. Does anyone know how?

I took a guess at what might do the job (below), but that definitely didn't work. If anyone can point me to documentation, that would also be appreciated. I know how to get rid of any undesired page breaks; that's not an issue.

\makeatletter
\renewcommand\listoffigures{%
    \section*{\huge\contentsname
        \@mkboth{%
           \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}
    \@startlof{lof}%
}
\makeatother

A minimal working example:

\documentclass[9pt,openany,twocolumn]{book}

\makeatletter
\renewcommand\tableofcontents{%
    \section*{\huge\contentsname
        \@mkboth{%
           \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}
    \@starttoc{toc}%
}
\makeatother

\begin{document}

\let\cleardoublepage\relax
\frontmatter
\begingroup
\let\clearpage\relax
\tableofcontents
\listoffigures
\endgroup

\mainmatter
\chapter{Armadillo}
\section{Grubs}
\begin{figure}
  \caption{Pink Fairy armadillo}
  \label{fig1}
\end{figure}

\chapter{Beetle}
\section{Leaves}
\begin{figure}
  \caption{Dung beetle}
  \label{fig2}
\end{figure}

\chapter{Cat}
\section{Birds}
\begin{figure}
  \caption{Siamese cat}
  \label{fig3}
\end{figure}

I think I'm hungry??

\end{document}

enter image description here

  • Please help us to help you and add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – user31729 Apr 24 '14 at 7:30
  • Ok. On the way... – Kevin Apr 24 '14 at 7:31
  • 1
    The \listoffigures command has a \listfigurename command instead of \contentsname, likewise \listoftables with \listtablename – user31729 Apr 24 '14 at 7:39
  • Isn't \let\clearpage\relax sufficient? Why do you want to redefine the commands? – egreg Apr 24 '14 at 7:53
  • I should have been clearer. By default, the table of contents or list of figures span both columns. I want them to flow along in two columns like regular text. Perhaps there is a really simple option for allowing this? I didn't know how to do it without redefining commands. – Kevin Apr 24 '14 at 7:56
5

As noted in the comments, you have to use \listfigurename and \listtablename for the LoF and the LoT, respectively.

Also the command for generating them is \@starttoc in every case:

\makeatletter
\renewcommand\tableofcontents{%
    \section*{\huge\contentsname
        \@mkboth{%
           \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}
    \@starttoc{toc}%
}
\renewcommand\listoffigures{%
    \section*{\huge\listfigurename
        \@mkboth{%
           \MakeUppercase\listfigurename}{\MakeUppercase\listfigurename}}
    \@starttoc{lof}%
}
\renewcommand\listoftables{%
    \section*{\huge\listtablename
        \@mkboth{%
           \MakeUppercase\listtablename}{\MakeUppercase\listtablename}}
    \@starttoc{lot}%
}
\makeatother

MWE (9pt is not a valid option, minimum is 10):

\documentclass[openany,twocolumn]{book}

\makeatletter
\renewcommand\tableofcontents{%
    \section*{\huge\contentsname
        \@mkboth{%
           \MakeUppercase\contentsname}{\MakeUppercase\contentsname}}
    \@starttoc{toc}%
}
\renewcommand\listoffigures{%
    \section*{\huge\listfigurename
        \@mkboth{%
           \MakeUppercase\listfigurename}{\MakeUppercase\listfigurename}}
    \@starttoc{lof}%
}
\renewcommand\listoftables{%
    \section*{\huge\listtablename
        \@mkboth{%
           \MakeUppercase\listtablename}{\MakeUppercase\listtablename}}
    \@starttoc{lot}%
}
\makeatother

\begin{document}

\let\cleardoublepage\relax
\frontmatter
\begingroup
\let\clearpage\relax
\tableofcontents
\listoffigures
\endgroup

\mainmatter
\chapter{Armadillo}
\section{Grubs}
\begin{figure}
  \caption{Pink Fairy armadillo}
  \label{fig1}
\end{figure}

\chapter{Beetle}
\section{Leaves}
\begin{figure}
  \caption{Dung beetle}
  \label{fig2}
\end{figure}

\chapter{Cat}
\section{Birds}
\begin{figure}
  \caption{Siamese cat}
  \label{fig3}
\end{figure}

I think I'm hungry??

\end{document} 

enter image description here

  • That works perfect. Thanks! I didn't know about the 10pt minimum. Thanks for informing me. – Kevin Apr 24 '14 at 7:49

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.