如何只获取报告class中的主要事项的标题?
How to get heading only for the main matter in the report class?
我正在用 Latex 写论文,文档 class:报告。我有前言,包括摘要、致谢等。
我只想将 header 添加到我的第一个 chapter:Introduction 开始的主要事务中。我希望 header 是没有单词 "chapter" 的章节编号和旁边的章节标题。我也想让页码出现在正文所有页的页底正中
我不想在首页的任何页面中出现任何 header 或一行。
你能指导我吗?谢谢
这是我正在应用的示例代码。
\documentclass[a4paper,12pt,titlepage]{report}
\usepackage{amsfonts}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{color}
\usepackage{colordvi}
\usepackage{amssymb}
\usepackage{natbib}
\usepackage[nottoc,notlot,notlof]{tocbibind}
\usepackage{setspace}
\usepackage{amsmath}
\usepackage{theorem}
\usepackage{lineno}
\usepackage{multirow}
\usepackage [toc,page]{appendix}
\usepackage{framed}
\usepackage{setspace}
\doublespacing
\usepackage[left=1.5in,top=2in,right=1in,bottom=2in]{geometry}
\begin{document}
\title{xxx}
\author{xxx}
\date{xxx}
\maketitle
\thispagestyle{empty}
\renewcommand{\thepage}{\roman{page}}
% here it comes my front matter for example:
\clearpage
\addcontentsline{toc}{chapter}{Abstract}
\chapter*{Abstract}
ABSTRACT CONTENTS
%then:
\clearpage
\cleardoublepage
\pagenumbering{arabic}
% here it starts my main matter:
\chapter{Introduction} %first chapter
\chapter{First Esssay in XXX} %second chapter
\end{document}
您可以通过多种方式在文档中设置 header。最frequently-used包是fancyhdr
.
首先,您需要将Chapter
字样从常规章节标记中删除。为此,添加
\usepackage{etoolbox}
\makeatletter
%\newcommand{\updatechaptermark}{%
\appto\ps@fancy{%
\patchcmd{\chaptermark}% <cmd>
{\@chapapp\ }{}% <search><replace>
{}{}% <success><failure>
}%}
\makeatother
到你的序言。作为调用 \pagestyle{fancy}
的一部分,上面从 \chaptermark
中删除了 \@chapapp\
(注意 space)。这是必需的,因为 fancyhdr
可能会在调用 \pagestyle{fancy}
时更新 \chaptermark
。
其次,您需要设置headers/footers。这是一个可以产生您所追求的结果的设置:
\usepackage{fancyhdr}
\fancyhf{}% Clear header/footer
\fancyhead[C]{\leftmark}% Chapter mark
\fancyfoot[C]{\thepage}% Footer contains the page number
\renewcommand{\headrulewidth}{.4pt}% Header rule width
上面将 header 设置为 \leftmark
,其中包含 \chaptermark
设置(因为 \chaptermark
实际上发出 \markboth{<leftmark>}{<rightmark>}
空 <rightmark>
).
\documentclass{report}
\usepackage{fancyhdr,lipsum}
\usepackage{etoolbox}
\makeatletter
%\newcommand{\updatechaptermark}{%
\appto\ps@fancy{%
\patchcmd{\chaptermark}% <cmd>
{\@chapapp\ }{}% <search><replace>
{}{}% <success><failure>
}%}
\makeatother
\fancyhf{}% Clear header/footer
\fancyhead[C]{\leftmark}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{.4pt}
\begin{document}
%\frontmatter
\pagenumbering{roman}
\title{xxx}
\author{xxx}
\date{xxx}
\maketitle
\thispagestyle{empty}
% here it comes my front matter for example:
\cleardoublepage
\tableofcontents
\cleardoublepage
\addcontentsline{toc}{chapter}{Abstract}%
\chapter*{Abstract} \lipsum[1]
\cleardoublepage
\pagenumbering{arabic}
\pagestyle{fancy}
\chapter{Introduction} \lipsum[1-50] % first chapter
\chapter{Methodology} \lipsum[1-50] % second chapter
\chapter{Conclusion} \lipsum[1-50] % last chapter
\end{document}
请注意,\chapter
s 默认使用 plain
样式设置。如果您希望这有所不同,则必须重新定义 plain
页面样式。
您可以使用不同的 header/footer 包实现相同的输出,例如 titleps
。
我正在用 Latex 写论文,文档 class:报告。我有前言,包括摘要、致谢等。
我只想将 header 添加到我的第一个 chapter:Introduction 开始的主要事务中。我希望 header 是没有单词 "chapter" 的章节编号和旁边的章节标题。我也想让页码出现在正文所有页的页底正中
我不想在首页的任何页面中出现任何 header 或一行。
你能指导我吗?谢谢
这是我正在应用的示例代码。
\documentclass[a4paper,12pt,titlepage]{report}
\usepackage{amsfonts}
\usepackage[english]{babel}
\usepackage{graphicx}
\usepackage{color}
\usepackage{colordvi}
\usepackage{amssymb}
\usepackage{natbib}
\usepackage[nottoc,notlot,notlof]{tocbibind}
\usepackage{setspace}
\usepackage{amsmath}
\usepackage{theorem}
\usepackage{lineno}
\usepackage{multirow}
\usepackage [toc,page]{appendix}
\usepackage{framed}
\usepackage{setspace}
\doublespacing
\usepackage[left=1.5in,top=2in,right=1in,bottom=2in]{geometry}
\begin{document}
\title{xxx}
\author{xxx}
\date{xxx}
\maketitle
\thispagestyle{empty}
\renewcommand{\thepage}{\roman{page}}
% here it comes my front matter for example:
\clearpage
\addcontentsline{toc}{chapter}{Abstract}
\chapter*{Abstract}
ABSTRACT CONTENTS
%then:
\clearpage
\cleardoublepage
\pagenumbering{arabic}
% here it starts my main matter:
\chapter{Introduction} %first chapter
\chapter{First Esssay in XXX} %second chapter
\end{document}
您可以通过多种方式在文档中设置 header。最frequently-used包是fancyhdr
.
首先,您需要将Chapter
字样从常规章节标记中删除。为此,添加
\usepackage{etoolbox}
\makeatletter
%\newcommand{\updatechaptermark}{%
\appto\ps@fancy{%
\patchcmd{\chaptermark}% <cmd>
{\@chapapp\ }{}% <search><replace>
{}{}% <success><failure>
}%}
\makeatother
到你的序言。作为调用 \pagestyle{fancy}
的一部分,上面从 \chaptermark
中删除了 \@chapapp\
(注意 space)。这是必需的,因为 fancyhdr
可能会在调用 \pagestyle{fancy}
时更新 \chaptermark
。
其次,您需要设置headers/footers。这是一个可以产生您所追求的结果的设置:
\usepackage{fancyhdr}
\fancyhf{}% Clear header/footer
\fancyhead[C]{\leftmark}% Chapter mark
\fancyfoot[C]{\thepage}% Footer contains the page number
\renewcommand{\headrulewidth}{.4pt}% Header rule width
上面将 header 设置为 \leftmark
,其中包含 \chaptermark
设置(因为 \chaptermark
实际上发出 \markboth{<leftmark>}{<rightmark>}
空 <rightmark>
).
\documentclass{report}
\usepackage{fancyhdr,lipsum}
\usepackage{etoolbox}
\makeatletter
%\newcommand{\updatechaptermark}{%
\appto\ps@fancy{%
\patchcmd{\chaptermark}% <cmd>
{\@chapapp\ }{}% <search><replace>
{}{}% <success><failure>
}%}
\makeatother
\fancyhf{}% Clear header/footer
\fancyhead[C]{\leftmark}
\fancyfoot[C]{\thepage}
\renewcommand{\headrulewidth}{.4pt}
\begin{document}
%\frontmatter
\pagenumbering{roman}
\title{xxx}
\author{xxx}
\date{xxx}
\maketitle
\thispagestyle{empty}
% here it comes my front matter for example:
\cleardoublepage
\tableofcontents
\cleardoublepage
\addcontentsline{toc}{chapter}{Abstract}%
\chapter*{Abstract} \lipsum[1]
\cleardoublepage
\pagenumbering{arabic}
\pagestyle{fancy}
\chapter{Introduction} \lipsum[1-50] % first chapter
\chapter{Methodology} \lipsum[1-50] % second chapter
\chapter{Conclusion} \lipsum[1-50] % last chapter
\end{document}
请注意,\chapter
s 默认使用 plain
样式设置。如果您希望这有所不同,则必须重新定义 plain
页面样式。
您可以使用不同的 header/footer 包实现相同的输出,例如 titleps
。