精美图表清单和表格清单

精美图表清单和表格清单

我是新来的,但对 LaTeX 并不陌生。

我的问题与该帖子中讨论的主题有关: 漂亮的目录

主题是关于如何制作漂亮的目录。我现在的问题是,我需要做什么才能在 LOF 和 LOT 上应用与 TOC 相同的漂亮布局样式?

我怎样才能覆盖pretty TOC layoutonLOFLOT


供你参考:

  • 我从链接的帖子中复制了我的最小工作示例Gonzalo Medina并对其进行了少许修改。
  • 我使用该类memoir作为我的最小工作示例。
  • 我添加了一个Part TOC(只是为了看看它是否好看等)。但是,在我看来,Part TOC只有当 a 可以与部分文本保持在同一页时,它才是好看的。否则,它看起来就不好看,然后必须考虑将 放在Part TOC下一页。顺便说一句,我不记得社区中是否有人已经发布了关于制作 的内容Part TOC。在这种情况下:你在这里!:-)
  • 我的最小工作示例在TOC和中使用了不同的颜色Part TOC(当然在两个目录中使用相同的颜色),以便更容易看到Pretty TOC代码部分下的序言中不同的代码块的作用。
  • hyperref使用带有命令的包时要小心\hypersetup!如果colorlinks设置为true,则章节文本中的(红色)颜色会TOC消失。
  • 此外,请注意,如果您希望在使用该命令时 URL 不是黑色,则需要手动为 URL 着色\url{}

    • [解决方案] 关于 URL 的方法是将\renewcommand{\UrlFont}{\color{cyan}}(或您想要的颜色...)应用\hypersetup在序言中的代码块之后!如果这样做,这将解决“缺少 URL 颜色”问题,允许\url您按照习惯使用该命令。

以下是我的最小工作示例:

\documentclass[a4paper,11pt,twoside,openright]{memoir}
\usepackage{fixltx2e}

\usepackage[english]{babel}

\usepackage[T1]{fontenc}
\usepackage{ae,aecompl}
\usepackage[utf8]{inputenx}

\usepackage{float}
\usepackage{graphicx}

\setlrmargins{*}{*}{1}
\setulmargins{*}{*}{1}
\checkandfixthelayout[nearest]

\usepackage{color}
\usepackage{xcolor}

\usepackage{mdframed}   
\usepackage{mathtools}
\usepackage{hyphenat}       % I use it to prevent hyphenation of table of contents items
\usepackage{refcount}
\usepackage{tikz}
\usetikzlibrary{calc}
%%% Do not include titletoc here - do it at the end of the "Pretty TOC" (very important!)
% WHY? Because then in the Part TOC, the next part will be displayed in the very end of that Part TOC! Of course, this will not happen in the very last Part TOC because there is no part after that...
% \usepackage{titletoc}             


%%% Pretty TOC
%%%%% adapted from http://tex.stackexchange.com/questions/35825/pretty-table-of-contents/35835
% a modification of the leftbar environment defined by the framed package
% will be used to place a vertical colored bar separating the page number and the
% title in chapter entries
\renewenvironment{leftbar}{%
  \def\FrameCommand{\textcolor{green}{\vrule width 1.5pt depth 0pt}\hspace*{15pt}}%
  \MakeFramed{\advance\hsize-\width\FrameRestore}}%
 {\endMakeFramed}

\makeatletter

