我正在使用从同事那里借来的以下 .tex 模板:
\documentclass[11pt,twoside]{book}
\usepackage{a4wide}
\usepackage{fancyhdr}
\usepackage[dvips]{epsfig}
\usepackage{palatino,float,subfigure,shadow,fancybox,amsfonts,appendix}
\usepackage{stmaryrd}
\usepackage[nottoc]{tocbibind}
\usepackage{makeidx}
\pagestyle{fancy} \makeindex %\authorindex
\renewcommand{\headrulewidth}{.1pt}
\fancyhead[LE,RO]{{\thepage}}
\fancyhead[RE]{\nouppercase{{\leftmark}}}
\fancyhead[LO]{\nouppercase{{\rightmark}}} \fancyfoot{}
\def\baselinestretch{1.1}
\pagenumbering{roman}
\date{\today}
\clubpenalty=10000 \widowpenalty=10000
\newcommand*\chancery{\fontfamily{pzc}\selectfont}
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}% bold math
\usepackage{hyperref}
\usepackage{upgreek}
\usepackage[utf8]{inputenc}
\usepackage{mathrsfs}
\usepackage{alltt}
\usepackage{tikz-cd}
\usepackage{aliascnt}
\usepackage{tikz}
\usepackage{mathtools}
\usepackage{multicol}
\usepackage{charter}
\usepackage{relsize}
\usepackage{amsmath,amssymb,amsthm,graphicx,amsxtra, setspace}
\usepackage{type1cm,eso-pic}
\allowdisplaybreaks
\usepackage{scalerel,stackengine}
\stackMath
\newcommand\reallywidehat[1]{%
\savestack{\tmpbox}{\stretchto{%
\scaleto{%
\scalerel*[\widthof{\ensuremath{#1}}]{\kern-.6pt\bigwedge\kern-.6pt}%
{\rule[-\textheight/2]{1ex}{\textheight}}%WIDTH-LIMITED BIG WEDGE
}{\textheight}%
}{0.5ex}}%
\stackon[1pt]{#1}{\tmpbox}%
}
\parskip 1ex
\theoremstyle{definition}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{remark}[theorem]{Remark}
\renewcommand{\theequation}{\arabic{section}.\arabic{equation}}
\newcommand{\mainidx}[1]{{\it #1}}
\newcommand{\boldidx}[1]{{\bf #1}}
\DeclareMathOperator*{\esssup}{ess\,sup}
\DeclareMathOperator{\tr}{Tr}
\makeatletter
\newcommand{\doublewidetilde}[1]{{%
\mathpalette\double@widetilde{#1}%
}}
\newcommand{\double@widetilde}[2]{%
\sbox\z@{$\m@th#1\widetilde{#2}$}%
\ht\z@=.9\ht\z@
\widetilde{\box\z@}%
}
\makeatother
\newcommand{\mc}{\mathcal}
\newcommand{\mf}{\mathfrak}
\newcommand{\mb}{\mathbb}
\newcommand{\xra}{\xrightarrow}
\newcommand{\ra}{\rightarrow}
\newcommand{\rra}{\rightrightarrows}
\renewcommand{\d}{\/\mathrm{d}\/}
\renewcommand{\thefootnote}{\arabic{footnote}}
\def\listofsymbols{\input{symbols} \cleardoublepage}
\def\addsymbol #1: #2#3{$#1$ \> \parbox{5in}{#2 \dotfill \pageref{#3}}\\}
\def\newnot#1{\label{#1}}
\hypersetup{
%bookmarks=true, % show bookmarks bar?
unicode=false, % non-Latin characters in Acrobat�s bookmarks
pdftoolbar=true, % show Acrobat�s toolbar?
pdfmenubar=true, % show Acrobat�s menu?
pdffitwindow=false, % window fit to page when opened
pdfstartview={FitH}, % fits the width of the page to the window
pdftitle={My title}, % title
pdfauthor={Author}, % author
pdfsubject={Subject}, % subject of the document
pdfcreator={Creator}, % creator of the document
pdfproducer={Producer}, % producer of the document
pdfkeywords={keywords}, % list of keywords
pdfnewwindow=true, % links in new window
colorlinks=true, % false: boxed links; true: colored links
linkcolor=blue, % color of internal links
citecolor=blue, % color of links to bibliography
filecolor=magenta, % color of file links
urlcolor=green % color of external links
}
\newcommand {\apgt} {\ {\raise-.5ex\hbox{$\buildrel>\over\sim$}}\ }
\newcommand {\aplt} {\ {\raise-.5ex\hbox{$\buildrel<\over\sim$}}\ }
\makeatletter
\def\myfnt{\ifx\protect\@typeset@protect\expandafter\footnote\else\expandafter\@gobble\fi}
\makeatother
\begin{document}
\doublespace
\include{Title}
\pagenumbering{arabic}
\setcounter{page}1
\newpage
\thispagestyle{empty} \cleardoublepage
\setcounter{secnumdepth}{3} % organisational level that receives a numbers
\tableofcontents
\newpage
\newpage
\thispagestyle{empty}
\include{Preliminaries}
\include{chapter2}
\include{chapter3}
\include{chapter4}
\include{chapter5}
\include{chapter6}
%The style you want to use for references.
\newpage
\thispagestyle{plain}\chapter*{Publications arising out of the PhD
thesis\hfill} \addcontentsline{toc}{chapter}{Publications arising
out of the PhD thesis}
\begin{enumerate}
\item [{[1]}]
\end{enumerate}
\clearpage
\newpage
\thispagestyle{empty}
\bigskip{}
\vspace{1cm} \cleardoublepage
\bibliography{references}
\bibliographystyle{plain}
\singlespace
\printindex %\printauthorindex
\end{document}
有人可以帮我删除文件中过时的命令(存在但没有任何用途的命令)吗?
答案1
您的文档序言确实很混乱,我认为提供一些指导很有用。
a4wide
已被弃用 20 多年epsfig
仅为了与二十年前的文档兼容而存在palatino
已弃用 20 多年(使用mathpazo
或newpxtext,newpxmath
)subfigure
已弃用float
不太可能有用(其[H]
浮点选项没用)type1cm
已经过时不要使用
\def
为什么设置中有这么多括号
fancyhdr
?\it
并且\bf
已经被弃用了四分之一世纪\renewcommand\d{...}
非常危险,不要这样做;我建议\dd
接下来,根据软件包的功能对它们进行分组。通过移动软件包,可以更轻松地检查重复项,甚至可能解决一些小的不兼容性问题。
保留一个部分用于常规设置,例如定义稍后要使用的页面样式。
将特定于文档的新命令放在专用部分中。
最后一部分用于文档特定设置,例如行距\parskip
等。顺便说一句,非零\parskip
与\doublespacing
将产生非常宽白色条纹。
\documentclass[11pt,twoside]{book}
%%% Packages
% 1. fonts
\usepackage[T1]{fontenc} % recommended
%\usepackage[utf8]{inputenc} % no longer needed
\usepackage{fix-cm} % for Computer Modern (comment if using the next line)
%\usepackage{newpxtext,newpxmath} % for Palatino
%\usepackage{upgreek} % do you need it?
%\usepackage{charter} % it has no support for math
%\usepackage{relsize} % do you need it?
% 2. Math
\usepackage{stmaryrd}
\usepackage{mathrsfs}
\usepackage{amsmath}
%\usepackage{amsfonts} % loaded by amssymb
\usepackage{amssymb}
\usepackage{mathtools}
\usepackage{bm}% bold math
% 3. Graphics and special effects
\usepackage{graphicx}
\usepackage{tikz}
\usepackage{tikz-cd}
\usepackage{shadow}% do you need it?
\usepackage{fancybox}% do you need it?
\usepackage{scalerel,stackengine}
\usepackage{eso-pic}
% 4. Document formatting
\usepackage{setspace}
\usepackage{fancyhdr}
\usepackage{appendix}
\usepackage[nottoc]{tocbibind}
\usepackage{alltt}
\usepackage{amsthm}
% 5. Utilities
\usepackage{makeidx}
\usepackage{aliascnt}
\usepackage{multicol}
\usepackage{dcolumn}% Align table columns on decimal point
% 6. Cross references and hyperlinks
\usepackage{hyperref}
%%% General settings
% 1. fancyhdr
\renewcommand{\headrulewidth}{.1pt}
\fancyhf{} % clear all fields
\fancyhead[LE,RO]{\thepage}
\fancyhead[RE]{\nouppercase{\leftmark}}
\fancyhead[LO]{\nouppercase{\rightmark}}
% 2. stackengine
\stackMath
% 3. hyperref
\hypersetup{
%bookmarks=true, % show bookmarks bar?
unicode=false, % non-Latin characters in Acrobat�s bookmarks
pdftoolbar=true, % show Acrobat�s toolbar?
pdfmenubar=true, % show Acrobat�s menu?
pdffitwindow=false, % window fit to page when opened
pdfstartview={FitH}, % fits the width of the page to the window
pdftitle={My title}, % title
pdfauthor={Author}, % author
pdfsubject={Subject}, % subject of the document
pdfcreator={Creator}, % creator of the document
pdfproducer={Producer}, % producer of the document
pdfkeywords={keywords}, % list of keywords
pdfnewwindow=true, % links in new window
colorlinks=true, % false: boxed links; true: colored links
linkcolor=blue, % color of internal links
citecolor=blue, % color of links to bibliography
filecolor=magenta, % color of file links
urlcolor=green % color of external links
}
%%% Personal commands
\newcommand*\chancery{\fontfamily{pzc}\selectfont}
\newcommand\reallywidehat[1]{%
\savestack{\tmpbox}{\stretchto{%
\scaleto{%
\scalerel*[\widthof{\ensuremath{#1}}]{\kern-.6pt\bigwedge\kern-.6pt}%
{\rule[-\textheight/2]{1ex}{\textheight}}%WIDTH-LIMITED BIG WEDGE
}{\textheight}%
}{0.5ex}}%
\stackon[1pt]{#1}{\tmpbox}%
}
\theoremstyle{definition}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{remark}[theorem]{Remark}
\newcommand{\mainidx}[1]{\textit{#1}}
\newcommand{\boldidx}[1]{\textbf{#1}}
\DeclareMathOperator*{\esssup}{ess\,sup}
\DeclareMathOperator{\tr}{Tr}
\makeatletter
\newcommand{\doublewidetilde}[1]{{%
\mathpalette\double@widetilde{#1}%
}}
\newcommand{\double@widetilde}[2]{%
\sbox\z@{$\m@th#1\widetilde{#2}$}%
\ht\z@=.9\ht\z@
\widetilde{\box\z@}%
}
\makeatother
\newcommand{\mc}{\mathcal}
\newcommand{\mf}{\mathfrak}
\newcommand{\mb}{\mathbb}
\newcommand{\xra}{\xrightarrow}
\newcommand{\ra}{\rightarrow}
\newcommand{\rra}{\rightrightarrows}
\newcommand{\dd}{\mathop{}\!\mathrm{d}}
\newcommand {\apgt} {\ {\raise-.5ex\hbox{$\buildrel>\over\sim$}}\ }
\newcommand {\aplt} {\ {\raise-.5ex\hbox{$\buildrel<\over\sim$}}\ }
\newcommand\listofsymbols{\input{symbols} \cleardoublepage}
\newcommand{\addsymbol}{}% for safety
\def\addsymbol #1: #2#3{$#1$ \> \parbox{5in}{#2 \dotfill \pageref{#3}}\\}
\newcommand\newnot[1]{\label{#1}}
\makeatletter
\newcommand\myfnt{\ifx\protect\@typeset@protect\expandafter\footnote\else\expandafter\@gobble\fi}
\makeatother
%%% Last minute settings
\pagestyle{fancy}
\makeindex
%\authorindex
\doublespacing
\linespread{1.1}
\clubpenalty=10000
\widowpenalty=10000
\allowdisplaybreaks
\setlength{\parskip}{1ex plus 0.5ex minus 0.1ex}
\counterwithin{equation}{section}
\setcounter{secnumdepth}{3} % organisational level that receives a numbers
%\date{\today}
\begin{document}
\pagenumbering{roman}
\include{Title}
\cleardoublepage
\pagenumbering{arabic}
\tableofcontents
\include{Preliminaries}
\include{chapter2}
\include{chapter3}
\include{chapter4}
\include{chapter5}
\include{chapter6}
\chapter*{Publications arising out of the PhD
thesis\hfill} \addcontentsline{toc}{chapter}{Publications arising
out of the PhD thesis}
\begin{enumerate}
\item [{[1]}]
\end{enumerate}
\bibliography{references}
\bibliographystyle{plain}
\cleardoublepage
\singlespacing
\printindex %\printauthorindex
\end{document}
答案2
下面,让我尝试解答一下您的问题的实质。
不要多次加载包。这绝对不会带来任何好处。确保任何包只加载一次应该相当容易实现,对吧?
不要同时加载
color
和xcolor
,或者同时加载graphics
和graphicx
。提示:使用xcolor
和graphicx
。不要定义比你真正需要更多的类似定理的环境。
过时和弃用的软件包:需要更多的经验才能确定哪些软件包属于这一组。首先不是加载
subfigure
和epsfig
。您还加载了几个文本字体包,这些字体包的代码稍后在加载其他字体包时会被破坏。例如,您试图通过加载、和来实现palatino
什么charter
目的type1cm
?你的文件的序言是混乱部分原因是似乎没有按主题或目的对命令进行分组。建议:加载包后,立即执行您认为必要的包中的指令。例如,加载后,
fancyhdr
不要再加载其他包,然后运行\pagestyle{fancy}
,然后运行\makeidx
,然后(重新)定义fancy
页面参数。应用一些分组真的那么难吗?如果其他包已自动加载,则不要手动加载它们。例如,
amsfonts
由 加载amssymb
,amsmath
由 加载mathtools
,等等。有些包,尤其
hyperref
是这个包,加载得太早了。一个很好的经验法则是加载hyperref
最后的。你真的设置了pdftitle={My title}
、pdfproducer={Producer}
等吗?换句话说,你为什么不输入真实信息。代码要么是多余的,要么是糟糕的。由于您使用了
book
document 类,因此我看不出执行\pagenumbering{roman}
在序言中。相反,您应该在文档主要部分开始\frontmatter
后立即执行,您猜对\begin{document}
了。这样也可以免去键入和的麻烦。我也不明白大量和指令的目的。\mainmatter
\pagenumbering{arabic}
\setcounter{page}{1}
\clearpage
\newpage
绝对不需要的代码。(我猜这会让它变得“超级冗余”,对吧?)我无法完全判断这一点,因为我不了解文档的内容。我会一次循环检查每个包:不要加载包并重新编译文档两次。如果文档编译正常,则不需要该特定包。
如果您设法完成所有这些步骤,您的文档也可能会更加精简。
答案3
\documentclass[11pt,twoside]{book}
\usepackage{a4wide}
\usepackage{fancyhdr}
\usepackage{float,subfigure,shadow,fancybox,appendix}
\usepackage{stmaryrd}
\usepackage[nottoc]{tocbibind}
\usepackage{makeidx}
\pagestyle{fancy} \makeindex %\authorindex
\renewcommand{\headrulewidth}{.1pt}
\fancyhead[LE,RO]{{\thepage}}
\fancyhead[RE]{\nouppercase{{\leftmark}}}
\fancyhead[LO]{\nouppercase{{\rightmark}}} \fancyfoot{}
\def\baselinestretch{1.1}
\date{\today}
\clubpenalty=10000 \widowpenalty=10000
\newcommand*\chancery{\fontfamily{pzc}\selectfont}
\usepackage{dcolumn}% Align table columns on decimal point
\usepackage{bm}% bold math
\usepackage{hyperref}
\usepackage{upgreek}
\usepackage[utf8]{inputenc}
\usepackage{mathrsfs}
\usepackage{alltt}
\usepackage{tikz-cd}
\usepackage{aliascnt}
\usepackage{tikz}
\usepackage{mathtools}
\usepackage{multicol}
\usepackage{relsize}
\usepackage{amssymb,amsthm,graphicx,amsxtra, setspace}
\usepackage{eso-pic}
\allowdisplaybreaks
\usepackage{scalerel,stackengine}
\stackMath
\newcommand\reallywidehat[1]{%
\savestack{\tmpbox}{\stretchto{%
\scaleto{%
\scalerel*[\widthof{\ensuremath{#1}}]{\kern-.6pt\bigwedge\kern-.6pt}%
{\rule[-\textheight/2]{1ex}{\textheight}}%WIDTH-LIMITED BIG WEDGE
}{\textheight}%
}{0.5ex}}%
\stackon[1pt]{#1}{\tmpbox}%
}
\parskip 1ex
\theoremstyle{definition}
\newtheorem{theorem}{Theorem}[section]
\newtheorem{lemma}[theorem]{Lemma}
\newtheorem{proposition}[theorem]{Proposition}
\newtheorem{corollary}[theorem]{Corollary}
\newtheorem{definition}[theorem]{Definition}
\newtheorem{example}[theorem]{Example}
\newtheorem{remark}[theorem]{Remark}
\renewcommand{\theequation}{\arabic{section}.\arabic{equation}}
\newcommand{\mainidx}[1]{{\it #1}}
\newcommand{\boldidx}[1]{{\bf #1}}
\DeclareMathOperator*{\esssup}{ess\,sup}
\DeclareMathOperator{\tr}{Tr}
\makeatletter
\newcommand{\doublewidetilde}[1]{{%
\mathpalette\double@widetilde{#1}%
}}
\newcommand{\double@widetilde}[2]{%
\sbox\z@{$\m@th#1\widetilde{#2}$}%
\ht\z@=.9\ht\z@
\widetilde{\box\z@}%
}
\makeatother
\newcommand{\mc}{\mathcal}
\newcommand{\mf}{\mathfrak}
\newcommand{\mb}{\mathbb}
\newcommand{\xra}{\xrightarrow}
\newcommand{\ra}{\rightarrow}
\newcommand{\rra}{\rightrightarrows}
\renewcommand{\d}{\/\mathrm{d}\/}
\renewcommand{\thefootnote}{\arabic{footnote}}
\def\listofsymbols{\input{symbols} \cleardoublepage}
\def\addsymbol #1: #2#3{$#1$ \> \parbox{5in}{#2 \dotfill \pageref{#3}}\\}
\def\newnot#1{\label{#1}}
\hypersetup{
%bookmarks=true, % show bookmarks bar?
unicode=false, % non-Latin characters in Acrobat�s bookmarks
pdftoolbar=true, % show Acrobat�s toolbar?
pdfmenubar=true, % show Acrobat�s menu?
pdffitwindow=false, % window fit to page when opened
pdfstartview={FitH}, % fits the width of the page to the window
pdftitle={My title}, % title
pdfauthor={Author}, % author
pdfsubject={Subject}, % subject of the document
pdfcreator={Creator}, % creator of the document
pdfproducer={Producer}, % producer of the document
pdfkeywords={keywords}, % list of keywords
pdfnewwindow=true, % links in new window
colorlinks=true, % false: boxed links; true: colored links
linkcolor=blue, % color of internal links
citecolor=blue, % color of links to bibliography
filecolor=magenta, % color of file links
urlcolor=green % color of external links
}
\newcommand {\apgt} {\ {\raise-.5ex\hbox{$\buildrel>\over\sim$}}\ }
\newcommand {\aplt} {\ {\raise-.5ex\hbox{$\buildrel<\over\sim$}}\ }
\makeatletter
\def\myfnt{\ifx\protect\@typeset@protect\expandafter\footnote\else\expandafter\@gobble\fi}
\makeatother
\begin{document}
\frontmatter
\doublespace
\include{Title}
\newpage
\thispagestyle{empty} \cleardoublepage
\setcounter{secnumdepth}{3} % organisational level that receives a numbers
\tableofcontents
\mainmatter
\newpage
\newpage
\thispagestyle{empty}
\include{Preliminaries}
\include{chapter2}
\include{chapter3}
\include{chapter4}
\include{chapter5}
\include{chapter6}
%The style you want to use for references.
\newpage
\thispagestyle{plain}\chapter*{Publications arising out of the PhD
thesis\hfill} \addcontentsline{toc}{chapter}{Publications arising
out of the PhD thesis}
\begin{enumerate}
\item [{[1]}]
\end{enumerate}
\clearpage
\newpage
\thispagestyle{empty}
\bigskip{}
\vspace{1cm} \cleardoublepage
\bibliography{references}
\bibliographystyle{plain}
\singlespace
\printindex %\printauthorindex
\end{document}
这是我按照 Mico 的建议操作后最终得到的代码。