花哨的标题不太起作用

花哨的标题不太起作用

我正在尝试将表格中的标题格式化为内容,以适应我大学的论文格式。我有两个文件。第一个文件是 dis.tex,第二个文件是 asudis.sty,都粘贴在下面。目录的第一页是正确的/是必需的,但第二页在左侧和右侧标题上有目录,尽管 .sty 文件说应该不是这样。它需要在第二页上将“章节”作为左侧标题,将“页面”作为右侧标题。在包含表格列表的第三页上,这是正确的,但第 4 页和第 5 页也需要在左侧显示“表格”,在右侧显示“页面”,而是在左侧和右侧标题上都显示“表格列表”。对于图表列表,同样如此 - 第 6 页是正确的,但第 7-8 页应该在左侧显示“图表”,在右侧显示“页面”。.sty 文件在我看来是正确的,因为它要求 latex 使用表格和页面作为标题。

分布:

\documentclass[12pt,letterpaper]{report}
\usepackage{natbib}  
\usepackage[sectionbib,,globalcitecopy]{bibunits}% SC added
\defaultbibliographystyle{asudis} 
\defaultbibliography{dis} 
\usepackage{geometry}
\usepackage{fancyhdr}
\usepackage{afterpage}
\usepackage{graphicx}
\usepackage{amsmath,amssymb,amsbsy}
\usepackage{dcolumn,array}
\usepackage{tocloft}
\usepackage{asudis1}
\usepackage{lipsum} 

\usepackage[font=xipt,labelfont=bf]{caption}


\begin{document}


\tableofcontents   

% This puts the word "Page" right justified above everything else.
\addtocontents{toc}{~\hfill Page\par}
\newpage
% Making the LOT and LOF "parts" rather than chapters gets them indented at
% level -1 according to the chart: top of page 4 of the document at
% ftp://tug.ctan.org/pub/tex-archive/macros/latex/contrib/tocloft/tocloft.pdf

% This gets the headers for the LOT right on the first page.  Subsequent pages
% are handled by the fancyhdr code in the asudis.sty file.

\addcontentsline{toc}{part}{LIST OF TABLES}
\renewcommand{\cftlabel}{Table}
\listoftables
\addtocontents{lot}{Table~\hfill Page \par}
\newpage

\addcontentsline{toc}{part}{LIST OF FIGURES}
\addtocontents{toc}{CHAPTER \par}
\renewcommand{\cftlabel}{Figure}
\listoffigures
\addtocontents{lof}{Figure~\hfill Page \par}
\newpage

% This gets the headers for the LOF right on the first page.  Subsequent pages
% are handled by the fancyhdr code in the asudis.sty file.

\pagestyle{plain}

%-----------------------body
\doublespace
\pagenumbering{arabic}

\chapter{lipsum 1}
\lipsum[1-2]
\section{lipsum 1a}
\lipsum[2-3]
\section{lipsum 1b}
\lipsum[4-5]
\section{lipsum 1c}
\lipsum[6-7]
\section{lipsum 1c}
\lipsum[8-9]

\begin{figure}
\caption{\lipsum[1]}
\end{figure}
\pagebreak
\begin{figure}
\caption{\lipsum[2]}
\end{figure}
\pagebreak
\begin{figure}
\caption{\lipsum[3]}
\end{figure}
\pagebreak
\begin{table}
\caption{\lipsum[4]}
\end{table}
\pagebreak
\begin{table}
\caption{\lipsum[5]}
\end{table}
\pagebreak
\begin{table}
\caption{\lipsum[6]}
\end{table}

\chapter{lipsum 2}
\lipsum[1-2]
\section{lipsum 1a}
\lipsum[2-3]
\section{lipsum 1b}
\lipsum[4-5]
\section{lipsum 1c}
\lipsum[6-7]
\section{lipsum 1c}
\lipsum[8-9]
\begin{figure}
\caption{\lipsum[7]}
\end{figure}
\pagebreak

\begin{figure}
\caption{\lipsum[8]}
\end{figure}

\pagebreak
\begin{figure}
\caption{\lipsum[9]}
\end{figure}
\pagebreak
\begin{table}
\caption{\lipsum[10]}
\end{table}
\pagebreak
\begin{table}
\caption{\lipsum[11]}
\end{table}
\pagebreak
\begin{table}
\caption{\lipsum[12]}
\end{table}
\chapter{lipsum 3}
\lipsum[1-2]
\section{lipsum 1a}
\lipsum[2-3]
\section{lipsum 1b}
\lipsum[4-5]
\section{lipsum 1c}
\lipsum[6-7]
\section{lipsum 1c}
\lipsum[8-9]

\chapter{lipsum 4}
\lipsum[1-2]
\section{lipsum 1a}
\lipsum[2-3]
\section{lipsum 1b}
\lipsum[4-5]
\section{lipsum 1c}
\lipsum[6-7]
\section{lipsum 1c}
\lipsum[8-9]
\chapter{lipsum 3}
\lipsum[1-2]
\section{lipsum 1a}
\lipsum[2-3]
\section{lipsum 1b}
\lipsum[4-5]
\section{lipsum 1c}
\lipsum[6-7]
\section{lipsum 1c}
\lipsum[8-9]