% a command to circle the part numbers
\newcommand\Circle[1]{\tikz[overlay,remember picture] 
  \node[draw=blue,circle, text width=18pt,line width=1pt,align=center] {#1};}

% redefinitions for part entries
\renewcommand\cftpartfont{\Large\sffamily\bfseries}
\renewcommand\partnumberline[1]{%
    \hbox to \textwidth{\hss\Circle{\textcolor{red}{#1}}\hss}%
  \vskip 3.5ex\color{cyan}}

\renewcommand*{\l@part}[2]{%
  \ifnum \c@tocdepth >-2\relax
    \cftpartbreak
    \begingroup
      {\interlinepenalty\@M
       \leavevmode
       \settowidth{\@tempdima}{\cftpartfont\cftpartname}%
       \addtolength{\@tempdima}{\cftpartnumwidth}%
       \let\@cftbsnum \cftpartpresnum
       \let\@cftasnum \cftpartaftersnum
       \let\@cftasnumb \cftpartaftersnumb
       \advance\memRTLleftskip\@tempdima \null\nobreak\hskip -\memRTLleftskip
       \centering{\cftpartfont#1}\par%
       }
      \nobreak
        \global\@nobreaktrue
        \everypar{\global\@nobreakfalse\everypar{}}%
    \endgroup
  \fi}


% redefinitions for chapter entries
\renewcommand\chapternumberline[1]{\mbox{\small\@chapapp~#1}\par\noindent\Large}
\renewcommand\cftchapterfont{\sffamily}
\cftsetindents{chapter}{0pt}{0em}
\renewcommand\cftchapterpagefont{\large\sffamily\bfseries\color{blue}}

\newcommand*{\l@mychap}[3]{%
  \def\@chapapp{\large\color{cyan}#3}
  \vskip1ex%
  \par\noindent\begin{minipage}{\textwidth}%
  \parbox{4.5em}{%
    \hfill{\cftchapterpagefont#2}%
  }\hspace*{1.5em}%
  \parbox{\dimexpr\textwidth-4.5em-15pt\relax}{%
    \leftbar\cftchapterfont{\color{red}#1}\hspace{1sp}\endleftbar%
  }%
  \end{minipage}\par%
}
\renewcommand*{\l@chapter}[2]{%
  \l@mychap{#1}{#2}{\chaptername}%
}
\renewcommand*{\l@appendix}[2]{%
  \l@mychap{#1}{#2}{\appendixname}%
}

% redefinitions for section entries
\renewcommand\cftsectionfont{\sffamily\color{black}}
\renewcommand\cftsectionpagefont{\sffamily\itshape\color{blue}}
\renewcommand\cftsectionleader{\nobreak}
\renewcommand\cftsectiondotsep{\cftnodots}
\renewcommand\cftsectionafterpnum{\hspace*{\fill}}
\setlength\cftsectionnumwidth{12em}
\cftsetindents{section}{6em}{3em}
\renewcommand\cftsectionformatpnum[1]{%
  \hskip1em\hbox to \@pnumwidth{{\cftsectionpagefont #1\hfill}}}

% redefinitions for subsection entries
\renewcommand\cftsubsectionfont{\sffamily\color{black}}
\renewcommand\cftsubsectionpagefont{\sffamily\itshape\color{blue}}
\renewcommand\cftsubsectionleader{\nobreak}
\renewcommand\cftsubsectiondotsep{\cftnodots}
\renewcommand\cftsubsectionafterpnum{\hspace*{\fill}}
\setlength\cftsubsectionnumwidth{12em}
\cftsetindents{subsection}{9em}{3em}
\renewcommand\cftsubsectionformatpnum[1]{%
  \hskip1em\hbox to \@pnumwidth{{\cftsubsectionpagefont #1\hfill}}}
\makeatother

%%%% End of Pretty ToC

\settocdepth{subsection}
\setsecnumdepth{subsection}

% include after the change above (very important!)
\usepackage{titletoc}

\makeatletter
\def\@endpart{
%
  \vfil
  \textcolor{red}{\hrule height 1.5 pt}
\setcounter{tocdepth}{0}

    \startcontents[parts]
    \printcontents[parts]{}{0}{}

\textcolor{red}{\hrule height 1.5 pt}
  \par\bigskip
  \vfil\newpage
              \if@twoside
               \if@openright
                \null
                \thispagestyle{empty}%
                \newpage
               \fi
              \fi
              \if@tempswa
                \twocolumn
              \fi}
\makeatother
%%%

% be careful with the hyperref package; if colorlinks = true, then the (red) color in the chapter text in the TOC and  disappears! 
\usepackage{varioref,hyperref}
\hypersetup{
    bookmarks=true,                 % show bookmarks bar?
    unicode=false,                  % non-Latin characters in Acrobat’s bookmarks
    pdftoolbar=true,                % show Acrobat’s toolbar?
    pdfmenubar=true,                % show Acrobat’s menu?
    pdffitwindow=true ,             % window fit to page when opened
    pdfstartview={FitH},            % fits the width of the page to the window
    pdftitle={},                    % title
    pdfauthor={},   % author
    pdfsubject={},      % subject of the document
    pdfnewwindow=true,              % links in new window
    colorlinks=false,                   % false: boxed links; true: colored links
    linkcolor=black,                % color of internal links (change box color with linkbordercolor)
    citecolor=black,                % color of links to bibliography
    filecolor=black,                % color of file links
    %urlcolor=cyan              % color of external links
}

\renewcommand{\UrlFont}{\color{cyan}}   % must come after \hypersetup code block!

\begin{document}

\frontmatter

    \tableofcontents*
    \cleardoublepage
    \listoffigures
    \cleardoublepage
    \listoftables
    \cleardoublepage

\chapter{Foreword}
Be careful about the URLs. Because the colorlinks is set to false (in the hypersetup in the preamble), this is how the URL will look like: \newline

\url{http://tex.stackexchange.com/questions/169068} \newline

\noindent
If you would like to have the URLs in a specific colour, you have to manually colour code them: \newline

{\color{cyan}{\url{http://tex.stackexchange.com/questions/169068}}} \newline

\noindent
However, If you do not care about the chapter text colour in the TOC (if you want it black, which is standard), then the colorlinks can be set to true, which then should colour code the URLs automatically.


\mainmatter

\part{Designing with \TeX\ and \LaTeX}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\chapter{Beginning to learn design with \TeX}
\section{Another test section}
\section{Another test section}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\subsection{A test subsection}
\section{Another test section}
\subsection{A test subsection}
\subsection{A test subsection with a long title spanning more than one line in the table of contents}
\section{Another test section}
\section{Another test section}
\section{Another test section}



\chapter{Beginning to learn design with \LaTeX}
\section{A test section with a long title spanning more than one line in the table of contents}
\subsection{A test subsection}
\subsection{Another test subsection}
\section{A test section}
\phantomsection
\addcontentsline{toc}{section}{Test unnumbered section}
\section*{Test unnumbered section}
\subsection{A test subsection}
\section{Another test section}
\subsection{A test subsection}
\subsection{A test subsection}
\section{Another test section}
\section{Another test section}


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

\part{Designing with HTML}

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

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\section{Another test section}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\section{Another test section}
\subsection{A test subsection}
\section{Another test section with a long title spanning more than one line in the table of contents}
\subsection{A test subsection}
\section{Another test section}



\chapter{Beginning to learn design with HTML and some other text to span more than one line} 
\section{Another test section}
\section{Another test section}
\subsection{A test subsection}
\subsection{A test subsection with a long title spanning more than one line in the table of contents}
\section{Another test section}
\section{Another test section}
\subsection{A test subsection}



\appendix

\chapter{Test Appendix}
\section{Another test section}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\section{Another test section with a long title spanning more than one line in the table of contents}
\section{Another test section}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\subsection{A test subsection}
\section{Another test section}
\section{Another test section}

\end{document}

其中一些看起来是这样的:


目录


目录


劳伦斯


很多


URL 会受到怎样的影响


目录


目录


答案1

我不得不提供一个不同的答案,因为当我尝试编辑我之前的答案以包含新代码时,超过了 30,000 个字符的限制。

评论中建议进行一点修改:只有包含图形(表格)的章节的部分章节信息才会自动包含在 LoF(LoT,resp.)中。

\documentclass[a4paper,11pt,twoside,openright]{memoir}
\usepackage{fixltx2e}

\usepackage[english]{babel}

\usepackage[T1]{fontenc}
\usepackage{ae,aecompl}
\usepackage[utf8]{inputenx}

\usepackage{float}
\usepackage{graphicx}

\setlrmargins{*}{*}{1}
\setulmargins{*}{*}{1}
\checkandfixthelayout[nearest]

\usepackage{color}
\usepackage{xcolor}

\usepackage{mdframed}   
\usepackage{mathtools}
\usepackage{hyphenat}       % I use it to prevent hyphenation of table of contents items
\usepackage{refcount}
\usepackage{tikz}
\usetikzlibrary{calc}
%%% Do not include titletoc here - do it at the end of the "Pretty TOC" (very important!)
% WHY? Because then in the Part TOC, the next part will be displayed in the very end of that Part TOC! Of course, this will not happen in the very last Part TOC because there is no part after that...
% \usepackage{titletoc}             


%%% Pretty TOC
%%%%% adapted from http://tex.stackexchange.com/questions/35825/pretty-table-of-contents/35835
% a modification of the leftbar environment defined by the framed package
% will be used to place a vertical colored bar separating the page number and the
% title in chapter entries
\renewenvironment{leftbar}{%
  \def\FrameCommand{\textcolor{green}{\vrule width 1.5pt depth 0pt}\hspace*{15pt}}%
  \MakeFramed{\advance\hsize-\width\FrameRestore}}%
 {\endMakeFramed}

\makeatletter


% a command to circle the part numbers
\newcommand\Circle[1]{\tikz[overlay,remember picture] 
  \node[draw=blue,circle, text width=18pt,line width=1pt,align=center] {#1};}

% redefinitions for part entries
\renewcommand\cftpartfont{\Large\sffamily\bfseries}
\renewcommand\partnumberline[1]{%
    \hbox to \textwidth{\hss\Circle{\textcolor{red}{#1}}\hss}%
  \vskip 3.5ex\color{cyan}}

\renewcommand*{\l@part}[2]{%
  \ifnum \c@tocdepth >-2\relax
    \cftpartbreak
    \begingroup
      {\interlinepenalty\@M
       \leavevmode
       \settowidth{\@tempdima}{\cftpartfont\cftpartname}%
       \addtolength{\@tempdima}{\cftpartnumwidth}%
       \let\@cftbsnum \cftpartpresnum
       \let\@cftasnum \cftpartaftersnum
       \let\@cftasnumb \cftpartaftersnumb
       \advance\memRTLleftskip\@tempdima \null\nobreak\hskip -\memRTLleftskip
       \centering{\cftpartfont#1}\par%
       }
      \nobreak
        \global\@nobreaktrue
        \everypar{\global\@nobreakfalse\everypar{}}%
    \endgroup
  \fi}


% redefinitions for chapter entries
\renewcommand\chapternumberline[1]{\mbox{\small\@chapapp~#1}\par\noindent\Large}
\renewcommand\cftchapterfont{\sffamily}
\cftsetindents{chapter}{0pt}{0em}
\renewcommand\cftchapterpagefont{\large\sffamily\bfseries\color{blue}}

\newcommand*{\l@mychap}[3]{%
  \def\@chapapp{\large\color{cyan}#3}
  \vskip1ex%
  \par\noindent\begin{minipage}{\textwidth}%
  \parbox{4.5em}{%
    \hfill{\cftchapterpagefont#2}%
  }\hspace*{1.5em}%
  \parbox{\dimexpr\textwidth-4.5em-15pt\relax}{%
    \leftbar\cftchapterfont{\color{red}#1}\hspace{1sp}\endleftbar%
  }%
  \end{minipage}\par%
}
\renewcommand*{\l@chapter}[2]{%
  \l@mychap{#1}{#2}{\chaptername}%
}
\renewcommand*{\l@appendix}[2]{%
  \l@mychap{#1}{#2}{\appendixname}%
}

% redefinitions for section entries
\renewcommand\cftsectionfont{\sffamily\color{black}}
\renewcommand\cftsectionpagefont{\sffamily\itshape\color{blue}}
\renewcommand\cftsectionleader{\nobreak}
\renewcommand\cftsectiondotsep{\cftnodots}
\renewcommand\cftsectionafterpnum{\hspace*{\fill}}
\setlength\cftsectionnumwidth{12em}
\cftsetindents{section}{6em}{3em}
\renewcommand\cftsectionformatpnum[1]{%
  \hskip1em\hbox to \@pnumwidth{{\cftsectionpagefont #1\hfill}}}

% redefinitions for subsection entries
\renewcommand\cftsubsectionfont{\sffamily\color{black}}
\renewcommand\cftsubsectionpagefont{\sffamily\itshape\color{blue}}
\renewcommand\cftsubsectionleader{\nobreak}
\renewcommand\cftsubsectiondotsep{\cftnodots}
\renewcommand\cftsubsectionafterpnum{\hspace*{\fill}}
\setlength\cftsubsectionnumwidth{12em}
\cftsetindents{subsection}{9em}{3em}
\renewcommand\cftsubsectionformatpnum[1]{%
  \hskip1em\hbox to \@pnumwidth{{\cftsubsectionpagefont #1\hfill}}}

%%%% End of Pretty ToC

\settocdepth{subsection}
\setsecnumdepth{subsection}

% redefinitions for figure entries
\renewcommand\cftfigurefont{\sffamily\color{black}}
\renewcommand\cftfigurepagefont{\sffamily\itshape\color{blue}}
\renewcommand\cftfigureleader{\nobreak}
\renewcommand\cftfiguredotsep{\cftnodots}
\renewcommand\cftfigureafterpnum{\hspace*{\fill}}
\setlength\cftfigurenumwidth{12em}
\cftsetindents{figure}{6em}{3em}
\renewcommand\cftfigureformatpnum[1]{%
  \hskip1em\hbox to \@pnumwidth{{\cftfigurepagefont #1\hfill}}}

% redefinitions for table entries
\renewcommand\cfttablefont{\sffamily\color{black}}
\renewcommand\cfttablepagefont{\sffamily\itshape\color{blue}}
\renewcommand\cfttableleader{\nobreak}
\renewcommand\cfttabledotsep{\cftnodots}
\renewcommand\cfttableafterpnum{\hspace*{\fill}}
\setlength\cfttablenumwidth{12em}
\cftsetindents{table}{6em}{3em}
\renewcommand\cfttableformatpnum[1]{%
  \hskip1em\hbox to \@pnumwidth{{\cfttablepagefont #1\hfill}}}

\usepackage{etoolbox}  % or xpatch

% the following code adds chapter information into the LoF 
% for chapters containing figures
% initial definitions of the chapter info (name and number)
\def\thischaptertitle{}\def\thischapternumber{}
\newtoggle{noFigs}

\apptocmd{\@chapter}%
  {\gdef\thischaptertitle{#2}\gdef\thischapternumber{\thechapter}%
    \global\toggletrue{noFigs}}{}{}

% the figure environment does the job: the first time it is used after a \chapter command, 
% it writes the information of the chapter to the LoF
\AtBeginDocument{%
  \AtBeginEnvironment{figure}{%
    \iftoggle{noFigs}{
      \addtocontents{lof}{\protect\contentsline {chapter}%
        {\protect\numberline {\large\color{cyan}\@chapapp~\thischapternumber}{\thischaptertitle}}{}{} }
      \global\togglefalse{noFigs}
    }{}
  }%
}

% the following code adds chapter information into the LoT 
% for chapters containing tables
\newtoggle{noTabs}

\apptocmd{\@chapter}%
  {\gdef\thischaptertitle{#2}\gdef\thischapternumber{\thechapter}%
    \global\toggletrue{noTabs}}{}{}

% the table environment does the job: the first time it is used after a \chapter command, 
% it writes the information of the chapter to the LoT
\AtBeginDocument{%
  \AtBeginEnvironment{table}{%
    \iftoggle{noTabs}{
      \addtocontents{lot}{\protect\contentsline {chapter}%
        {\protect\numberline {\large\color{cyan}\@chapapp~\thischapternumber}{\thischaptertitle}}{}{} }
      \global\togglefalse{noTabs}
    }{}
  }%
}

% include after the change above (very important!)
\usepackage{titletoc}

\def\@endpart{
%
  \vfil
  \textcolor{red}{\hrule height 1.5 pt}
\setcounter{tocdepth}{0}

    \startcontents[parts]
    \printcontents[parts]{}{0}{} % change 0 to 1 etc. for more detail and vice versa

\textcolor{red}{\hrule height 1.5 pt}
  \par\bigskip
  \vfil\newpage
              \if@twoside
               \if@openright
                \null
                \thispagestyle{empty}%
                \newpage
               \fi
              \fi
              \if@tempswa
                \twocolumn
              \fi}
\makeatother
%%%

% be careful with the hyperref package; if colorlinks = true, then the (red) color in the chapter text in the TOC and  disappears! 
\usepackage{varioref,hyperref}
\hypersetup{
    bookmarks=true,                 % show bookmarks bar?
    unicode=false,                  % non-Latin characters in Acrobat’s bookmarks
    pdftoolbar=true,                % show Acrobat’s toolbar?
    pdfmenubar=true,                % show Acrobat’s menu?
    pdffitwindow=true ,             % window fit to page when opened
    pdfstartview={FitH},            % fits the width of the page to the window
    pdftitle={},                    % title
    pdfauthor={},   % author
    pdfsubject={},      % subject of the document
    pdfnewwindow=true,              % links in new window
    hidelinks=true,
    colorlinks=false,                   % false: boxed links; true: colored links
    linkcolor=black,                % color of internal links (change box color with linkbordercolor)
    citecolor=black,                % color of links to bibliography
    filecolor=black,                % color of file links
    urlcolor=aau-purple             % color of external links
}

\begin{document}

\frontmatter

    \tableofcontents*
    \cleardoublepage
    \listoffigures
    \cleardoublepage
    \listoftables
    \cleardoublepage

\chapter{Foreword}
Be careful about the URLs. Because the colorlinks is set to false (in the hypersetup in the preamble), this is how the URL will look like: \newline

\url{http://tex.stackexchange.com/posts/169068/edit} \newline

\noindent
If you would like to have the URLs in a specific colour, you have to manually colour code them: \newline

{\color{cyan}{\url{http://tex.stackexchange.com/posts/169068/edit}}} \newline

\noindent
However, If you do not care about the chapter  text colour in the TOC (if you want it black, which is standard), then the colorlinks can be set to true, which then should colour code the URLs automatically.


\mainmatter

\part{Designing with \TeX\ and \LaTeX}

\chapter{A test chapter}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\chapter{Beginning to learn design with \TeX}
\section{Another test section}
\section{Another test section}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\subsection{A test subsection}
\section{Another test section}
\subsection{A test subsection}
\subsection{A test subsection with a long title spanning more than one line in the table of contents}
\section{Another test section}
\section{Another test section}
\section{Another test section}



\chapter{Beginning to learn design with \LaTeX}
\section{A test section with a long title spanning more than one line in the table of contents}
\subsection{A test subsection}
\subsection{Another test subsection}
\section{A test section}
\phantomsection
\addcontentsline{toc}{section}{Test unnumbered section}
\section*{Test unnumbered section}
\subsection{A test subsection}
\section{Another test section}
\subsection{A test subsection}
\subsection{A test subsection}
\section{Another test section}
\section{Another test section}


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

\part{Designing with HTML}

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

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\section{Another test section}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\section{Another test section}
\subsection{A test subsection}
\section{Another test section with a long title spanning more than one line in the table of contents}
\subsection{A test subsection}
\section{Another test section}



\chapter{Beginning to learn design with HTML and some other text to span more than one line} 
\section{Another test section}
\section{Another test section}
\subsection{A test subsection}
\subsection{A test subsection with a long title spanning more than one line in the table of contents}
\section{Another test section}
\section{Another test section}
\subsection{A test subsection}



\appendix

\chapter{Test Appendix}
\section{Another test section}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\section{Another test section with a long title spanning more than one line in the table of contents}
\section{Another test section}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\subsection{A test subsection}
\section{Another test section}
\section{Another test section}

\end{document}

新生成的 LoF 的图像:

在此处输入图片描述

新生成的 LoT 的图像:

在此处输入图片描述

答案2

一个选项;我使用部分条目的设置来格式化图形和表格条目(唯一的变化是,6em我使用而不是4em图形和表格条目的缩进):

\documentclass[a4paper,11pt,twoside,openright]{memoir}
\usepackage{fixltx2e}

\usepackage[english]{babel}

\usepackage[T1]{fontenc}
\usepackage{ae,aecompl}
\usepackage[utf8]{inputenx}

\usepackage{float}
\usepackage{graphicx}

\setlrmargins{*}{*}{1}
\setulmargins{*}{*}{1}
\checkandfixthelayout[nearest]

\usepackage{color}
\usepackage{xcolor}

\usepackage{mdframed}   
\usepackage{mathtools}
\usepackage{hyphenat}       % I use it to prevent hyphenation of table of contents items
\usepackage{refcount}
\usepackage{tikz}
\usetikzlibrary{calc}
%%% Do not include titletoc here - do it at the end of the "Pretty TOC" (very important!)
% WHY? Because then in the Part TOC, the next part will be displayed in the very end of that Part TOC! Of course, this will not happen in the very last Part TOC because there is no part after that...
% \usepackage{titletoc}             


%%% Pretty TOC
%%%%% adapted from http://tex.stackexchange.com/questions/35825/pretty-table-of-contents/35835
% a modification of the leftbar environment defined by the framed package
% will be used to place a vertical colored bar separating the page number and the
% title in chapter entries
\renewenvironment{leftbar}{%
  \def\FrameCommand{\textcolor{green}{\vrule width 1.5pt depth 0pt}\hspace*{15pt}}%
  \MakeFramed{\advance\hsize-\width\FrameRestore}}%
 {\endMakeFramed}

\makeatletter

% a command to circle the part numbers
\newcommand\Circle[1]{\tikz[overlay,remember picture] 
  \node[draw=blue,circle, text width=18pt,line width=1pt,align=center] {#1};}

% redefinitions for part entries
\renewcommand\cftpartfont{\Large\sffamily\bfseries}
\renewcommand\partnumberline[1]{%
    \hbox to \textwidth{\hss\Circle{\textcolor{red}{#1}}\hss}%
  \vskip 3.5ex\color{cyan}}

\renewcommand*{\l@part}[2]{%
  \ifnum \c@tocdepth >-2\relax
    \cftpartbreak
    \begingroup
      {\interlinepenalty\@M
       \leavevmode
       \settowidth{\@tempdima}{\cftpartfont\cftpartname}%
       \addtolength{\@tempdima}{\cftpartnumwidth}%
       \let\@cftbsnum \cftpartpresnum
       \let\@cftasnum \cftpartaftersnum
       \let\@cftasnumb \cftpartaftersnumb
       \advance\memRTLleftskip\@tempdima \null\nobreak\hskip -\memRTLleftskip
       \centering{\cftpartfont#1}\par%
       }
      \nobreak
        \global\@nobreaktrue
        \everypar{\global\@nobreakfalse\everypar{}}%
    \endgroup
  \fi}


% redefinitions for chapter entries
\renewcommand\chapternumberline[1]{\mbox{\small\@chapapp~#1}\par\noindent\Large}
\renewcommand\cftchapterfont{\sffamily}
\cftsetindents{chapter}{0pt}{0em}
\renewcommand\cftchapterpagefont{\large\sffamily\bfseries\color{blue}}

\newcommand*{\l@mychap}[3]{%
  \def\@chapapp{\large\color{cyan}#3}
  \vskip1ex%
  \par\noindent\begin{minipage}{\textwidth}%
  \parbox{4.5em}{%
    \hfill{\cftchapterpagefont#2}%
  }\hspace*{1.5em}%
  \parbox{\dimexpr\textwidth-4.5em-15pt\relax}{%
    \leftbar\cftchapterfont{\color{red}#1}\hspace{1sp}\endleftbar%
  }%
  \end{minipage}\par%
}
\renewcommand*{\l@chapter}[2]{%
  \l@mychap{#1}{#2}{\chaptername}%
}
\renewcommand*{\l@appendix}[2]{%
  \l@mychap{#1}{#2}{\appendixname}%
}

% redefinitions for section entries
\renewcommand\cftsectionfont{\sffamily\color{black}}
\renewcommand\cftsectionpagefont{\sffamily\itshape\color{blue}}
\renewcommand\cftsectionleader{\nobreak}
\renewcommand\cftsectiondotsep{\cftnodots}
\renewcommand\cftsectionafterpnum{\hspace*{\fill}}
\setlength\cftsectionnumwidth{12em}
\cftsetindents{section}{6em}{3em}
\renewcommand\cftsectionformatpnum[1]{%
  \hskip1em\hbox to \@pnumwidth{{\cftsectionpagefont #1\hfill}}}

% redefinitions for subsection entries
\renewcommand\cftsubsectionfont{\sffamily\color{black}}
\renewcommand\cftsubsectionpagefont{\sffamily\itshape\color{blue}}
\renewcommand\cftsubsectionleader{\nobreak}
\renewcommand\cftsubsectiondotsep{\cftnodots}
\renewcommand\cftsubsectionafterpnum{\hspace*{\fill}}
\setlength\cftsubsectionnumwidth{12em}
\cftsetindents{subsection}{9em}{3em}
\renewcommand\cftsubsectionformatpnum[1]{%
  \hskip1em\hbox to \@pnumwidth{{\cftsubsectionpagefont #1\hfill}}}

%%%% End of Pretty ToC

\settocdepth{subsection}
\setsecnumdepth{subsection}

% redefinitions for figure entries
\renewcommand\cftfigurefont{\sffamily\color{black}}
\renewcommand\cftfigurepagefont{\sffamily\itshape\color{blue}}
\renewcommand\cftfigureleader{\nobreak}
\renewcommand\cftfiguredotsep{\cftnodots}
\renewcommand\cftfigureafterpnum{\hspace*{\fill}}
\setlength\cftfigurenumwidth{12em}
\cftsetindents{figure}{4em}{3em}
\renewcommand\cftfigureformatpnum[1]{%
  \hskip1em\hbox to \@pnumwidth{{\cftfigurepagefont #1\hfill}}}

% redefinitions for table entries
\renewcommand\cfttablefont{\sffamily\color{black}}
\renewcommand\cfttablepagefont{\sffamily\itshape\color{blue}}
\renewcommand\cfttableleader{\nobreak}
\renewcommand\cfttabledotsep{\cftnodots}
\renewcommand\cfttableafterpnum{\hspace*{\fill}}
\setlength\cfttablenumwidth{12em}
\cftsetindents{table}{4em}{3em}
\renewcommand\cfttableformatpnum[1]{%
  \hskip1em\hbox to \@pnumwidth{{\cfttablepagefont #1\hfill}}}

% include after the change above (very important!)
\usepackage{titletoc}

\def\@endpart{
%
  \vfil
  \textcolor{red}{\hrule height 1.5 pt}
\setcounter{tocdepth}{0}

    \startcontents[parts]
    \printcontents[parts]{}{0}{} % change 0 to 1 etc. for more detail and vice versa

\textcolor{red}{\hrule height 1.5 pt}
  \par\bigskip
  \vfil\newpage
              \if@twoside
               \if@openright
                \null
                \thispagestyle{empty}%
                \newpage
               \fi
              \fi
              \if@tempswa
                \twocolumn
              \fi}
\makeatother
%%%

% be careful with the hyperref package; if colorlinks = true, then the (red) color in the chapter text in the TOC and  disappears! 
\usepackage{varioref,hyperref}
\hypersetup{
    bookmarks=true,                 % show bookmarks bar?
    unicode=false,                  % non-Latin characters in Acrobat’s bookmarks
    pdftoolbar=true,                % show Acrobat’s toolbar?
    pdfmenubar=true,                % show Acrobat’s menu?
    pdffitwindow=true ,             % window fit to page when opened
    pdfstartview={FitH},            % fits the width of the page to the window
    pdftitle={},                    % title
    pdfauthor={},   % author
    pdfsubject={},      % subject of the document
    pdfnewwindow=true,              % links in new window
    hidelinks=true,
    colorlinks=false,                   % false: boxed links; true: colored links
    linkcolor=black,                % color of internal links (change box color with linkbordercolor)
    citecolor=black,                % color of links to bibliography
    filecolor=black,                % color of file links
    urlcolor=aau-purple             % color of external links
}

\begin{document}

\frontmatter

    \tableofcontents*
    \cleardoublepage
    \listoffigures
    \cleardoublepage
    \listoftables
    \cleardoublepage

\chapter{Foreword}
Be careful about the URLs. Because the colorlinks is set to false (in the hypersetup in the preamble), this is how the URL will look like: \newline

\url{http://tex.stackexchange.com/posts/169068/edit} \newline

\noindent
If you would like to have the URLs in a specific colour, you have to manually colour code them: \newline

{\color{cyan}{\url{http://tex.stackexchange.com/posts/169068/edit}}} \newline

\noindent
However, If you do not care about the chapter  text colour in the TOC (if you want it black, which is standard), then the colorlinks can be set to true, which then should colour code the URLs automatically.


\mainmatter

\part{Designing with \TeX\ and \LaTeX}

\chapter{A test chapter}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\chapter{Beginning to learn design with \TeX}
\section{Another test section}
\section{Another test section}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\subsection{A test subsection}
\section{Another test section}
\subsection{A test subsection}
\subsection{A test subsection with a long title spanning more than one line in the table of contents}
\section{Another test section}
\section{Another test section}
\section{Another test section}



\chapter{Beginning to learn design with \LaTeX}
\section{A test section with a long title spanning more than one line in the table of contents}
\subsection{A test subsection}
\subsection{Another test subsection}
\section{A test section}
\phantomsection
\addcontentsline{toc}{section}{Test unnumbered section}
\section*{Test unnumbered section}
\subsection{A test subsection}
\section{Another test section}
\subsection{A test subsection}
\subsection{A test subsection}
\section{Another test section}
\section{Another test section}


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

\part{Designing with HTML}

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

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\section{Another test section}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\section{Another test section}
\subsection{A test subsection}
\section{Another test section with a long title spanning more than one line in the table of contents}
\subsection{A test subsection}
\section{Another test section}



\chapter{Beginning to learn design with HTML and some other text to span more than one line} 
\section{Another test section}
\section{Another test section}
\subsection{A test subsection}
\subsection{A test subsection with a long title spanning more than one line in the table of contents}
\section{Another test section}
\section{Another test section}
\subsection{A test subsection}



\appendix

\chapter{Test Appendix}
\section{Another test section}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\begin{figure}[H]
    \caption[(short) caption that goes to the LOF.]{(long) caption that goes below the figure}
\end{figure}

\section{Another test section with a long title spanning more than one line in the table of contents}
\section{Another test section}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\begin{table}[H]
    \caption[(short) caption that goes to the LOT.]{(long) caption that goes below the figure}
\end{table}

\subsection{A test subsection}
\section{Another test section}
\section{Another test section}

\end{document}

目录的前两页:

在此处输入图片描述

LoF:

在此处输入图片描述

物联世界:

在此处输入图片描述

答案3

Gonzalo Medina很好地回答了我的问题。由于我希望垂直(绿色)条与 LOF 和 LOT 中的图号和表号完美对齐(就像在 TOC 中一样,但那时将是章节和小节编号),我决定修改:

  • \cftsetindents{figure}{6em}{3em}\cftsetindents{figure}{5.25em}{3em}% 重新定义图形条目代码块中
  • \cftsetindents{table}{6em}{3em}\cftsetindents{table}{5.25em}{3em}% 重新定义表条目代码块中

这个小修改将垂直(绿色)线与浮点数对齐,如下所示:


劳伦斯


很多


目录


洛夫/洛特


相关内容