我必须做这个目录:
抱歉,图片太糟糕了,希望大家能够理解。
以下是一些解释:
目录有两列。但目录的标题(“TABLE ANALYTIQUE”)和副标题(“Les chiffres renvoient aux numéros de pages”)位于中间。我发现这但是当我尝试时,结果是:
有些标题有页码(\subsection、\subsubsection、\paragraph),有些则没有(\part、\chapter 和 \section)。
\part、\chapter 和 \section 都有这条小下划线,并且位于中央。
我的段落使用以下方式编号
\setcounter{secnumdepth}{4}
我的文件:
\documentclass[10pt,twoside]{book}
有人知道怎么做吗?提前谢谢!
答案1
组合包tocloft
,multitoc
,titlesec
, 和titletoc
:
\documentclass[12pt,twoside]{book}
\usepackage[T1]{fontenc}
\usepackage[margin=1in]{geometry}
\usepackage{helvet}
% Show Everything in ToC (https://tex.stackexchange.com/questions/17877/how-to-show-subsubsections-and-paragraphs-in-toc)
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{4}
% Redefine \contentsname. Do this before loading multitoc, otherwise a warning pops up (don't ask me about the details)
\usepackage{tocloft}
\renewcommand{\contentsname}{\parbox{\linewidth}{\centerline{\textsf{TABLE ANALYTIQUE}}~\\[-1.5cm]\centerline{\normalfont\itshape\footnotesize\textsf{Les chiffres renvoient aux num\'eros de pages}}}}
% Multi-column ToC
\usepackage[toc]{multitoc}
\renewcommand*{\multicolumntoc}{2}
\setlength{\columnsep}{1cm}
% Redefine Part (https://tex.stackexchange.com/questions/219819/customize-part-in-toc-by-titletoc)
\usepackage[newparttoc]{titlesec}
\titleformat{\part}[display]{}{}{0pt}{} % We're gonna redefine this with titletoc anyways
% Format Section Numbers
\renewcommand{\thesection}{\arabic{section}}
\renewcommand{\thesubsection}{\arabic{subsection}}
\renewcommand{\thesubsubsection}{\arabic{subsubsection}}
\renewcommand{\theparagraph}{\Roman{paragraph}}
% The Fun Begins (see page 15 of http://mirrors.ctan.org/macros/latex/contrib/titlesec/titlesec.pdf)
\usepackage{titletoc}
\titlecontents{part}[0pt]
{\addvspace{1pc}\filcenter}%
{\footnotesize\textsf{Livre \thecontentslabel}\\*[-1ex]\rule{5cm}{0.5pt}\\*[0.5em]\hfill\large\bfseries}
{}
{\hfill~}[\addvspace{.5pc}]
\titlecontents{chapter}[0pt]
{\addvspace{1pc}\filcenter}%
{\footnotesize\textsf{Partie \thecontentslabel}\\*[-1ex]\rule{7cm}{0.5pt}\\*[0.5em]\hfill\Large\bfseries}
{}
{\hfill~}[\addvspace{.5pc}]
\titlecontents{section}[0pt]
{\addvspace{1pc}\filcenter}%
{\footnotesize\textsf{Titre \thecontentslabel}\\*[-1ex]\rule{7cm}{0.5pt}\\*[0.5em]\hfill\large\bfseries}
{}
{\hfill~}[\addvspace{.5pc}]
\titlecontents{subsection}[0pt]
{\addvspace{1pc}}%
{\bfseries\contentspush{\textsf{\underline{\footnotesize Chapitre \thecontentslabel}\enspace}\large}}
{}
{\hfill\contentspage}[\addvspace{.5pc}]
\titlecontents{subsubsection}[0pt]
{\addvspace{.2pc}}%
{{\scriptsize\textsf{Section \thecontentslabel\enspace}}\small\bfseries}
{}
{\hfill\small\contentspage}[\addvspace{.2pc}]
\titlecontents{paragraph}[0pt]
{\addvspace{.2pc}}%
{{\footnotesize{\quad\thecontentslabel.\enspace}}\small\bfseries}
{}
{\hfill\small\contentspage}[\addvspace{.2pc}]
\begin{document}
\tableofcontents
\part{Part}\chapter{Chapter}\section{Section}\subsection{Subsection}\subsubsection{Subsubsection}\subsubsection{Subsubsection}\subsection{Subsection}\subsubsection{Subsubsection}\paragraph{Paragraph}\paragraph{Paragraph}\subsubsection{Subsubsection}\subsubsection{Subsubsection}\subsection{Subsection}\paragraph{Paragraph}\subsubsection{Subsubsection}\paragraph{Paragraph}\subsubsection{Subsubsection}\subsubsection{Subsubsection}\subsection{Subsection}\subsubsection{Subsubsection}\paragraph{Paragraph}\subsubsection{Subsubsection}\part{Part}\chapter{Chapter}\section{Section}\subsection{Subsection}\subsubsection{Subsubsection}\subsubsection{Subsubsection}\subsection{Subsection}\subsubsection{Subsubsection}\paragraph{Paragraph}\subsubsection{Subsubsection}
\end{document}