[OS X TeX] Re: Mini Toc

Alain Schremmer schremmer.alain at gmail.com
Mon Jun 29 16:47:14 EDT 2009


Minitoc is OK but the toc in each chapter takes a lot of room and  
titletoc allows in-chapter tocs to be inline. It took me a few hours  
to figure it out but here it is.

The following setup is for a MagnumOpus consisting of one included  
chapter (here) called ONE and the setup is for also allowing  
typesetting just one chapter---here ONE.

A. In the Chapters-contents Folder, I have any number of "contents  
file", here ONE.tex

	%!TEX root = ../Chapters-controls/ONE.tex
	\chapter{Some Things}
	\startcontents[chapters]
	\printcontents[chapters]{p-}{1}{}%The "p-" invokes the format for in- 
chapter tocs
	\vspace{10mm}

		Some introductory text

	\section{First Thing}
		A little bit of text
	\section{Second Thing}
		A little bit more text

B. In the Chapters-controls Folder, I have a "control file" for each  
"contents-file", here ONE.tex

\documentclass[11pt]{book}
\usepackage[dotinlabels]{titletoc}

\titlecontents{chapter}%Type of sectioning command
	[6pc]%Indentation from the left margin. NOT AN OPTIONAL ARGUMENT
	{%begin code to be executed before entry is typeset
		\addvspace{1pc}%Vertical space
		\bfseries%Affects the title
	%	\titlerule[2pt]
		\filright%
	}%end code to be executed before entry is typeset
	{%begin format numbered entries---in horizontal mode
		\contentslabel%The number of the entry
			[%
			\chaptername%
			\ %this slash puts a space between Chapter and number
			\thecontentslabel%
			]%
		{6pc}%Space between entry number and entry title
	}%end format numbered entries---in horizontal mode
	{%begin format numberless entries---in horizontal mode
	}%end format numberless entries---in horizontal mode
	{%begin dotted line and page number
		\hfill%
		\contentspage%
	}%end  dotted line and page number
	
\newcommand\xquad
{\hspace{1em plus .4em minus .4em}}

\titlecontents*{p-section}%Type of sectioning command. The "p-"  
reserves it for in-chapter tocs.
	[0pt]%Indentation from the left margin. NOT AN OPTIONAL ARGUMENT
	{%begin code to be executed before entry is typeset
		\filright%
		\small
	}%end code to be executed before entry is typeset
	{%begin format numbered entries---in horizontal mode
	}%end format numberless entries---in horizontal mode
	{%begin format numberless entries---in horizontal mode
	}%end format numberless entries---in horizontal mode
	{%begin dotted line and page number
	, ~\thecontentspage
	}%end dotted line and page number
	[%begin
	\xquad%
	---
%	\textbullet%
	\xquad
	]%end
	[%begin
	.
	]%end
%	[%begin
%	]%end
%=============================
\begin{document}
	\include{../Chapters-contents/ONE}
\end{document}
%=============================

C. In the Text Folder, I have the master file, MagnumOpus.tex, with  
the same preamble as the control file(s):

%=============================
\begin{document}
	\tableofcontents
	\include{../Chapters-contents/ONE}
	%one \include for each contents-file
\end{document}
%=============================

In reality, I have the preamble in a stylesheet where I also have

\newcommand{\ChapterToc}%
	{%Begin definition
		\startcontents[chapters]
		\printcontents[chapters]{p-}{1}{}
		\vspace{10mm}
	}%End definition

for the contents files.

(And I use \jobname in the control-files so that they are all the same.)

Regards
--schremmer








More information about the MacOSX-TeX mailing list