我尝试使用 minitoc,但没有得到我想要的风格:
这里是代码:
\documentclass[12pt, twoside, openany]{book}
\usepackage{mathptmx}
\usepackage[spanish, es-tabla]{babel}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\graphicspath{ {images/} }
\usepackage[a4paper,top=30mm,left=30mm,right=25mm,bottom=25mm,headheight=20mm]{geometry}
\usepackage{titlesec}
\usepackage{setspace}
\usepackage{ragged2e}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{stackengine}
\usepackage{array}
\usepackage{url}
\usepackage{float}
\usepackage{afterpage}
\usepackage{minitoc}
\usepackage{hyperref}
\usepackage[Lenny]{fncychap}
\usepackage{lipsum}
\usepackage{hyperref}
\usepackage{xcolor}
\usepackage{pdfpages}
\usepackage{lipsum}
\input{Configuracion.tex}
\begin{document}
\rmfamily
\input{Portada.tex}
\newpage
\large\hspace{-18pt}Chairman of the jury :\\
\hspace{30pt}protractor:\\
framing:\\
\begin{center}
\centering \large Academic year 2020 / 2021
\end{center}
\makeatletter
\titlespacing*{\chapter}{0pt}{150pt}{0pt}%Spacing above = 150pt
\chapter*{dedication}
\renewcommand{\headrulewidth}{0.4pt}
%\thispagestyle{empty}
\newpage
\newpage
dedication
\titlespacing*{\chapter}{0pt}{150pt}{0pt}%Spacing above = 150pt
\chapter*{thanks}
\renewcommand{\headrulewidth}{0.4pt}
\newpage
%%\addcontentsline{toc}{chapter}{Abstract}contenido
\tableofcontents
\adjustmtc
\newpage
%\addcontentsline{toc}{chapter}{Índice de figuras}
\listoffigures
\newpage
%\addcontentsline{toc}{chapter}{Índice de tablas}
\listoftables
\justify
\setlength{\parskip}{\baselineskip}
\onehalfspacing % Interlineado de 1,5
\afterpage{\null\newpage}
\input{Abstract.tex}
\addcontentsline{toc}{chapter}{Abstract}
\input{Introduction}
\addcontentsline{toc}{chapter}{Introduction}
\input{01_Introduccion.tex}
\input{chapter1.tex}
\newpage % En una nueva página
\addcontentsline{toc}{chapter}{Bibliografía}
\bibliographystyle{ieeetr}
\bibliography{bibliografia}
\end{document} `
这是配置.tex
\definecolor{gris}{RGB}{220,220,220}
\setcounter{secnumdepth}{3}
\addto\captionsspanish{
\renewcommand{\contentsname}{Table of materials }
\renewcommand{\listfigurename}{Índice de figuras}
\renewcommand{\listtablename}{Índice de tablas}
}
\fancyhf{}
\fancyhead[R]{\bfseries{page \thepage \hspace{1pt} of \pageref{LastPage}}}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.4pt}
\fancypagestyle{plain}{%
\fancyhf{}
\fancyhead[R]{\bfseries{page \thepage \hspace{1pt} of \pageref{LastPage}}}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.4pt}
}
\pagestyle{fancy}
\pagestyle{plain}
\restylefloat{table}
这是 chapter1.tex
\dominitoc
\tableofcontents
\chapter{ chapter 1}
\minitoc
\section{section one}
\section{Two}
\subsection{One}
\subsection{Two}
答案1
我建议对序言进行一些修改, Configuration.tex
并且chapter1.tex
(1)删除重复项\usepackage{hyperref}
并作为最后一个包加载。
(2)删除重复项\usepackage{lipsum}
(3)评论\usepackage{minitoc}
。我们将改用包etoc
,并入Configuration.tex
(4)使用\localtableofcontents
打印章节目录。请参阅chapter1.tex
。我添加了\singlespacing
前后 \onehalfspacing
内容以节省一些空间。
(5)\addcontentsline{toc}{chapter}{..}
在 a 之后注释所有\chapter
内容,以避免目录中出现重复。仅\chapter*
在需要时使用 after。
(6)全部注释掉\adjustmtc
,这些都不是必需的。
(7) 对fancy
和plain
样式进行了小幅修正,以避免打印两次页码。
这是主文件
% !TeX TS-program = pdflatex
\documentclass[12pt, twoside, openany]{book}
\usepackage{mathptmx}
\usepackage[spanish, es-tabla]{babel}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\graphicspath{{images/}}
\usepackage[a4paper,top=30mm,left=30mm,right=25mm,bottom=25mm,headheight=20mm]{geometry}
\usepackage{titlesec}
\usepackage{setspace}
\usepackage{ragged2e}
\usepackage{fancyhdr}
\usepackage{lastpage}
\usepackage{stackengine}
\usepackage{array}
\usepackage{url}
\usepackage{float}
\usepackage{afterpage}
%%\usepackage{minitoc} % not used
%%\usepackage{hyperref}
\usepackage[Lenny]{fncychap}
\usepackage{lipsum}
%%\usepackage{hyperref}
\usepackage{xcolor}
\usepackage{pdfpages}
%%\usepackage{lipsum} % duplicate
\input{Configuracion.tex}
\usepackage{hyperref} % last package
\begin{document}
% \dominitoc
\rmfamily
% \input{Portada.tex}
\newpage
\large\hspace{-18pt}Chairman of the jury :\\
\hspace{30pt}protractor:\\
framing:\\
\begin{center}
\centering \large Academic year 2020 / 2021
\end{center}
\makeatletter
\titlespacing*{\chapter}{0pt}{150pt}{0pt}%Spacing above = 150pt
\chapter*{dedication}
\renewcommand{\headrulewidth}{0.4pt}
%\thispagestyle{empty}
\newpage
\newpage
dedication
\titlespacing*{\chapter}{0pt}{150pt}{0pt}%Spacing above = 150pt
\chapter*{thanks}
\renewcommand{\headrulewidth}{0.4pt}
\newpage
%%\addcontentsline{toc}{chapter}{Abstract}contenido
\tableofcontents
% \adjustmtc
\newpage
%\addcontentsline{toc}{chapter}{Índice de figuras}
\listoffigures
\newpage
%\addcontentsline{toc}{chapter}{Índice de tablas}
\listoftables
\justify
\setlength{\parskip}{\baselineskip}
\onehalfspacing % Interlineado de 1,5
\afterpage{\null\newpage}
\chapter{Abstract}
% \addcontentsline{toc}{chapter}{Abstract}
\chapter{Introduction}
% \addcontentsline{toc}{chapter}{Introduction}
% \input{01_Introduccion.tex}
\input{chapter1.tex}
\newpage % En una nueva página
\addcontentsline{toc}{chapter}{Bibliografía}
\bibliographystyle{ieeetr}
% \bibliography{bibliografia}
\end{document} `
这是Configuration.tex
\usepackage{etoc} % added
\etocsettocstyle{\subsection*{\contentsname}}{\noindent\rule{\linewidth}{.4pt}}
\definecolor{gris}{RGB}{220,220,220}
%\setcounter{secnumdepth}{4}
\setcounter{secnumdepth}{3} %changed
\setcounter{tocdepth}{1}
\addto\captionsspanish{
\renewcommand{\contentsname}{Table of materials }
\renewcommand{\listfigurename}{Índice de figuras}
\renewcommand{\listtablename}{Índice de tablas}
}
\fancyhf{}
\fancyhead[R]{\bfseries{page \thepage\ of \pageref{LastPage}}}
%\fancyfoot[C]{\thepage} % not in fancy
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
\fancypagestyle{plain}{%
\fancyhf{}
% \fancyhead[R]{\bfseries{page \thepage\ of \pageref{LastPage}}} % not in plain
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0.4pt}
}
\pagestyle{fancy}
\pagestyle{plain}
\restylefloat{table}
这是chapter1.tex
% \dominitoc
%\tableofcontents
\chapter{Un capítulo}
\singlespacing % save some space
\localtableofcontents
\onehalfspacing % go back to the normal setting of the document
\section{Section One}
\section{Section Two}
\subsection{Subsec One}
\subsection{Subsec Two}