3

I'm using tocloft and tocstyle using settings standard and nopagecolumn for my book. I'd like these settings to apply to my user-defined list of examples (.loe), but haven't had much luck. I naively tried replacing \usetocstyle with \useloestyle, but that didn't work. Using \renewcommand{\cftloedotsep}{\cftnodots} gives me the equivalent of nopagecolumn, but the font does not match that of the toc.

I was unable to find enlightenment in the documentation (though I have faith that it's there somewhere). Can anyone offer some advice?

Thanks!

Here's a MWE:

\documentclass[12pt]{book}

% define table of contents style

\usepackage{tocstyle}

\usetocstyle{standard}

\usetocstyle{nopagecolumn}

\settocstylefeature{pagenumberhook}{\itshape~}

%create list-ofexamples's

\usepackage{tocloft}

\newcommand{\listloename}{Examples}

\newlistof{loe}{loe}{\listloename}

\renewcommand{\cftloedotsep}{\cftnodots}  %this and the next 3 lines mimic 

\renewcommand{\cftloeafterpnum}{\cftparfillskip} % nopagecolumn, but

\renewcommand{\cftloeleader}{\hspace*{.75cm}}  % do not fully

\renewcommand{\cftpnumalign}{l}                 % reproduce it


\begin{document}

\tableofcontents

\listofloe

\newpage

\chapter{First Chapter}

\section{First Section}

\subsection{First part of the first section}

\addcontentsline{loe}{loe}{Example One}

\subsection{Second part of the first section}

\ldots

\addcontentsline{loe}{loe}{A 2nd Example}

\section{Second Section}

\subsection{First part of the second section}

\ldots

\end{document}

Note that if I were to add an appendix in the usual way, they would be listed in the toc with the same font as the chapters in the MWE. But not the loe's.

3
  • 1
    It's best to supply the community with something they can work with, rather than a the discussionary mention of some random setup. To that end, please provide us with a minimal working example (MWE) that replicates your current setup. It should start with \documentclass and end with \end{document} and we want to copy-and-paste-and-compile and see exactly what you're currently seeing. That's the best way to help us help you.
    – Werner
    Nov 18, 2014 at 1:32
  • So you want to add the \chapters to the LoE as well? For every \chapter? I guess I don't understand your last statement completely. The tocstyle package is in "alpha" version, and anything might change. My suggestion would be to mimic nopagecolumn as best you can using tocloft and then apply the same definitions to the regular ToC. That way things (styles) will match up the way you want.
    – Werner
    Nov 18, 2014 at 6:08
  • My apologies for being unclear. I simply meant that the font used for chapter headings in the toc is the same as the font for appendix titles -- which is also in the toc. But in my user-defined loe, the example titles use a different font. At the end of the day, what I really want is a simple way to ensure that a user-defined list has the same characteristics as the toc. And I suspect that the answer is encapsulated in your point that tocstyle is in alpha.
    – gilonik
    Nov 18, 2014 at 6:22

1 Answer 1

2

Here is a suggestion using package tocbasic which is part of the KOMA-Script bundle. AFAIK it should supersede package tocstyle from the same author. Note that tocbasic/KOMA-Script version 3.21 or newer is needed.

enter image description here

Code:

\documentclass[12pt]{book}
\usepackage{tocbasic}[2016/06/14]% needs KOMA version 3.21 or newer

\DeclareTOCStyleEntry[
  linefill=\quad,
  raggedpagenumber,
  pagenumberformat=\bfseries\textit
]{tocline}{chapter}
\DeclareTOCStyleEntry[
  linefill=\quad,
  raggedpagenumber,
  pagenumberformat=\textit
]{tocline}{section}
\DeclareTOCStyleEntry[
  linefill=\quad,
  raggedpagenumber,
  pagenumberformat=\textit
]{tocline}{subsection}

\DeclareNewTOC[
  listname=Examples,
  tocentrystyle=tocline,
  tocentrynumwidth=2.3em,% same as for figures and tables
  tocentryindent=1.5em,% same as for figures and tables
  tocentrylinefill=\quad,
  tocentryraggedpagenumber,
  tocentrypagenumberformat=\textit
]{loe}

% only if \listofloes should really not start on a new page
\BeforeTOCHead[loe]{\renewcommand\clearpage{}}

\begin{document}
\tableofcontents
\listofloes

\chapter{First Chapter}
\section{First Section}
\subsection{First part of the first section}
\addxcontentsline{loe}{loe}{Example One}
\subsection{Second part of the first section}
\ldots
\addxcontentsline{loe}{loe}{A 2nd Example}
\section{Second Section}
\subsection{First part of the second section}
\ldots
\end{document}

Result:

You must log in to answer this question.

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