我目前正在使用文档类编写乳胶文档amsart
,但有人告诉我,最好为我的论文使用另一个文档类。因此,我尝试了文档report
类,但收到许多错误消息。我试图删除我在文档开头写的大部分文本(\newtheorem
\newcommand
等等),但它仍然无法运行。有人能提供一些关于如何从amsart
文档类更改为其他report
类(或可以编写论文的其他文档类)的提示吗?我正在使用pdflatex
。
这是我在介绍之前写的:
\documentclass[reqno]{report}
\usepackage{amsmath,amsthm,amsfonts}
\usepackage[utf8]{inputenc}
\usepackage[table]{xcolor}
\usepackage{amsmath} % for \text macro
\usepackage{amssymb} % for \mathbb macro
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{bm}
\usepackage{mathcomp}
\usepackage{epstopdf}
\usepackage[table]{xcolor}
\usepackage{pdfpages}
\usepackage{amsmath,esint}
\usepackage{lipsum}
\usepackage[T1]{fontenc}
\usepackage{color}
\usepackage[colorlinks]{hyperref}
\usepackage{tensor}
\usepackage{graphicx}
\usepackage{atbegshi}
\usepackage{esvect}
\usepackage{listings}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx}
\usepackage{float}
\usepackage{minitoc}
\usepackage{booktabs}
\usepackage{colortbl}
\usepackage[utf8]{inputenc}
\usepackage{apacite}
\usepackage{nomencl}
\graphicspath{ latex }
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{esdiff}
\newcommand{\vhtable}{\rule{30pt}{30pt}}
\newcommand{\eps}{\varepsilon}
\newcommand{\bU}{\mathbf{U}}
\newcommand{\bH}{\mathbf{H}}
\newcommand{\uvec}[1]{\boldsymbol{\hat{\textbf{#1}}}}
\newcommand{\sgn}{\text{sgn}}
\newcommand{\pw}{p^w}
\newcommand{\epsw}{\varepsilon^w}
\def\R{\mathbb{R}}
\def\N{\mathbb{N}}
\newcommand{\ud}{u^{\delta}}
\newcommand{\vect}[1]{\boldsymbol{#1}}
\newcommand{\md}{m^{\delta}}
\newcommand{\nd}{n^{\delta}}
\newcommand{\psid}{\psi_{\delta}}
\newcommand{\cde}{c^{\delta}}
\newcommand*\VF[1]{\mathbf{#1}}
\newcommand*\dif{\mathop{}\!\mathrm{d}}
\newcommand{\mde}{m^{\delta}}
\newcommand{\nde}{n^{\delta}}
\newcommand{\ude}{u^{\delta}}
\newcommand\MyTabHeadings{%
\rowcolor{Tab}\rowstyle{\bfseries\color{white}}}
\newcommand{\mT}{\widetilde{m}}
\renewcommand{\arraystretch}{2}
\newtheorem{deff}{Definition}[section]
\newtheorem{thm}{Theorem}[section]
\newtheorem{remark}{Remark}[section]
\newtheorem{lem}{Lemma}[section]
\newtheorem{prop}{Proposition}[section]
\newtheorem{cor}{Corollary}[section]
\AtBeginDocument{\AtBeginShipoutNext{\AtBeginShipoutDiscard}}
\makeatletter
\newcommand*{\@rowstyle}{}
\newcommand*{\rowstyle}[1]{% sets the style of the next row
\gdef\@rowstyle{#1}%
\@rowstyle\ignorespaces%
}
\newcolumntype{=}{% resets the row style
>{\gdef\@rowstyle{}}%
}
\newcolumntype{+}{% adds the current row style to the next column
>{\@rowstyle}%
}
\makeatletter
\AtBeginDocument{%
\let\nl@org@contentsline\contentsline
\def\contentsline#1{%
\def\nl@current@levelname{#1}%
\nl@org@contentsline{#1}%
}%
}
\protected\def\numberline#1{%
\begingroup
\edef\nl@align{%
nl@align@%
\@ifundefined{nl@current@levelname}{}{\nl@current@levelname}%
}%
\edef\nl@align{%
\@ifundefined{\nl@align}\nl@align@{\csname\nl@align\endcsname}%
}%
\@ifundefined{nl@numberline@\nl@align}{%
\errmessage{Unknown alignment '\nl@align' for \noexpand\numberline}%
\nl@numberline@l{#1}%
}{%
\csname nl@numberline@\nl@align\endcsname{#1}%
}%
\endgroup
}
% Implementations of `\numberline` for the different horizontal alignments
\newcommand*{\nl@numberline@l}[1]{% left-aligned
\hb@xt@\@tempdima{#1 \hfil}%
}
\newcommand*{\nl@numberline@c}[1]{% centered
\hb@xt@\@tempdima{\hfil#1 \hfil}%
}
\newcommand*{\nl@numberline@r}[1]{% right-aligned
\hb@xt@\@tempdima{\hfil#1 }%
}
\def\nl@align@{l}% default
\def\nl@align@section{r}
\makeatletter
\def\l@subsection{\@tocline{1}{0,2pt}{6pc}{8mm}{\ \ }}
\makeatother
\makeatletter
\def\l@section{\@tocline{1}{0.2pt}{2pc}{8mm}{\ \ }}
\definecolor{lightgray}{gray}{0.9}
\makenomenclature
\makeglossary
\makeatletter
%Table of Contents
\setcounter{tocdepth}{3}
% Add bold to \section titles in ToC and remove . after numbers
\renewcommand{\tocsection}[3]{%
\indentlabel{\@ifnotempty{#2}{\bfseries\ignorespaces#1 #2\quad}}\bfseries#3}
% Remove . after numbers in \subsection
\renewcommand{\tocsubsection}[3]{%
\indentlabel{\@ifnotempty{#2}{\ignorespaces#1 #2\quad}}#3}
%\let\tocsubsubsection\tocsubsection% Update for \subsubsection
%...
\newcommand\@dotsep{4.5}
\def\@tocline#1#2#3#4#5#6#7{\relax
\ifnum #1>\c@tocdepth % then omit
\else
\par \addpenalty\@secpenalty\addvspace{#2}%
\begingroup \hyphenpenalty\@M
\@ifempty{#4}{%
\@tempdima\csname r@tocindent\number#1\endcsname\relax
}{%
\@tempdima#4\relax
}%
\parindent\z@ \leftskip#3\relax \advance\leftskip\@tempdima\relax
\rightskip\@pnumwidth plus1em \parfillskip-\@pnumwidth
#5\leavevmode\hskip-\@tempdima{#6}\nobreak
\leaders\hbox{$\m@th\mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}\hfill
\nobreak
\hbox to\@pnumwidth{\@tocpagenum{\ifnum#1=1\bfseries\fi#7}}\par% <-- \bfseries for \section page
\nobreak
\endgroup
\fi}
\AtBeginDocument{%
\expandafter\renewcommand\csname r@tocindent0\endcsname{0pt}
}
\makeatother
\def\l@subsection{\@tocline{2}{0pt}{2.5pc}{5pc}{}}
\makeatother
\begin{document}
\begin{titlepage}
\title{}
\author{}
\maketitle
\end{titlepage}
\begin{abstract}
\normalsize
\newpage
{
\hypersetup{linkcolor=black}
\tableofcontents
}
\makeatletter
\let\toc@pre\relax
\let\toc@post\relax
\makeatother
这是我收到的第一条错误消息:
{ ! LaTeX Error: \tocsection undefined.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.150 \renewcommand{\tocsection}
[3]{%
? }
答案1
你的序言很奇怪,但运行起来没有错误(有一个关于重复目的地的警告,但一旦你有更多文本,这个问题可能会自行解决)我在修改你的输入的地方添加了评论
\documentclass[reqno]{report}
\usepackage{amsmath,amsthm,amsfonts}
\usepackage[utf8]{inputenc}
\usepackage[table]{xcolor}
% don't need this twice \usepackage{amsmath} % for \text macro
\usepackage{amssymb} % for \mathbb macro
\usepackage{multirow}
\usepackage{graphicx}
\usepackage{bm}
\usepackage{mathcomp}
% don't need this \usepackage{epstopdf}
\usepackage[table]{xcolor}
\usepackage{pdfpages}
\usepackage{amsmath,esint}
% don't need this \usepackage{lipsum}
\usepackage[T1]{fontenc}
% don't need this\usepackage{color}
\usepackage[colorlinks]{hyperref}
\usepackage{tensor}
% don't need this twice \usepackage{graphicx}
\usepackage{atbegshi}
\usepackage{esvect}
\usepackage{listings}
\usepackage[margin=1in]{geometry}
% don't need this three times \usepackage{graphicx}
\usepackage{float}
\usepackage{minitoc}
\usepackage{booktabs}
% don't need this aready loaded by ccolor\usepackage{colortbl}
% don't need this twice \usepackage[utf8]{inputenc}
\usepackage{apacite}
\usepackage{nomencl}
% no \graphicspath{ latex } or \graphicspath{ {latex} }
% don't need this, certainly no point in it being here
% \NeedsTeXFormat{LaTeX2e}
% No!\ProvidesPackage{esdiff}
\newcommand{\vhtable}{\rule{30pt}{30pt}}
\newcommand{\eps}{\varepsilon}
\newcommand{\bU}{\mathbf{U}}
\newcommand{\bH}{\mathbf{H}}
\newcommand{\uvec}[1]{\boldsymbol{\hat{\textbf{#1}}}}
\newcommand{\sgn}{\text{sgn}}
\newcommand{\pw}{p^w}
\newcommand{\epsw}{\varepsilon^w}
\def\R{\mathbb{R}}
\def\N{\mathbb{N}}
\newcommand{\ud}{u^{\delta}}
\newcommand{\vect}[1]{\boldsymbol{#1}}
\newcommand{\md}{m^{\delta}}
\newcommand{\nd}{n^{\delta}}
\newcommand{\psid}{\psi_{\delta}}
\newcommand{\cde}{c^{\delta}}
\newcommand*\VF[1]{\mathbf{#1}}
\newcommand*\dif{\mathop{}\!\mathrm{d}}
\newcommand{\mde}{m^{\delta}}% same as \md ?
\newcommand{\nde}{n^{\delta}}% same as \nd ?
\newcommand{\ude}{u^{\delta}}% same as \ud ?
\newcommand\MyTabHeadings{%
\rowcolor{Tab}\rowstyle{\bfseries\color{white}}}
\newcommand{\mT}{\widetilde{m}}
\renewcommand{\arraystretch}{2}
\newtheorem{deff}{Definition}[section]
\newtheorem{thm}{Theorem}[section]
\newtheorem{remark}{Remark}[section]
\newtheorem{lem}{Lemma}[section]
\newtheorem{prop}{Proposition}[section]
\newtheorem{cor}{Corollary}[section]
\AtBeginDocument{\AtBeginShipoutNext{\AtBeginShipoutDiscard}}
\makeatletter
\newcommand*{\@rowstyle}{}
\newcommand*{\rowstyle}[1]{% sets the style of the next row
\gdef\@rowstyle{#1}%
\@rowstyle\ignorespaces%
}
\newcolumntype{=}{% resets the row style
>{\gdef\@rowstyle{}}%
}
\newcolumntype{+}{% adds the current row style to the next column
>{\@rowstyle}%
}
\makeatletter
\AtBeginDocument{%
\let\nl@org@contentsline\contentsline
\def\contentsline#1{%
\def\nl@current@levelname{#1}%
\nl@org@contentsline{#1}%
}%
}
\protected\def\numberline#1{%
\begingroup
\edef\nl@align{%
nl@align@%
\@ifundefined{nl@current@levelname}{}{\nl@current@levelname}%
}%
\edef\nl@align{%
\@ifundefined{\nl@align}\nl@align@{\csname\nl@align\endcsname}%
}%
\@ifundefined{nl@numberline@\nl@align}{%
\errmessage{Unknown alignment '\nl@align' for \noexpand\numberline}%
\nl@numberline@l{#1}%
}{%
\csname nl@numberline@\nl@align\endcsname{#1}%
}%
\endgroup
}
% Implementations of `\numberline` for the different horizontal alignments
\newcommand*{\nl@numberline@l}[1]{% left-aligned
\hb@xt@\@tempdima{#1 \hfil}%
}
\newcommand*{\nl@numberline@c}[1]{% centered
\hb@xt@\@tempdima{\hfil#1 \hfil}%
}
\newcommand*{\nl@numberline@r}[1]{% right-aligned
\hb@xt@\@tempdima{\hfil#1 }%
}
\def\nl@align@{l}% default
\def\nl@align@section{r}
\makeatletter
\def\l@subsection{\@tocline{1}{0,2pt}{6pc}{8mm}{\ \ }}
\makeatother
\makeatletter
\def\l@section{\@tocline{1}{0.2pt}{2pc}{8mm}{\ \ }}
\definecolor{lightgray}{gray}{0.9}
\makenomenclature
\makeglossary
\makeatletter
%Table of Contents
\setcounter{tocdepth}{3}
% Add bold to \section titles in ToC and remove . after numbers
% just don't define this or use new not renew
%\renewcommand{\tocsection}[3]{%
% \indentlabel{\@ifnotempty{#2}{\bfseries\ignorespaces#1 #2\quad}}\bfseries#3}
% Remove . after numbers in \subsection
%\renewcommand{\tocsubsection}[3]{%
% \indentlabel{\@ifnotempty{#2}{\ignorespaces#1 #2\quad}}#3}
%\let\tocsubsubsection\tocsubsection% Update for \subsubsection
%...
%\newcommand\@dotsep{4.5}
\def\@tocline#1#2#3#4#5#6#7{\relax
\ifnum #1>\c@tocdepth % then omit
\else
\par \addpenalty\@secpenalty\addvspace{#2}%
\begingroup \hyphenpenalty\@M
\@ifempty{#4}{%
\@tempdima\csname r@tocindent\number#1\endcsname\relax
}{%
\@tempdima#4\relax
}%
\parindent\z@ \leftskip#3\relax \advance\leftskip\@tempdima\relax
\rightskip\@pnumwidth plus1em \parfillskip-\@pnumwidth
#5\leavevmode\hskip-\@tempdima{#6}\nobreak
\leaders\hbox{$\m@th\mkern \@dotsep mu\hbox{.}\mkern \@dotsep mu$}\hfill
\nobreak
\hbox to\@pnumwidth{\@tocpagenum{\ifnum#1=1\bfseries\fi#7}}\par% <-- \bfseries for \section page
\nobreak
\endgroup
\fi}
%%% new not renew
\AtBeginDocument{%
\expandafter\newcommand\csname r@tocindent0\endcsname{0pt}
}
\makeatother
\def\l@subsection{\@tocline{2}{0pt}{2.5pc}{5pc}{}}
\makeatother
\begin{document}
\begin{titlepage}
\title{}
\author{}
\maketitle
zzz
\end{titlepage}
\begin{abstract}
\normalsize
zzz
%%missing
\end{abstract}
\newpage
{
\hypersetup{linkcolor=black}
\tableofcontents
\clearpage
}
\makeatletter
\let\toc@pre\relax
\let\toc@post\relax
\makeatother
zzz
\end{document}