我怎样才能从目录的章节标题中删除 0(现在显示为“目录 0”)?

我怎样才能从目录的章节标题中删除 0(现在显示为“目录 0”)?

我已将默认章节编号调整为页面右侧的大数字,但现在目录中也显示章节编号。我怎样才能删除此编号而不删除其他章节的编号?

显示屏截图

\documentclass[a4paper]{scrreprt}
\usepackage[utf8]{inputenc}     % for éô
\usepackage[english]{babel}     % for proper word breaking at line ends
\usepackage[a4paper, left=1.5in, right=1.5in, top=1.5in, bottom=1.5in]{geometry}
                                % for page size and margin settings
\usepackage{graphicx}           % for ?
\graphicspath{{figures/}}
\usepackage{amsmath,amssymb}    % for better equations
\usepackage{amsthm}             % for better theorem styles
\usepackage{mathtools}          % for greek math symbol formatting
\usepackage{enumitem}           % for control of 'enumerate' numbering
\usepackage{listings}           % for control of 'itemize' spacing
\usepackage{todonotes}          % for clear TODO notes
\usepackage{hyperref}           % page numbers and '\ref's become clickable
\usepackage[explicit]{titlesec} % for the chapter style
\usepackage{fix-cm}             % for the chapter style

%% TODO PACKAGE
\newcommand{\towrite}[2]{\todo[inline,color=yellow!10]{TO WRITE: #1}}

%************** Chapter style
\titleformat{\chapter}
  {\normalfont\LARGE\bfseries\filleft}
  {}
  {0em}
  {%
    \parbox[b]{\dimexpr\linewidth-2.5cm\relax}{#1}\hfill%
    \parbox[b]{2cm}{\hfill{\fontsize{80}{96}\selectfont\thechapter}}%
  }
%**************


\begin{document}
\input{titlepage}

\newpage
\tableofcontents
\thispagestyle{empty}

\newpage
\thispagestyle{empty}

\setcounter{page}{1}
\newpage
\input{Chapter1_Introduction.tex}
\newpage
\input{Chapter2_Theory.tex}
\newpage
\input{Chapter3_MethodMaterials.tex}
\newpage
\input{Chapter4_Results.tex}
\newpage
\input{Chapter5_Conclusion.tex}
\newpage
\input{Chapter6_Recommendations.tex}


\newpage
\bibliographystyle{unsrt}
\bibliography{references}

\end{document}

答案1

不要将包titlesec与 KOMA-Script 类一起使用。您可以重新定义 KOMA-Script 宏\chapterformat\chapterlinesformat

\setkomafont{chapter}{\rmfamily\LARGE}
\renewcommand*\chapterformat{%
  \parbox[b]{2cm}{\hfill{\fontsize{80}{96}\selectfont\thechapter}}%
}
\makeatletter
\renewcommand*\chapterlinesformat[3]{%
  \ifstr{#1}{chapter}
    {\parbox[b]{\dimexpr\linewidth-2.5cm\relax}{\raggedchapter#3}\hfill#2}
    {\@hangfrom{#2}{#3}}% other section levels with style=chapter
}

示例(不含不相关的包和代码):

\documentclass{scrreprt}% a4paper is default
\usepackage{blindtext}% only for dummy text
%\usepackage[utf8]{inputenc}     % only needed with older TeX Distributionen
\usepackage[english]{babel}     % for proper word breaking at line ends
\usepackage[margin=1.5in]{geometry}
\usepackage{fix-cm}             % 
\usepackage{hyperref}           % load as last package

%%************** Chapter style
\setkomafont{chapter}{\rmfamily\LARGE}
\renewcommand*\chapterformat{%
  \parbox[b]{2cm}{\hfill{\fontsize{80}{96}\selectfont\thechapter}}%
}
\makeatletter
\renewcommand*\chapterlinesformat[3]{%
  \ifstr{#1}{chapter}
    {\parbox[b]{\dimexpr\linewidth-2.5cm\relax}{\raggedchapter#3}\hfill#2}
    {\@hangfrom{#2}{#3}}% other section levels with style=chapter
}
\makeatother

% pagestyle empty in toc:
\BeforeStartingTOC[toc]{\thispagestyle{empty}\pagestyle{empty}}
\AfterStartingTOC[toc]{\cleardoublepage}

\begin{document}
\pagenumbering{roman}
\begin{titlepage}
Titlepage
\end{titlepage}
\tableofcontents

\cleardoubleoddpage
\pagenumbering{arabic}

\blinddocument
\blinddocument
\end{document}

结果:

在此处输入图片描述

答案2

在序言中为未编号的章节添加此内容:

\titleformat{name=\chapter, numberless}
  {\normalfont\LARGE\bfseries\filright}
  {}
  {0em}
  {#1}

相关内容