我使用的是书籍样式,但报告样式也会出现这种情况。我正在使用命令\chapter*
,我希望章节部分出现在目录中,但它没有出现。这是代码:
\documentclass[14pt,a4paper,twoside,spanish,openany]{book}
\usepackage[spanish,activeacute]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amssymb,amsmath,amsthm, mathtools}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{fancyhdr}
\renewcommand{\baselinestretch }{1.3}
\renewcommand{\thesection}{\arabic{section}}
\newtheorem{theorem}{Teorema}[section]
\newtheorem{lemma}{Lema}[section]
\newtheorem{proposition}{Proposición}[section]
\newtheorem{corollary}{Corolario}[section]
\theoremstyle{definition}
\newtheorem{definition}{Definición}[section]
\theoremstyle{example}
\newtheorem{example}{Ejemplo}[section]
\theoremstyle{remark}
\newtheorem{remark}{Nota}
\pagestyle{fancy}
\lhead{TEMA 3}
\rhead{\thepage }
\chead{Combinatoria}
\rfoot{Oposiciones}
\rhead{\thepage }
\renewcommand{\footrulewidth}{0.4pt}
\renewcommand{\headrulewidth}{0.4pt}
\begin{document}
\author{Cristobal López Silla}
\title{Tema 3 - Técnicas De Recuento.Combinatoria.}
\date{}
\tableofcontents
\pagebreak
\chapter*{TEMA 3.\\Técnicas De Recuento.Combinatoria.}
\section{Introducción A Las Técnicas De Recuento.}
\end{document}
谢谢
答案1
有很多方法可以将\chapter*
类似标题添加到目录中。我更改了\@makeschapterhead{}
自动将条目添加到目录中的命令。
必须\\
受到保护,但在我看来,它根本不应该用在章节标题中。
\documentclass[14pt,a4paper,twoside,spanish,openany]{book}
\usepackage[spanish,activeacute]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{amssymb,amsmath,amsthm, mathtools}
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}
\usepackage{fancyhdr}
\usepackage{xpatch}%
\renewcommand{\baselinestretch }{1.3}
\renewcommand{\thesection}{\arabic{section}}
\newtheorem{theorem}{Teorema}[section]
\newtheorem{lemma}{Lema}[section]
\newtheorem{proposition}{Proposición}[section]
\newtheorem{corollary}{Corolario}[section]
\theoremstyle{definition}
\newtheorem{definition}{Definición}[section]
\theoremstyle{example}
\newtheorem{example}{Ejemplo}[section]
\theoremstyle{remark}
\newtheorem{remark}{Nota}
\pagestyle{fancy}
\lhead{TEMA 3}
\rhead{\thepage }
\chead{Combinatoria}
\rfoot{Oposiciones}
\rhead{\thepage }
\renewcommand{\footrulewidth}{0.4pt}
\renewcommand{\headrulewidth}{0.4pt}
\begin{document}
\author{Cristobal López Silla}
\title{Tema 3 - Técnicas De Recuento.Combinatoria.}
\date{}
\tableofcontents
\clearpage
%\pagebreak
\makeatletter
\xpatchcmd{\@makeschapterhead}{%
\Huge \bfseries #1\par\nobreak%
}{%
\addcontentsline{toc}{chapter}{\protect\numberline{}#1}%
\Huge \bfseries #1\par\nobreak%
}{}{}
\makeatother
\chapter*{{TEMA 3.\protect\\ Técnicas De Recuento.Combinatoria.}}
\section{Introducción A Las Técnicas De Recuento.}
\end{document}