论文的 toc 和 minitoc 页面样式问题

论文的 toc 和 minitoc 页面样式问题

我的文档有问题。我在 Google 上搜索,但没有找到解决方案。我只想使整个文档的页面样式统一,但它不适用于目录和 minitoc 页面。

此外,我希望在右侧对有页码的页面进行页码编排,在左侧对有页码的页面进行页码编排。我尝试过使用,RO但没有成功。我也已经在文档类的定义中尝试过“twoside”,但也没有成功!

请在此处查找我的文档:

\documentclass[12pt,a4paper]{report}

%définition des packages
\usepackage{anyfontsize}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{helvet}
\usepackage[french]{babel}
\usepackage[margin=1in, headsep=5pt]{geometry}
\usepackage{amsmath}
\usepackage{tabularx}
\usepackage{amssymb}
\usepackage{fancyhdr}
\usepackage[pdftex]{graphicx}
\usepackage{hyperref}
\usepackage{url}
\usepackage{caption}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage[Sonny]{fncychap}
\usepackage[tight]{minitoc}
\mtcselectlanguage{french}
\usepackage{titlesec}
\usepackage{titletoc}

\pagestyle{empty}
\fancyhf{}
\pagestyle{fancy}
\renewcommand{\footrulewidth}{1pt}
\setlength{\footskip}{20pt}
\fancyfoot[C]{}
\fancyfoot[RO]{\thepage}

\begin{document}
\newpage
\dominitoc
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{1}
\setcounter{minitocdepth}{3}
\renewcommand{\contentsname}{\hfill \fontsize{20}{30}{\fontfamily{rm}\selectfont{Table des matières}}}

\pagenumbering{roman}
\tableofcontents

\renewcommand{\chaptername}{\hfill \fontsize{20}{30}{\fontfamily{rm}\selectfont{Chapitre}}}


\chapter{\fontfamily{rm}\selectfont{Chapitre bibliographique}}
\pagenumbering{arabic}
\minitoc
\newpage
%style de page
\pagestyle{empty}
\fancyhf{}
\pagestyle{fancy}
\renewcommand{\footrulewidth}{1pt}
\renewcommand{\headrulewidth}{1pt}
\setlength{\footskip}{20pt}
\setlength{\headheight}{50pt}
\fancyhead[L]{\textsc{\fontsize{15}{15}\selectfont{Chapitre 1. Chapitre bibliographique}}}
\fancyfoot[C]{}
\fancyfoot[RO]{\thepage}
\titlespacing{\section}{1pt}{0.5pt}{0.5pt}

{\titleformat*{\section}{\fontsize{15}{15}\bfseries\fontfamily{cmss}\selectfont}
\section{Projection cold spray}}
\hrule height 1pt
\vspace{5mm}
\end{document}

非常感谢您的帮助:)

答案1

我准备了一份包含两章和三节共七页的文档,以查看目录、迷你目录和几页的页眉。

通常定义两种页面样式:plainfancy

对于标准类,每个类\chapter都会调用plain样式。fancy样式适用于普通页面。要切换页码在奇数页和偶数页上的位置,请使用选项twoside

我为你简化了代码。如果新命令和重新定义的作用范围是整个文档,则它们通常属于序言。否则很容易让人混淆。

X

是

这是代码。

% !TeX TS-program = pdflatex

\documentclass[12pt,a4paper,twoside]{report} % 
 %to toggle the position of page numbers, on odd and even pages, use the   twoside option.

%définition des packages
\usepackage{anyfontsize}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{helvet}
\usepackage[french]{babel}
\usepackage[top=1.5cm, bottom=1.5cm, left=2.5cm, right=1.5cm, headheight=1cm, headsep=2mm]{geometry} %<<< changed

\usepackage{amsmath}
\usepackage{tabularx}
\usepackage{amssymb}
\usepackage{fancyhdr}
\usepackage{graphicx} %changed <<<<
\usepackage{url}
\usepackage{caption}
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}
\usepackage[Sonny]{fncychap}
\usepackage[tight]{minitoc}
\mtcselectlanguage{french}
\usepackage{titlesec}
\usepackage{titletoc}

%\usepackage{hyperref}  % MUST BE LAST PACKAGE commented to avoid link red boxes in TOC for this MWE

\fancypagestyle{plain}{% first page of chapters 
    \fancyhf{}  
    \fancyhead[L]{}
    \fancyfoot[R]{\thepage}
     %\fancyfoot[C]{\thepage} % usual alternative  
    \renewcommand{\headrulewidth}{0pt}
}

\fancypagestyle{fancy}{% normal pages
    \fancyhf{}
    \fancyhead[L]{\leftmark}
    \fancyfoot[RO]{\thepage}
    \fancyfoot[LE]{\thepage}
}

\pagestyle{fancy}
\renewcommand{\footrulewidth}{1pt} %equal foot and head rule
\renewcommand{\headrulewidth}{1pt}
\setlength{\footskip}{25pt} % this is quite small it should be 40pt or more and 
                            % bottom = 2.5cmm in geometry
                            
\renewcommand{\contentsname}{\hfill \fontsize{20}{30}{\fontfamily{rm}\selectfont{Table des matières}}}  
\renewcommand{\chaptername}{\hfill \fontsize{20}{30}{\fontfamily{rm}\selectfont{Chapitre}}}

\titlespacing{\section}{0pt}{5pt plus 2pt minus 1pt}{0pt plus 2pt minus 1pt}
\titleformat{\section}
{\fontfamily{cmss}\fontsize{15}{18}\selectfont\bfseries}{\thesection}{1em}{}[{\titlerule[1pt]\vskip 1ex}]
        
\usepackage{kantlipsum} % dummy text, (english sorry)

\begin{document}
\newpage
\dominitoc
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{1}
\setcounter{minitocdepth}{3}

\pagenumbering{roman}
\tableofcontents    

\chapter{Préliminaire}  

\pagenumbering{arabic}
\minitoc

1. \kant[1-5]
\section{Projection cold spray}

2. \kant[11-15]

\section{Projection hot spray}

3. \kant[19-22] 

\section{Without spray}

4. \kant[11-12] 

\chapter{Chapitre bibliographique}
\minitoc

\section{Sources primaires} 
9. \kant[9]
\section{Sources secondaires}
10. \kant[10-15]
\end{document}

相关内容