\end{document}

第二个文件是 asudis1.sty:

\geometry{top=1.0in,hmargin=1.25in,height=9.0in,includefoot,
letterpaper}%,showframe,showcrop}
%
% Define singlespace and doublespace commands for 12pt fonts.
%
\newcommand{\doublespace} {
  \renewcommand{\baselinestretch}{1.66}\small\normalsize
}
\newcommand{\exactdoublespace} {
  \renewcommand{\baselinestretch}{1.8}\small\normalsize
}
\newcommand{\oneandhalfspace} {
  \renewcommand{\baselinestretch}{1.24}\small\normalsize
}
\newcommand{\singlespace} {
  \renewcommand{\baselinestretch}{0.9}\small\normalsize
}
\singlespace

%
% Fix the table of contents
%
%
% Get leader dots right.  They should all be spaced the same and need to be
% added for chapters and parts.
%
\renewcommand{\cftchapdotsep}{1.7}
\renewcommand{\cftchapleader}{\cftdotfill{\cftchapdotsep}}
\renewcommand{\cftpartdotsep}{1.7}
\renewcommand{\cftpartleader}{\cftdotfill{\cftpartdotsep}}
\renewcommand{\cftsecdotsep}{1.7}
\renewcommand{\cftsubsecdotsep}{1.7}
\renewcommand{\cfttabdotsep}{1.7}
\renewcommand{\cftfigdotsep}{1.7}
%
% Fonts for the chapter titles and part titles.
%
\renewcommand{\cftchapfont}{\rm}
\renewcommand{\cftpartfont}{\rm}
\renewcommand{\cftchappagefont}{\rm}
\renewcommand{\cftpartpagefont}{\rm}
%
% Indentations: These are in accordance with the chart at the top of page 4 of
% the document
% ftp://tug.ctan.org/pub/tex-archive/macros/latex/contrib/tocloft/tocloft.pdf
% I simply moved each of the following sections "up" one level to get the
% indentations right.
%
\cftsetindents{chapter}{1.5em}{1.5em}
\cftsetindents{section}{3.0em}{2.3em}
\cftsetindents{subsection}{5.3em}{3.2em}
%
% Spacing between entries is taken care of by the double-spacing in this 
% section, so no need for extra space before chapter or part entries.
%
\setlength{\cftbeforepartskip}{0truept}
\setlength{\cftbeforechapskip}{0truept}
%
% Get the title for the TOC normal sized, centered, and at the right height.
%
\setlength{\cftbeforetoctitleskip}{-64.0truept}
\setlength{\cftaftertoctitleskip}{0truept}
%

\renewcommand{\@cfttocstart}{ 
   \newgeometry{top=1.0in,hmargin=1.25in,height=9.0in,
   includehead,includefoot,letterpaper}%,showcrop,showframe}

   \doublespace
   \pagestyle{fancyplain}
   \afterpage{\lhead{\cftlabel}\rhead{Page}}
}

\renewcommand{\@cfttocfinish}{
   \restoregeometry\clearpage\afterpage{\lhead{}\rhead{}}
}

%%%%%%%%%%%%%%%%%%%%
\renewcommand{\contentsname}{TABLE OF CONTENTS}
\renewcommand{\cfttoctitlefont}{\hfill\normalsize\rm}
\renewcommand{\cftaftertoctitle}{\hfill}
%
\newcommand{\cftlabel}{CHAPTER}
%
% Get rid of the header underline.
\renewcommand{\headrulewidth}{0pt}
%
% Get the header on subsequent pages right.
%
% Get the title for the LOT normal sized, centered, and at the right height.
%
\setlength{\cftbeforelottitleskip}{-64.0truept}
\setlength{\cftafterlottitleskip}{0truept}
%

\renewcommand{\listtablename}{LIST OF TABLES}
\renewcommand{\cftlottitlefont}{\hfill\normalsize\rm}
\renewcommand{\cftafterlottitle}{\hfill}
% 
% Get the title for the LOF normal sized, centered, and at the right height.
%
\setlength{\cftbeforeloftitleskip}{-64.0truept}
\setlength{\cftafterloftitleskip}{0truept}
%
\renewcommand{\listfigurename}{LIST OF FIGURES}
\renewcommand{\cftloftitlefont}{\hfill\normalsize\rm}
\renewcommand{\cftafterloftitle}{\hfill}


%%%%%%%%%%


