我想chapter
从新章节开始的页面上删除该单词。我从 sharelatex.com 获取了代码(模板:德语实验室和课程报告)。
这是的代码hgbheadings.sty
:
\RequirePackage{fancyhdr}
\pagestyle{fancy}
\@ifundefined{chapter}%
{}%
{\renewcommand{\chaptermark}[1]{%
\ifthenelse{\value{chapter} < 1}%
{\markboth{#1}{}}%
{\markboth{\thechapter\ #1}{}}
}}
\addtolength{\headheight}{\baselineskip}
\renewcommand{\headrulewidth}{0.4pt} %% thin line under header
%\renewcommand{\headrulewidth}{0.4pt} %% no line under header
\renewcommand{\footrulewidth}{0pt}
\fancyhf{} %% Clear all fields.
%\fancyhead[LE,RO]{\sffamily\thepage} %{\bf \rightmark}
%\fancyhead[LO,RE]{\sffamily\nouppercase{\leftmark}} %{\slshape \leftmark}
\fancyhead[R]{\sffamily\thepage} %{\bf \rightmark}
\fancyhead[L]{\sffamily\nouppercase{\leftmark}} %{\slshape \leftmark}
\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyfoot[C]{\sffamily\thepage} % except the center
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}
tex 文件:
\documentclass[ngerman,11pt]{report}
\usepackage{hgbheadings}
\begin{document}
%%%----------------------------------------------------------
\maketitle
\tableofcontents
%%%----------------------------------------------------------
\chapter{Guidelines}
%%%----------------------------------------------------------
Here are a few guidelines for the reports expected to be turned in for this course.
One chapter should be provided for each assignment.
Describe the given task in your own words (do not replicate the assignment 1:1).
Then describe your approach, explain the main difficulties, clearly outline your solution, finally provide illustrative and meaningful results.
%
\begin{center}
\textbf{Don't just show your program code!}
\end{center}
%
\chapter{Texture Segmentation}
%%%----------------------------------------------------------
\end{document}
Description of this task follows here.
这\documentclass
是报告。我已经阅读了与我的主题相关的其他 stackexchange 问题,但我无法解决我的问题。我该如何删除第1章并将章节标题改为1 章节标题?
答案1
fancyhdr
这与您必须修改的定义无关\@makechapterhead
。我制作了一个示例文件,可以轻松地在您的.sty
文件中实现更改。
\documentclass[11pt]{report}
\usepackage{ifthen}
\usepackage{fancyhdr}
\usepackage{lipsum}
\pagestyle{fancy}
\makeatletter
% addition for not showing 'Chapter 1'
\def\@makechapterhead#1{%
\vspace*{50\p@}%
{\parindent \z@ \raggedright \normalfont
\interlinepenalty\@M
\Huge \bfseries
\ifnum \c@secnumdepth >\m@ne
\thechapter\nobreakspace
\fi
#1\par\nobreak
\vskip 40\p@
}}
\@ifundefined{chapter}%
{}%
{\renewcommand{\chaptermark}[1]{%
\ifthenelse{\value{chapter} < 1}%
{\markboth{#1}{}}%
{\markboth{\thechapter\ #1}{}}
}}
\addtolength{\headheight}{\baselineskip}
\renewcommand{\headrulewidth}{0.4pt} %% thin line under header
%\renewcommand{\headrulewidth}{0pt} %% no line under header
\renewcommand{\footrulewidth}{0pt}
\fancyhf{} %% Clear all fields.
%\fancyhead[LE,RO]{\sffamily\thepage}
%\fancyhead[LO,RE]{\sffamily\nouppercase{\leftmark}}
\fancyhead[R]{\sffamily\thepage}
\fancyhead[L]{\sffamily\nouppercase{\leftmark}}
\fancypagestyle{plain}{%
\fancyhf{} % clear all header and footer fields
\fancyfoot[C]{\sffamily\thepage} % except the center
\renewcommand{\headrulewidth}{0pt}
\renewcommand{\footrulewidth}{0pt}
}
\makeatother
\begin{document}
%%%----------------------------------------------------------
%\maketitle
\tableofcontents
%%%----------------------------------------------------------
\chapter{Guidelines}
%%%----------------------------------------------------------
Here are a few guidelines for the reports expected to be turned in for this course.
One chapter should be provided for each assignment.
Describe the given task in your own words (do not replicate the assignment 1:1).
Then describe your approach, explain the main difficulties, clearly outline your
solution, finally provide illustrative and meaningful results.
%
\begin{center}
\textbf{Don't just show your program code!}
\end{center}
\lipsum[1-10]
\chapter{Texture Segmentation}
\lipsum[1-10]
%%%----------------------------------------------------------
\end{document}
而不是\nobreakspace
你可能想要的\quad
。