修改表格/图像列表

修改表格/图像列表

我想定制与此类似的设计的图表列表:

修改 mini-toc 内容

有人知道如何对表格/图像列表进行类似的设计吗?

答案1

titletoc包还可用于自定义图表列表。从\dottedcontents\titlecontents命令的文档中:

“section” 是不带反斜杠的节名:part、chapter、section 等。figure 和 table 也是允许的。(省略反斜杠是因为我们处理的是概念,而不是\part\section等宏本身。此外,figure 和 table 是环境。)

您可以轻松调整所提答案中的代码以获得所需的结果:

\titlecontents{figure}
  [0em]{\vspace*{2\baselineskip}}
  {\parbox{4.5em}{%
    \hfill\Huge\sffamily\bfseries\color{myred}\thecontentspage}%
   \vspace*{-2.3\baselineskip}\leftbar\textsc{\small Figure~\thecontentslabel}\\\sffamily}
  {}{\endleftbar}

在此处输入图片描述


编辑1:

为了进一步定制,您可以从宏中提取当前章节的值\thecontentslabel,例如:

\makeatletter
\titlecontents{figure}
  [0em]{\vspace*{2\baselineskip}}
  {\parbox{4.5em}{%
    \hfill\Huge\sffamily\bfseries\color{myred}\thecontentspage}%
   \vspace*{-2.3\baselineskip}\leftbar 
   \textsc{\small \chaptername~\expandafter\@car\thecontentslabel\@nil\ // %
     Figure~\thecontentslabel}\\\sffamily}
  {}{\endleftbar}
\makeatother

编辑2:

您可以将任何类型的材料插入 via 中lof。例如,您可以定义一个在之后调用的\addtocontents命令,以将标题插入到格式类似于节的 via 中。也许您可以根据需要自定义此方法。代码:\updatemylof\chapterlof

\documentclass{book}
\usepackage{xcolor,framed,titletoc,lmodern}

\definecolor{myred}{RGB}{127,0,0}
\definecolor{myyellow}{RGB}{169,121,69}

\renewenvironment{leftbar}{%
  \def\FrameCommand{%
    \hspace{6em}%
    {\color{myyellow}\vrule width 2pt depth 6pt}%
    \hspace{1em}%
  }%
  \MakeFramed{\parshape 1 0cm \dimexpr\textwidth-6em\relax\FrameRestore}\vskip2pt\relax
  }
 {\endMakeFramed}

\titlecontents{chapter}
  [0em]{\vspace*{2\baselineskip}}
  {\parbox{4.5em}{%
    \hfill\Huge\sffamily\bfseries\color{myred}\thecontentspage}%
   \vspace*{-2.3\baselineskip}\leftbar
   \textsc{\small\chaptername~\thecontentslabel}\\\sffamily}
  {}{\endleftbar}
\titlecontents{section}
  [8.4em]
  {\sffamily\contentslabel{3em}}{}{}
  {\hspace{0.5em}\nobreak\itshape\color{myred}\contentspage}
\titlecontents{subsection}
  [8.4em]
  {\sffamily\contentslabel{3em}}{}{}  
  {\hspace{0.5em}\nobreak\itshape\color{myred}\contentspage}

\titlecontents{figure}
  [0em]{\vspace*{2\baselineskip}}
  {\parbox{4.5em}{%
    \hfill\Huge\sffamily\bfseries\color{myred}\thecontentspage}%
   \vspace*{-2.3\baselineskip}\leftbar
   \textsc{\small Figure~\thecontentslabel}\\\sffamily}
  {}{\endleftbar}

\newcommand*\updatemylof{%
  \addtocontents{lof}{\protect\section*{Chapter~\thechapter}}%
}

\begin{document}

\tableofcontents
\listoffigures

\chapter{Beginning to learn design with \LaTeX}
\section{This is a test section}
\subsection{Long subsection title and some other text to span more
  than one line}

\newpage\setcounter{page}{123}% just for the example

\chapter{Beginning to learn design with HTML and some other text to
  span more than one line in the ToC}
\updatemylof

\section{This is a test section}
\subsection{Long subsection title and some other text to span more
  than one line}

\cleardoublepage
\begin{figure}\caption{Caption of figure}\end{figure}
\clearpage
\begin{figure}\caption{Caption of figure}\end{figure}

\chapter{Further learning}
\updatemylof

\begin{figure}\caption{Caption of figure}\end{figure}
\begin{figure}\caption{Caption of figure}\end{figure}

\end{document}

在此处输入图片描述

相关内容