隐藏文档前言中的页码

隐藏文档前言中的页码

我遇到了一个问题,希望有人告诉我如何解决。我希望报告中的页码从简介页开始,但实际上它从目录和目录列表开始。我希望这些页面没有编号。这是我的代码

\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{color}
\usepackage{xcolor} %les couleurs
\definecolor{myblue}{rgb}{0.2,0.4,1}
\usepackage{layout}
\usepackage[top=2 cm, bottom=2 cm, left=2 cm, right=2 cm]{geometry}
\usepackage{setspace}
\usepackage[pdftex]{graphicx}
\usepackage{array}
%\documentclass[landscape]{scrartcl}
\usepackage{geometry}
\usepackage{multirow}

\usepackage[justification=centering]{caption}

\usepackage{pgfplots}


\usepackage{fancyhdr}
\fancyhf{} % clear all header and footers


\begin{document}
\pagestyle{empty}
\include{title-content}
\color{black}
\doublespacing
\include{dedicaces-content}
%\include{remerciement}


\tableofcontents

\listoffigures
\listoftables




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\pagestyle{plain} 
\pagenumbering{arabic}
\chapter{Introduction générale}

答案1

(注意:在 OP 解释了文档设置的更多细节后,我重写了这个答案。)

要隐藏文档某一部分的页码,必须设置\pagenumbering{empty}并注意命令(例如\tableofcontents\listoffigures\listoftables),这些命令在内部调用命令(具体而言是 命令\chapter),将当前页面的页面样式(重新)设置为plain。在下面的示例中,我使用包\patchcmd的宏etoolbox来“修补” chapter 命令。为了将修改范围限制在文档的正面部分,我在文档的相关部分周围放置了一个\begingroup...\endgroup对。最后,在正面部分结束后,需要plain通过发出命令 来恢复页码并重新开始页码\pagenumbering{arabic}。祝您 TeXing 愉快!

\documentclass[12pt,a4paper]{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[french]{babel}
\usepackage{xcolor} 
\definecolor{myblue}{rgb}{0.2,0.4,1}
\usepackage{layout}
\usepackage[margin=2cm]{geometry}
\usepackage{setspace}
\usepackage[pdftex]{graphicx}
\usepackage{array,multirow,pgfplots,filecontents}
\usepackage[justification=centering]{caption}

% Load the 'etoolbox' package to provide to
% patch the '\chapter` command (locally, in this case)
\usepackage{etoolbox}

\begin{document}
\pagestyle{empty}    % switch to "empty" page style for front matter of document
\begingroup
% In this TeX group, the first page of new "chapters" should obey
% '\thispagestyle{empty}' rather than the default '\thispagestyle{plain}'.
\patchcmd{\chapter}{plain}{empty}{}{}

\include{title-content}
\color{black}
\doublespacing
\include{dedicaces-content}
\include{remerciement}

\tableofcontents
\listoffigures
\listoftables
\endgroup % end of TeX group

\clearpage
\pagestyle{plain}      % revert to "plain" page style
\pagenumbering{arabic} % restart page numbering
\chapter{Introduction générale}
% 19 more "dummy" chapters, just to make the ToC span 2 pages
\chapter{Bla 2}
\chapter{Bla 3}
\chapter{Bla 4}
\chapter{Bla 5}
\chapter{Bla 6}
\chapter{Bla 7}
\chapter{Bla 8}
\chapter{Bla 9}
\chapter{Bla 10}
\chapter{Bla 11}
\chapter{Bla 12}
\chapter{Bla 13}
\chapter{Bla 14}
\chapter{Bla 15}
\chapter{Bla 16}
\chapter{Bla 17}
\chapter{Bla 18}
\chapter{Bla 19}
\chapter{Bla 20}
\end{document}

相关内容