\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
                        \refstepcounter{chapter}%
                        \typeout{\@chapapp\space\thechapter.}%
                        \addcontentsline{toc}{chapter}%
                        {\protect\numberline{\thechapter}{\texorpdfstring{\MakeUppercase{#1}}{}}}%
                    \else
                        \addcontentsline{toc}{chapter}{#1}%
                    \fi
                    \chaptermark{#1}%

                    %These two lines below are commented out.

                    %\addtocontents{lof}{\protect\addvspace{10\p@}}%
                    %\addtocontents{lot}{\protect\addvspace{10\p@}}%
                    \if@twocolumn
                      \@topnewpage[\@makechapterhead{#2}]%
                    \else
                      \@makechapterhead{#2}%
                      \@afterheading
                    \fi}

%
% Change some of the rules for float placement.
%
\setcounter{topnumber}{2}          %Maximum 2 floats on top
\setcounter{bottomnumber}{1}       %Maximum 1 float on bottom
%\renewcommand{\topfraction}{0.7}    %Top float max size is 70%
%\renewcommand{\bottomfraction}{0.7} %Bottom float max size is 70%
\renewcommand{\topfraction}{0.9}    %Top float max size is 70%
\renewcommand{\bottomfraction}{0.8} %Bottom float max size is 70%
\renewcommand{\floatpagefraction}{0.7}


%
% Fix chapter and section formats
%
% Chapters names are all caps, centered under "Chapter N"
\renewcommand{\@makechapterhead}[1]{
\begin{center}
\chaptername\ \thechapter\vspace{\baselineskip}\\
\uppercase\expandafter{#1}\vspace{\baselineskip}
\end{center}
}
% Numbers chapters, sections, and subsections
\setcounter{secnumdepth}{2}
% Center section titles
\renewcommand{\section}{\@startsection{section}{1}{0 in}{1em}{1em}{\centering}}
% Center and italicize subsection titles
\renewcommand{\subsection}{\@startsection{subsection}{2}{0 in}{1em}{1em}
{\centering\slshape}}

% This is a bit of a hack.  I couldn't figure out a better way, but surely there
% is one.  What I want is for the title page of the appendix to appear with
% just one double space between the words "Appendix A" and the title.  So, here,
% I redefine the command with our \singlespace command, and then inside the 
% actual appendix, I use \doublespace.  This gets the spacing of the appendix
% title page right.

\renewcommand\appendix{\par
   \setcounter{chapter}{0}%
   \setcounter{section}{0}%
   \gdef\@chapapp{\appendixname}%
   \gdef\thechapter{\@Alph\c@chapter}
   
   % I added this line.

   \singlespace}

%
% Fix bibliography header.
%
\renewcommand\bibname{References}
\renewcommand\bibsection{
\begin{center}\uppercase\expandafter{\bibname}\vspace{1em}\end{center}
}

%
% Modify figure captions so that they print singlespace.
%
\renewcommand{\@makecaption}[2]{% #1 is e.g. Figure 1, #2 is captiontext
  \singlespace
  {\textbf{#1:} #2\par}
}

%
% Modify footnotes to be single spaced per footnote, double in between
%

\setlength{\footnotesep}{\baselineskip} %double space between footnotes

\let\oldfootnoterule\footnoterule %dont put a gap between the line and the first footnote
\def\footnoterule{\oldfootnoterule\vspace{-0.2\baselineskip}}

\let\oldfn\footnote   %single space individual footnotes
\renewcommand{\footnote}[1]{\singlespace\oldfn{#1}\doublespace}

答案1

两件事情:

  1. 您的asudis1.sty文件没有正确自定义文档(许多定义只是黑客行为)。我的建议是不要使用它。无论如何,如果您没有其他选择,至少您应该通过理解其中的命令来了解它已设置的内容。您还应该注意编译错误。在您的dis.tex文件中,您需要hyperref在序言末尾加载包,否则\texorpdfstring命令未定义。font=xipt for caption package 没有意义,因为您没有\DeclareCaptionFont{xipt}{some code}。所以你的序言应该是这样的:
\documentclass[12pt,letterpaper]{report}
\usepackage{natbib}  
\usepackage[sectionbib,,globalcitecopy]{bibunits}% SC added
\defaultbibliographystyle{asudis} 
\defaultbibliography{dis} 
\usepackage{geometry}
\usepackage{fancyhdr}
\setlength{\headheight}{15pt}
\usepackage{afterpage}
\usepackage{graphicx}
\usepackage{amsmath,amssymb,amsbsy}
\usepackage{dcolumn,array}
\usepackage{tocloft}
\usepackage{lipsum} 
\usepackage{xcolor}
\usepackage{asudis1}
\usepackage{caption}
\captionsetup{labelfont=bf}
\usepackage[hidelinks]{hyperref}
  1. 要使标题行为如您所说,您需要在文件中更改相应的代码,如下所示asudis1.sty。我从命令中删除了 letterpaper 选项,\newgeometry因为它在这里不可用。
\renewcommand{\@cfttocstart}{ 
   \newgeometry{top=1.0in,hmargin=1.25in,height=9.0in,
   includehead,includefoot}%,letterpaper option not available in `\newgeometry'%,showcrop,showframe} % changed

   \doublespace
   \pagestyle{fancyplain}
   \afterpage{\markboth{\normalfont Page}{\normalfont\cftlabel}\markright{\normalfont\cftlabel}}
}% changed

相关内容