将章节标题样式转换为 TOC、LOF、LOT 标题

将章节标题样式转换为 TOC、LOF、LOT 标题

这是我上一篇(已回答)的延续问题

我想将 TOC、LOF 和 LOT 的标题样式设置为与 Sectioning-Titles 完全相同。问题是它们 (a) 比普通\chapter标题“高”(意味着“页眉”和标题正文之间的空间较小)和 (b) 标题正文和标题规则之间的空间明显不同。

示例(当前进度):

\documentclass[twoside=false]{book}

\usepackage{tocloft}

        \usepackage[ngerman]{babel}             
        \usepackage[T1]{fontenc}
        \usepackage{lmodern}
        \usepackage[ansinew]{inputenc}      
        \usepackage{tgheros}                            
        \usepackage[expert]{mathdesign}     
        \usepackage{amssymb}                            
        \usepackage{ae,aecompl}                     
        \usepackage{charter}                            



%-------Styling of Titles-------%
\usepackage{titlesec}

\titleclass{\part}{top}
\titleclass{\chapter}{straight}

\titleformat{\part}[hang]
  {\usefont{T1}{qhv}{b}{n}\selectfont\huge\raggedright}{\thepart}
  {20pt}{\Huge}
\titleformat{\chapter}[hang]
  {\usefont{T1}{qhv}{b}{n}\selectfont\huge\raggedright}{\thechapter}
  {20pt}{\Huge}[\vskip8pt{\titlerule[1.5pt]}]

\titlespacing*{\part}
  {0pt}{50pt}{40pt}
\titlespacing*{\chapter}
  {0pt}{0pt}{20pt}

%--------------------------------%

%-------Styling of TOC-, LOT-, LOF-Titles-------------------------%
    \usepackage{tocloft}
%------ TOC ---------------------------------------%
        \renewcommand{\cfttoctitlefont}{\usefont{T1}{qhv}{b}{n}\selectfont\huge} 
                \addtolength{\cftbeforetoctitleskip}{4.0ex}
                \renewcommand{\cftaftertoctitle}{
    \vskip8pt{\titlerule[1.5pt]
    %           \vspace{4.5ex}
    %           \hrule height 1.5pt
    %           \vspace{-2.6ex
                }}
    %------LOF-----------%
        \renewcommand{\cftloftitlefont}{\usefont{T1}{qhv}{b}{n}\selectfont\huge}
                \addtolength{\cftbeforeloftitleskip}{4.0ex}
                \renewcommand{\cftafterloftitle}{
    \vskip8pt{\titlerule[1.5pt]
    %           \vspace{3.2ex} 
    %           \hrule height 1.5pt
    %           \vspace{-2.6ex
                }}
    %------LOT----------%       
        \renewcommand{\cftlottitlefont}{\usefont{T1}{qhv}{b}{n}\selectfont\huge} 
                \addtolength{\cftbeforelottitleskip}{4.2ex} % o,2 Differenz zu anderen beiden Überschriften ist seltsamerweise notwendig...
                \renewcommand{\cftafterlottitle}{
    \vskip8pt{\titlerule[1.5pt]
    %           \vspace{4.0ex}
    %           \hrule height 1.5pt
    %           \vspace{-2.6ex
                }}

    \begin{document}

        \newpage

    \tableofcontents

        \newpage

        \listoftables

        \newpage

        \listoffigures

        \newpage

\chapter{Test}

Consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus


        \begin{table}[bp]
            \centering
                %\begin{tabular}

                %\end{tabular}
            \caption{Testtable}
            \label{tab:Testtable}
        \end{table}


        \begin{figure}[bp]
            \centering
                %\includegraphics{}
            \caption{Testfigure}
            \label{testfigure}
        \end{figure}


    \end{document}

答案1

您可以简单地使用titlestocloft 的包选项:

\usepackage[titles]{tocloft}

此选项选项使 ToC、LoF 和 LoT 列表的标题使用修改后的标题进行排版。带有您的代码的完整示例:

\documentclass[twoside=false]{book}

\usepackage[titles]{tocloft}

        \usepackage[ngerman]{babel}             
        \usepackage[T1]{fontenc}
        \usepackage{lmodern}
        \usepackage[ansinew]{inputenc}      
        \usepackage{tgheros}                            
        \usepackage[expert]{mathdesign}     
        \usepackage{amssymb}                            
        \usepackage{ae,aecompl}                     
        \usepackage{charter}                            



%-------Styling of Titles-------%
\usepackage{titlesec}

\titleclass{\part}{top}
\titleclass{\chapter}{straight}

\titleformat{\part}[hang]
  {\usefont{T1}{qhv}{b}{n}\selectfont\huge\raggedright}{\thepart}
  {20pt}{\Huge}
\titleformat{\chapter}[hang]
  {\usefont{T1}{qhv}{b}{n}\selectfont\huge\raggedright}{\thechapter}
  {20pt}{\Huge}[\vskip8pt{\titlerule[1.5pt]}]

\titlespacing*{\part}
  {0pt}{50pt}{40pt}
\titlespacing*{\chapter}
  {0pt}{0pt}{20pt}


\begin{document}

        \newpage

    \tableofcontents

        \newpage

        \listoftables

        \newpage

        \listoffigures

        \newpage

\chapter{Test}

Consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus


        \begin{table}[bp]
            \centering
                %\begin{tabular}

                %\end{tabular}
            \caption{Testtable}
            \label{tab:Testtable}
        \end{table}


        \begin{figure}[bp]
            \centering
                %\includegraphics{}
            \caption{Testfigure}
            \label{testfigure}
        \end{figure}


\end{document}

相关内容