使用自定义类文件的章节名称标题

使用自定义类文件的章节名称标题

我使用研究所的样式文件输入我的博士论文。他们使用的文件格式基于report。我的指导老师想给我的论文一个book类似的格式。问题是,如果我在样式文件中更改report为,book材料将无法编译。我不能对样式文件进行太多更改,也没有时间编写新的样式文件。

我已设法通过添加选项来放置其中的一些部分twoside。现在,是否可以发出一些命令,以便章节(和部分,适当地)的标题出现在论文的顶部(就像书一样,你明白我想要什么)。

此外,我的章节标题太长了。是否可以在页面顶部使用较短的标题?似乎我无法更改格式,report除非我自己重写整个样式文件。非常感谢您的帮助。

编辑

我在这里给出样式文件:

\NeedsTeXFormat{LaTeX2e}

\ProvidesClass{iiserm}[2011/10/29 Class for IISER Mohali Dissertations]

\newif\if@PhD
\newif\if@MS
\newif\if@Synopsis

\DeclareOption{PhD}{\@PhDtrue}
\DeclareOption{MS}{\@MStrue}
\DeclareOption{synopsis}{\@Synopsistrue}
\ProcessOptions\relax

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%  Load the correct class.
\if@Synopsis
    \LoadClass[12pt,a4paper]{article}
\else
    \LoadClass[12pt,a4paper,twoside,openright]{report}
\fi

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Geometry and page layout
\RequirePackage[%compat2,
a4paper,left=1.5in,right=1in,top=1in,bottom=1in,
                nohead]{geometry}[2002/07/08]
\parskip 8pt

