按照 Legrand Orange 书的风格重现 ToC 风格,并加入回忆录类

按照 Legrand Orange 书的风格重现 ToC 风格,并加入回忆录类

我正在尝试使用回忆录类重现《罗格朗橙皮书》的目录风格。我不是回忆录类的专家,除了目录标题和部分之外,我设法使它看起来相似。

目录

我的 MWE 是这样的

\documentclass[twoside,openright]{memoir}
% color definition
\usepackage{xcolor}
\definecolor{ocre}{RGB}{243,102,25}

% ToC depth
\setsecnumdepth{subsection}
\maxtocdepth{subsection}

% page style for ToC
\makepagestyle{toc}
\makeevenfoot{toc}{}{}{}
\makeoddfoot{toc}{}{}{}
\makeevenhead{toc}{}{}{}
\makeoddhead{toc}{}{}{}

% New name for title of ToC
\renewcommand{\contentsname}{Contents}
% apply necessary setup before \tableofcontents
\addtodef{\tableofcontents}{\clearpage\pagestyle{toc}}{}

% begin of ToC setup
%% distance between toctitle and the first item of list
\renewcommand*{\aftertoctitle}{\thispagestyle{plain}%
  \par\nobreak \mbox{}\hfill{\normalfont Page}\par\nobreak}

