2010-02-16 30 views
3

我在乳胶中撰写我的论文并有一个模板。除了一个以外,它可以很好地工作。章节编号在每章的第一页上正确增加,但对于每章的连续页面,标题为“第x章 - 这是章节标题”的标题总是作为章节编号。页面标题上的错误章节编号除第一页外

以下是从CLS文件,我觉得代码示例相关的标题:

\newcommand\btypeout[1]{\bhrule\typeout{\space #1}\bhrule} 
\def\today{\ifcase\month\or 
    January\or February\or March\or April\or May\or June\or 
    July\or August\or September\or October\or November\or December\fi 
    \space \number\year} 
\usepackage{setspace} 
\onehalfspacing 
\setlength{\parindent}{0pt} 
\setlength{\parskip}{2.0ex plus0.5ex minus0.2ex} 
\usepackage{vmargin} 
\setmarginsrb   { 1.5in} % left margin 
         { 0.6in} % top margin 
         { 1.0in} % right margin 
         { 0.8in} % bottom margin 
         { 20pt} % head height 
         {0.25in} % head sep 
         { 9pt} % foot height 
         { 0.3in} % foot sep 
\raggedbottom 
\setlength{\topskip}{1\topskip \@plus 5\[email protected]} 
\doublehyphendemerits=10000  % No consecutive line hyphens. 
\brokenpenalty=10000    % No broken words across columns/pages. 
\widowpenalty=9999    % Almost no widows at bottom of page. 
\clubpenalty=9999     % Almost no orphans at top of page. 
\interfootnotelinepenalty=9999 % Almost never break footnotes. 
\usepackage{fancyhdr} 
\lhead[\rm\thepage]{\fancyplain{}{\sl{\rightmark}}} 
\rhead[\fancyplain{}{\sl{\leftmark}}]{\rm\thepage} 
\chead{}\lfoot{}\rfoot{}\cfoot{} 
\pagestyle{fancy} 

%% Chapter Heading --------------- 
\renewcommand{\chaptermark}[1]{\btypeout{\thechapter\space #1}\markboth{\@chapapp\ \thechapter\ #1}{\@chapapp\ \thechapter\ #1}} 

%%-------------------------------------------------- 
\renewcommand{\sectionmark}[1]{} 
\renewcommand{\subsectionmark}[1]{} 
\def\cleardoublepage{\clearpage\[email protected] \ifodd\[email protected]\else 
\hbox{} 
\thispagestyle{empty} 
\newpage 
\[email protected]\hbox{}\newpage\fi\fi\fi} 

回答

1

虽然我没有使用相同的模板,你,我解决了类似的问题涉及到三个包:sectsty,fancyhdr和partpg(我chappg的重写给予与Chappg为章节所做的那样,部件效果相同)。

我在下面列出了我的头文件代码部分。您将从该代码的评论中看到仍然存在一个未解决的问题,但评论提供了解决方法。

%---------------------------------------------------------- 
\usepackage{sectsty} % Fancy section Headers. 
\usepackage{fancyhdr} % Headers and footers. 
\usepackage[auto]{partpg} % Modified version of chappg to provide part-pageno type page numbering. 
\usepackage{appendix} % Multiple appendix sections in multi part document. 
\usepackage[style=altlist,toc=true]{glossary} % Enhanced glossary commands. 
%---------------------------------------------------------- 
\makeglossary 
% There is a conflict between partpg and makeglos. 
% To generate the glossary, run makeglos AFTER removing the next line. 
\renewcommand{\partpgsep}{.} 
\renewcommand{\glossaryname}{Glossary} 
\setlength{\headheight}{13.6pt} 
\pagestyle{fancy}% 
{% Ensure appendices in different parts restart numbering at A each time 
\renewcommand{\restoreapp}{} 

\fancypagestyle{plain}{% Redefine style to use the relevant elements on the part pages 
\fancyhfoffset[LE,RO]{\marginparsep+\marginparwidth} 
\renewcommand{\headrulewidth}{0.1pt} 
\renewcommand{\footrulewidth}{0.1pt} 
\fancyhead[LE,RO]{\leftmark} 
\fancyfoot[LE,RO]{\thepage}}% 

\makeatletter% Redefine cleardoublepage so blank pages at the end of chapters have desired header. 
\def\cleardoublepage{\clearpage\[email protected] \ifodd\[email protected]\else 
    \hbox{} 
    \vspace*{\fill} 
    \pagestyle{plain} 
    \newpage 
    \[email protected]\hbox{}\newpage\fi\fi\fi} 
\makeatother 

\fancyhead{} 
\fancyfoot{} 
%---------------------------------------------------------- 
\begin{document} 
\end{document} 
%---------------------------------------------------------- 

如果这需要你前进,你想拥有我的partpg编码的详细信息,请对这个答案评论。

+0

嗨克里斯,感谢你的回复早些时候我尝试过,但它没有奏效我已经粘贴了我的论文文件的完整样式代码一个新的问题,我非常感谢,如果你可以看看那里:http://stackoverflow.com/questions/4571876/chapter-number-on-page-header-is-not-updated-in-latex-document – okm 2010-12-31 19:13:25

1

你有没有打过电话命令到他们与fancyhdr包之前清除页眉和页脚?

是这样的:

\usepackage{fancyhdr} 
\pagestyle{fancy} 
\fancyhead{} % Clear Headers 
\fancyfoot{} % Clear Footers 
\lhead[\rm\thepage]{\fancyplain{}{\sl{\rightmark}}} 
\rhead[\fancyplain{}{\sl{\leftmark}}]{\rm\thepage} 
\chead{}\lfoot{}\rfoot{}\cfoot{} 
+0

嗨米卡, 感谢您的回复。我想这招用清除页眉和页脚,但它是我以前不工作:((( 任何其他的想法 干杯 奥马尔 – okm 2010-03-15 10:17:30

+0

我也试过\ fancyhf {},但它没有工作,要么重置头 – okm 2010-03-15 10:25:21

+0

!你有没有试过评论下面所有的重新定义的章节,你在哪里调用fancyhdr? – Mica 2010-03-15 16:51:22

相关问题