\renewcommand{\@pnumwidth}{2.5em}
\renewcommand{\@tocrmarg}{2.5em}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Using setspace to do the single/double spacing.  Setspace also
%% makes all tables and figures have single spacing automatically.
\RequirePackage{setspace} 
\RequirePackage{atbeginend} % used to redefine the list environs
\setstretch{1.5}
\BeforeBegin{itemize}{\vspace*{-5ex}\begin{singlespace}}
\AfterEnd{itemize}{\end{singlespace}}
\BeforeBegin{enumerate}{\vspace*{-5ex}\begin{singlespace}}
\AfterEnd{enumerate}{\end{singlespace}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% The figure captioning is done correctly via the hang option.
%%\RequirePackage[hang]{caption2}  -> TeX generates error
\RequirePackage[hang]{caption}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\bibliographystyle{alpha}
\setcounter{secnumdepth}{3}
\setcounter{tocdepth}{1}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Other useful macros.  Many of these are modifications from newdiss.cls
% \department{department name} -- user macro to declare name of department.
\def\department#1{\gdef\@department{#1}}
%\RequirePackage[dvips]{graphicx}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% The title page
\def\maketitle{%
  \pagenumbering{roman}
  \thispagestyle{empty}
  \newpage
  \null
  \setcounter{page}{0}
  \parskip=0pt
  \begin{center}%
  \let \footnote \thanks
  \vglue 0in % this makes top margin 2in
  \vskip -5ex%
  \if@Synopsis
    {\large \em SYNOPSIS OF \par}
  \fi
    {\Large \bf \expandafter{\@title} \par}%
    \vskip 10ex%
    {\normalsize
      \if@PhD
         {\em A THESIS }\par
         \vskip 5ex%
         \if@Synopsis
            {\normalsize \em to be submitted by \par}
         \else
            {\normalsize \em submitted by \par}
         \fi
         \vskip 5ex%
         {\bf \large\MakeUppercase{\@author}\par\par}
         \vskip 5ex%
         {\em for the award of the degree }\par
         \vskip 5ex%
         {\em of} \par
         \vskip 5ex%
         {\bf \large \MakeUppercase{Doctor of Philosophy}} \par
       \else
         \if@MS
            {\em A THESIS }\par
            \vskip 5ex%
            {\normalsize \em submitted by \par}
            \vskip 5ex%
            {\bf \large\MakeUppercase{\@author}\par\par}
            \vskip 5ex%
            {\em for the award of the degree }\par
            \vskip 5ex%
            {\em of} \par
            \vskip 5ex%
            {\bf \large \MakeUppercase{Master Of Science}} \par
            (by Research) \par
         \else
           {\em A Project Report }\par
           \vskip 5ex%
           {\normalsize \em submitted by \par}
           \vskip 5ex%
           {\bf \large\MakeUppercase{\@author}\par\par}
           \vskip 5ex%
           {\normalsize \em in partial fulfilment of the requirements\par
             for the award of the degree of \par}
           \vskip 5ex%
           \fi
         \fi
    }
  \end{center}%
  \vspace*{0.75in}
  %\centerline{\psfig{figure=emblem.ps}}
%  \centerline{\includegraphics{iiser_logo.eps}}
  \centerline{\includegraphics[scale=1]{iiser_logo}}
  \vspace*{-0.15in}
  \begin{center}
    {\bf \large Department of \@department\par}
    {\bf \large XXXXXXXXXXXXXXXXXX}\\
    {\bf \large XXXXXXXXXXXXXXX}
    \vglue 0.50em
    {\bf \large \@date}\par
  \end{center}
  \parskip 8pt
}

\def\titlepage{\newpage\thispagestyle{empty}\c@page\z@}
\def\endtitlepage{\newpage}



\if@Synopsis
   \renewcommand\refname{REFERENCES}
\else
   % QUOTATIONS
   %
   \def\quotations{\chapter*{\centerline{QUOTATIONS}}
   %\addcontentsline{toc}{chapter}{QUOTATIONS}
   }

   % DEDICATION
   %
   \def\dedication{\chapter*{\centerline{DEDICATION}}
   %\addcontentsline{toc}{chapter}{DEDICATION}
   }

   % CERTIFICATE
   %
   %   - this produces a certificate page as per IISERM Regulations
   %     comment the following lines out to get it working.
   %
   \def\certificate{%% A preliminary chapter
     \clearpage
     \vspace*{36pt}
     %\centerline{\Large \bf THESIS CERTIFICATE}
     \centerline{\Large \bf DECLARATION}
     \vskip 25pt
     \thispagestyle{empty}
     \typeout{Certificate}
     \setcounter{page}{0}
   }

   % ACKNOWLEDGEMENTS
   %
   \def\acknowledgements{\chapter*{\centerline{ACKNOWLEDGEMENTS}}
     %\addcontentsline{toc}{chapter}{ACKNOWLEDGEMENTS}
     \addcontentsline{toc}{chapter}{Acknowledgements}
   }

   % ABSTRACT
   %   - this produces pages suitable for an %   IISERM Abstract
   \def\abstract{\chapter*{\centerline{ABSTRACT}}
   \addcontentsline{toc}{chapter}{ABSTRACT}
   }

   % GLOSSARY
   %
   \def\glossary{\chapter*{\centerline{GLOSSARY}}
   \addcontentsline{toc}{chapter}{GLOSSARY}
   }

   % ABBREVIATIONS
   %
   \def\abbreviations{\chapter*{\centerline{ABBREVIATIONS}}
   \addcontentsline{toc}{chapter}{ABBREVIATIONS}
   }

   % Use the nomencl package for the NOTATION section.

   % Makes the chapter heading
   \def\@makechapterhead#1{%
     {\parindent \z@ \raggedright \normalfont
       \ifnum \c@secnumdepth >\m@ne
       \begin{center}
         \Large\bfseries \@chapapp\space \thechapter
       \end{center}
       \par\nobreak
       \vskip 20\p@
       \fi
       \interlinepenalty\@M
       \Large \bf
       \begin{center}
         #1\par\nobreak      
       \end{center}
       \vskip 20\p@
       \thispagestyle{empty}
     }}

   % Makes the chapter heading for \chapter* commands
   \def\@makeschapterhead#1{%
     \vspace*{25\p@}%
     {\parindent \z@ \raggedright
       \normalfont
       \interlinepenalty\@M
       \Large \bfseries #1\par\nobreak
       \vskip 20\p@
     }}

   %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
   % Renewed commands to set the titles of various pages correctly.
   \renewcommand\contentsname{\centering TABLE OF CONTENTS}
   \renewcommand\listfigurename{\centering LIST OF FIGURES}
   \renewcommand\listtablename{\centering LIST OF TABLES}
   \renewcommand{\chaptername}{CHAPTER}
   \renewcommand\bibname{\centering REFERENCES}
   \renewcommand\appendixname{APPENDIX}