%% setup for part
\renewcommand*{\cftpartfont}{\bfseries\Large}
% \renewcommand*{\partnumberline}[1]{\colorbox{ocre!20}{\strut\parbox[c][.7cm]{1.5cm}{\color{ocre!70}\Large\sffamily \bfseries\centering#1}}}
\cftsetindents{part}{0em}{5.0em}

%% setup for chapter
\renewcommand*{\cftchapterfont}{\color{ocre}\bfseries}
\renewcommand*{\cftchapterpagefont}{\color{ocre!60}\bfseries}
\renewcommand*{\cftchapterleader}{%
  \color{ocre!60}\cftdotfill{\cftchapterdotsep}}
\renewcommand*{\cftchapterdotsep}{\cftdotsep}
\cftsetindents{chapter}{0em}{5.0em}

%% setup for section
\renewcommand*{\cftsectionfont}{\bfseries}
\renewcommand*{\cftsectionpagefont}{\bfseries}
% \renewcommand*{\cftsectionleader}{%
%   \cftsectionfont\cftdotfill{\cftsectiondotsep}}
% \renewcommand*{\cftsectiondotsep}{\cftdotsep}
\cftsetindents{section}{0em}{5.0em}

%% setup for subsection
\renewcommand*{\cftsubsectionfont}{\normalfont}
\renewcommand*{\cftsubsectionpagefont}{\normalfont}
% \renewcommand*{\cftsubsectionleader}{%
%   \cftchapterfont\cftdotfill{\cftchapterdotsep}}
% \renewcommand*{\cftsubsectiondotsep}{\cftdotsep}
\cftsetindents{subsection}{0em}{5.0em}


\begin{document}

\frontmatter
\begin{KeepFromToc}
\tableofcontents
\end{KeepFromToc}

\mainmatter

\part{Part One}
\chapter{Text Chapter}
\section{Paragraphs of Text}
\section{Citation}
\section{Lists}
\subsection{Numbered List}
\subsection{Bullet Points}
\subsection{Descriptions and Definitions}

\part{Part Two}

\part{Part Three}

\end{document}

在此处输入图片描述

任何意见将是有益的。

答案1

我对您的 MWE 做了一些补充以满足您的要求。

% orangetocprob.tex SE 536302 ToC styled like Legrand Orange book

\documentclass[twoside,openright]{memoir}
% color definition
\usepackage{xcolor}
\definecolor{ocre}{RGB}{243,102,25}

% ToC depth
\setsecnumdepth{subsection}
\maxtocdepth{subsection}

% page style for ToC
\makepagestyle{toc}
\makeevenfoot{toc}{}{}{}
\makeoddfoot{toc}{}{}{}
\makeevenhead{toc}{}{}{}
\makeoddhead{toc}{}{}{}

% New name for title of ToC
\renewcommand{\contentsname}{Contents}
% apply necessary setup before \tableofcontents
\addtodef{\tableofcontents}{\clearpage\pagestyle{toc}}{}

% begin of ToC setup
%% distance between toctitle and the first item of list
\renewcommand*{\aftertoctitle}{\thispagestyle{plain}%
  \par\nobreak \mbox{}\hfill{\normalfont Page}\par\nobreak}

%% setup for part
\renewcommand*{\cftpartfont}{\bfseries\Large}
% \renewcommand*{\partnumberline}[1]{\colorbox{ocre!20}{\strut\parbox[c][.7cm]{1.5cm}{\color{ocre!70}\Large\sffamily \bfseries\centering#1}}}
\cftsetindents{part}{0em}{5.0em}
\cftpagenumbersoff{part} % PW added
\renewcommand{\cftpartaftersnumb}{\hfil} % PW added

%% setup for chapter
\renewcommand*{\cftchapterfont}{\color{ocre}\bfseries}
\renewcommand*{\cftchapterpagefont}{\color{ocre!60}\bfseries}
\renewcommand*{\cftchapterleader}{%
  \color{ocre!60}\cftdotfill{\cftchapterdotsep}}
\renewcommand*{\cftchapterdotsep}{\cftdotsep}
\cftsetindents{chapter}{0em}{5.0em}

%% setup for section
\renewcommand*{\cftsectionfont}{\bfseries}
\renewcommand*{\cftsectionpagefont}{\bfseries}
% \renewcommand*{\cftsectionleader}{%
%   \cftsectionfont\cftdotfill{\cftsectiondotsep}}
% \renewcommand*{\cftsectiondotsep}{\cftdotsep}
\cftsetindents{section}{0em}{5.0em}
\renewcommand{\cftsectiondotsep}{\cftnodots}  % PW added

%% setup for subsection
\renewcommand*{\cftsubsectionfont}{\normalfont}
\renewcommand*{\cftsubsectionpagefont}{\normalfont}
% \renewcommand*{\cftsubsectionleader}{%
%   \cftchapterfont\cftdotfill{\cftchapterdotsep}}
% \renewcommand*{\cftsubsectiondotsep}{\cftdotsep}
\cftsetindents{subsection}{0em}{5.0em}


\begin{document}

\frontmatter
\begin{KeepFromToc}
\tableofcontents
\end{KeepFromToc}

\mainmatter

\part{Part One}
\chapter{Text Chapter}
\section{Paragraphs of Text}
\section{Citation}
\section{Lists}
\subsection{Numbered List}
\subsection{Bullet Points}
\subsection{Descriptions and Definitions}

\part{Part Two}

\part{Part Three}

\end{document}

我已用 标记了我的添加% PW added

对于part条目,我已将标题居中并删除了页码。对于section条目,我已删除了虚线。

您的 Legrand Orange 书籍示例未包含Page上述页码,但您已将其添加到 MWE 中。我完全不确定您想如何准确地遵循您给出的示例。

我是色盲,不会做任何花哨的事情,所以我把其他事情都留给你去做。

答案2

这是目录部分条目的回忆录样式副本。章节和部分条目当然可以从您自己的代码、第一个答案或回忆录手册中获取。下面是输出图。

在此处输入图片描述

\newcommand{\TOCind}{40pt}% indent lmarg-nr

%-----------------------------------------------------------%
%                           PART                            %
\makeatletter%
\setlength{\cftbeforepartskip}%
    {55\p@ \@plus 50\p@ \@minus 20\p@}% vertical sep before part boxes
\newlength{\psep}
    \setlength{\psep}{5pt}% horizontal sep between part-boxes
\cftpagenumbersoff{part}% no pagenr part

\cftsetindents{part}{0pt}{0pt}% indent, numwidth
\renewcommand{\cftpartfont}{\LARGE\sffamily\bfseries\centering}% font chapter

\newcommand{\@mypartnumtocformat}[2]{% #1 number, #2 part title
        \noindent\fboxsep=0pt\fboxrule=0pt%
     {\colorbox{orange!40}{\parbox[c][33pt][c]{\TOCind-\psep}%
        {\cftpartfont\textcolor{orange}{#1}}}% I, II (part nr)
  \hspace*{\psep}% horizontal sep between part-boxes
     \colorbox{orange!80}{\parbox[c][33pt][c]{\textwidth-\TOCind}%
        {\cftpartfont\textcolor{white}% Part I - Title
            {\partname\space\,#1\enspace\textemdash\enspace#2}}}}\par}%

\patchcmd{\@part}%
    {\addcontentsline{toc}{part}%
        {\protect\partnumberline{\thepart}\f@rtoc}}% code to replace
    {\phantomsection\addcontentsline{toc}{part}{\texorpdfstring%
        {\protect\@mypartnumtocformat{\thepart}{\f@rtoc}}%
        {\partname~\thepart---#2}}}{}{}% new code with new part toc format

\makeatother%

相关内容