我的大学最近更改了论文的格式标准,我正在使用一个 LaTeX 样式的文件,该文件已被其他人破解。它或多或少能正常工作,但每次我需要更改某些内容时,我都必须手动覆盖格式。
主要问题是从页面顶部到章节(或“列表...”)标题的间距。标准要求这些间距距页面顶部 2 英寸,居中,采用 12pt 罗马字体,后面有两个单倍行距的空白行。
根据要求,这是一个“最小”示例。不幸的是,这些文件中有很多东西,我很难理解它们。
在 utcthesis.cls 文件中,我有以下内容:
\NeedsTeXFormat{LaTeX2e}%
\def\filename{utcthesis.cls}%
\def\fileversion{ver 1.0.0}%
\def\filedate{March 30, 2010}%
\def\contributors{Tony Saad}%
\ProvidesClass{utcthesis}
% some internal variables
\def\thesisID{1}%
\def\dissertationID{2}%
\def\theDocumentType#1{\gdef\@theDocumentType{#1}}%
\def\documentID#1{\gdef\@documentID{#1}}% documentID is either 1 (for thesis) or 2 (for dissertation)
% declare package options
\DeclareOption{thesis}{%
\def\@theDocumentType{thesis}%
\def\@documentID{\thesisID}}%
\DeclareOption{dissertation}{%
\def\@theDocumentType{dissertation}%
\def\@documentID{\dissertationID}}%
\DeclareOption{linespacing}{\@lnspacing}
\DeclareOption*{\PassOptionsToPackage{\CurrentOption}{color}}%
\DeclareOption*{\PassOptionsToClass{\CurrentOption}{report}}%
\ExecuteOptions{dissertation,letterpaper,12pt}% execute default options
\ProcessOptions%
\LoadClass{report} % single-sided
\RequirePackage{amsmath,amsthm,amssymb} % AMS math, AMS theorem, AMS fonts
\RequirePackage{setspace} % line spacing
\RequirePackage[vcentering,dvips]{geometry} % help with margins
\RequirePackage[pdftex,plainpages=false,pdfpagelabels=true,breaklinks=true]{hyperref} % for pdf bookmarks
\RequirePackage{color}
\RequirePackage{multicol}
\let\origdoublepage\cleardoublepage
\newcommand{\clearemptydoublepage}{%
\clearpage
{\pagestyle{empty}\origdoublepage}%
}
\let\cleardoublepage\clearemptydoublepage
\hypersetup{%
bookmarksnumbered = true,
pdfpagelayout=SinglePage,
bookmarksopen=False,
pdfborder=0 0 0, % make all links invisible, so the pdf looks good when printed
pdffitwindow=true, % window fit to page when opened
pdfnewwindow=true, % links in new window
colorlinks=true, % false: boxed links; true: colored links
linkcolor=blue, % color of internal links
citecolor=magenta, % color of links to bibliography
filecolor=magenta, % color of file links
urlcolor=cyan % color of external links
}
\geometry{
letterpaper,
left = 1.0in,
right = 1.0in,
top = 1.0in,
bottom = 1.2in
}
\hyphenpenalty=5000 % reduce hyphenation as much as possible
\tolerance=1000 % goes with the previous command
\clubpenalty=10000 % Minimize orphans orphans(eliminate 10000)
\widowpenalty=10000 % Minimize widows
\brokenpenalty=10000 % Do not allow hyphen across pages
\renewcommand{\thefootnote}{\fnsymbol{footnote}}
\raggedbottom
\pagestyle{plain}
\renewcommand{\@makeschapterhead}[1]{%
\vspace*{0.5in }%
\begin{center}
\uppercase{#1}
\mbox{} \\
\end{center}
}
\renewcommand{\@makechapterhead}[1]{%
\vspace*{0.5in }%
\begin{center}
CHAPTER \thechapter
\mbox{} \\
\uppercase{#1}
\mbox{} \\
\end{center}
}
\def\@chapter[#1]#2{\ifnum \c@secnumdepth >\m@ne
\refstepcounter{chapter}%
\typeout{\@chapapp\space\thechapter.}%
\addcontentsline{toc}{chapter}%
{\protect\numberline{\thechapter}\uppercase{#2}}%
\else
\addcontentsline{toc}{chapter}{#2}%
\fi
\chaptermark{#1}%
\if@twocolumn
\@topnewpage[\@makechapterhead{#2}]%
\else
\@makechapterhead{#2}%
\@afterheading
\fi
}
\renewcommand\section{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalsize}}
\renewcommand\subsection{\@startsection {section}{1}{\z@}%
{-3.5ex \@plus -1ex \@minus -.2ex}%
{2.3ex \@plus.2ex}%
{\normalsize\centering}}
\newcommand {\addToTOC}[1] {
\cleardoublepage
\phantomsection
\addcontentsline{toc}{part}{#1}
}
\newcommand {\addToPDFBookmarks}[3] {
\cleardoublepage
\phantomsection
\pdfbookmark[#1]{#2}{#3}
}
\endinput
在 thesis.tex 中:
\documentclass[thesis,monochrome,letterpaper,12pt]{utcthesis} %thesis, one side, monochrome text
\renewcommand{\baselinestretch}{2.0}
\usepackage{indentfirst}
\usepackage{verbatim}
\usepackage{float}
\usepackage[numbers]{natbib}
\usepackage{graphicx}
\usepackage{fancyhdr}
\usepackage{url}
\usepackage[inactive]{srcltx}
\usepackage{relsize}
\usepackage{booktabs}
\usepackage{mathrsfs}
\usepackage{setspace}
\usepackage{subfigure}
\usepackage[subfigure]{tocloft}
\usepackage{titlesec}
\usepackage[format=hang,labelsep=space,skip=20pt]{caption}
\usepackage{algpseudocode}
\usepackage{algorithm}
\usepackage{longtable}
\usepackage[acronym,nonumberlist,nopostdot]{glossaries}
\usepackage{setspace}
\usepackage[english]{babel}
\usepackage{blindtext}
\setcounter{secnumdepth}{0} %turn off numbering for all but chapters in the table of contents
\renewcommand{\cftchapnumwidth}{2em}
\setlength{\cftchapindent}{0.5in}
\setlength{\cftsecindent}{6em}
\setlength{\cftsubsecindent}{1.5in}
\setlength{\cftsubsubsecindent}{2.0in}
\renewcommand{\cftpartleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
%TOC formatting
\setcounter{secnumdepth}{0} %turn off numbering for all but chapters in the table of contents
\renewcommand{\cftchapnumwidth}{2em}
\setlength{\cftchapindent}{.5in}
\renewcommand{\cftpartleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cftchapleader}{\cftdotfill{\cftdotsep}}
\renewcommand{\cftsecindent}{6em }
\setcounter{tocdepth}{1}
%Set proper spacing after lot, lof, toc, headings
\setlength{\cftbeforetoctitleskip}{0.45in}
\setlength{\cftaftertoctitleskip}{1em}
\setlength{\cftafterloftitleskip}{1em}
\setlength{\cftafterlottitleskip}{1em}
\setcounter{tocdepth}{3}
\setlength{\cftbeforepartskip}{1.5em}
\renewcommand{\cftchappagefont}{\fontsize{11}{13}}
\renewcommand{\cftchapfont}{\fontsize{11}{13}}
\renewcommand{\cftpartpagefont}{\fontsize{11}{13}}
\renewcommand{\cftpartfont}{\fontsize{11}{13}}
\renewcommand{\cftsecfont}{\fontsize{11}{13}}
\setlength{\cftbeforefigskip}{1em}
\setlength{\cftbeforetabskip}{1em}
\raggedbottom
\begin{document}
\renewcommand{\contentsname}{\begin{center}\textmd {\normalsize TABLE OF CONTENTS}\end{center}\vspace*{-0.18in}}
\renewcommand{\listfigurename}{\begin{center}\textmd{ \normalsize LIST OF FIGURES}\end{center}\vspace*{-0.18in}}
\renewcommand{\listtablename}{\begin{center}\textmd{ \normalsize LIST OF TABLES}\end{center}\vspace*{-0.18in}}
\renewcommand{\bibname}{\begin{center}\textmd{\normalsize REFERENCES}\end{center}\vspace*{-0.18in}}
\pagenumbering{alph} % this is needed to clear certain issues with the hyperref package
\newacronym{aip}{$\mathrm{AIP}$}{Aerodynamic Interface Plane}
\newacronym{cfd}{$\mathrm{CFD}$}{Computational Fluid Dynamics}
\makeglossaries
\singlespacing
\addToPDFBookmarks{0}{Table of Contents}{f}
\tableofcontents % generate a table of contents
\addToTOC{LIST OF TABLES} % this will add the list of tables to the Table of Contents (TOC)
{\singlespacing
\vspace*{-2em}
\listoftables % generate a list of tables
}
\doublespacing
\glsaddall
\addToTOC{LIST OF ABBREVIATIONS}
\printglossary[style=long,type=\acronymtype,title=LIST OF ABBREVIATIONS]
\addToTOC{CHAPTER}
\newpage
\pagenumbering{arabic}
\setcounter{page}{1}
\chapter{First Chapter}
\blindtext
\begin{table}[htb]
\centering
\renewcommand{\arraystretch}{1.25}
\caption{Just some data}
\begin{tabular}{lcc}
\toprule
Column A & Col B & Col C \\
\midrule
Row 1 & 0.9558 & 0.6531 \\
Row 2 & 0.9572 & 0.6508 \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
如果您编译 thesis.tex 文件,您应该能够看到第 1 章和缩写列表标题的大小和间距匹配,但目录和表格列表标题不匹配。
我的目标是以一种易于维护的方式解决这个问题,然后与学校的其他人分享。
如果有帮助的话,样式指南在这里:http://www.utc.edu/graduate-school/pdfs/thesis-dissertation-standards-3-25-13.pdf
LaTeX 文件位于 Bitbucket 上:https://bitbucket.org/tonymcdaniel/utc_thesis
答案1
当我用你的类编译一个小测试文件时,它非常接近你想要的效果。据我所知,章节标题和正文以及页面顶部之间没有足够的空间。对于这两个问题,你可以将\@makechapterhead
(在 utcthesis.cls 中)定义为:
\renewcommand{\@makechapterhead}[1]{%
\vspace*{1in}%
\begin{center}
CHAPTER \thechapter
\mbox{} \\
\uppercase{#1}
\mbox{} \\[2\baselineskip]
\end{center}
}
现在它将在上方和下方添加空间。使用此解决方案,您必须调整\vspace
第 2 行的实际所需空间。这取决于文档的页面跨度。虽然该类正在为您执行此操作,但只要您使用此类,给定的解决方案就会起作用。在本例中:1in(从上边框到章节标题总共获得 2in)。
一个简单的测试:
\documentclass{utcthesis}
\usepackage{lipsum}
\begin{document}
\chapter{Test}\lipsum
\end{document}
(顺便说一下,这是一个最小的例子。示例序言中加载的任何包都不会影响章节标题。)