\fi

此外,我将用以下序言开始实际文件。

\documentclass[PhD,twoside,openright]{the class file above}
\usepackage{float}
\usepackage{appendix}
\usepackage{times}
\usepackage{comment}
\usepackage{color}
\usepackage{t1enc}
\usepackage{rotating}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{xspace}\usepackage{psfrag}
\usepackage{amsmath, amssymb}
\usepackage{amscd,amsfonts,color,bbm, amssymb, amsthm}
\usepackage{latexsym, graphicx, pstricks,rotating,enumerate}

\usepackage{wrapfig}\usepackage{framed,graphicx,xcolor}

\usepackage{tikz}
\usetikzlibrary{calc,positioning,fit,backgrounds}

\pgfdeclarelayer{background}
\pgfsetlayers{background,main}
\usepackage[pdftex,bookmarks,colorlinks]{hyperref}

抱歉代码太长了。我的论文使用了不同的包。

答案1

您没有提供关于章节前缀、大写字母或页码位置的详细信息。不过,这里有一个解决方案,使用scrpage2(部分KOMA-Script) 以实现所需的章节/节标题位置。有关详细信息,请参阅KOMA-Script手册的第 5.1 节。

\documentclass[12pt,a4paper,twoside,openright]{report}

\usepackage[automark,nouppercase]{scrpage2}
\clearscrheadfoot
\ohead{\headmark}
\cfoot[\pagemark]{\pagemark}% optional argument controls chapter-starting pages
\pagestyle{scrheadings}

\renewcommand{\chaptermarkformat}{\thechapter. \ }% removes prefix "Chapter"

\usepackage{lipsum}

\begin{document}

\chapter{foo}

\section{foobar}

\lipsum[1-15]

\end{document}

编辑:问题,剥离到其本质(这可能由你完成),是\centering在定义中使用或其他格式化命令\contentsname将对页眉和页脚造成严重破坏。\contentsname应该包含仅有的实际名称;将带星号的章节标题居中,例如,为 的定义\tableofcontents添加一个环境。center\@makeschapterhead

另外,删除正确放置标题的nohead选项。geometry

\documentclass[12pt,a4paper,twoside,openright]{report}

\usepackage[a4paper,left=1.5in,right=1in,top=1in,bottom=1in]{geometry}
%     option `nohead` REMOVED

\usepackage[automark,nouppercase]{scrpage2}
\clearscrheadfoot
\ohead{\headmark}
\cfoot[\pagemark]{\pagemark}% optional argument controls chapter-starting pages
\pagestyle{scrheadings}

\renewcommand{\chaptermarkformat}{\thechapter. \ }% removes prefix "Chapter"

% \renewcommand\contentsname{\centering TABLE OF CONTENTS}% REMOVED

\makeatletter
   % Makes the chapter heading for \chapter* commands
   \def\@makeschapterhead#1{%
     \vspace*{25\p@}%
     {\parindent \z@ \raggedright
       \normalfont
       \interlinepenalty\@M
       \begin{center}% ADDED
       \Large \bfseries #1\par\nobreak
       \end{center}% ADDED
       \vskip 20\p@
     }}
\makeatother

\usepackage{lipsum}

\begin{document}

\tableofcontents

\chapter{foo}

\section{foobar}

\lipsum[1-15]

\end{document}

相关内容