0

I am currently writing a latex document using the document class amsart, but I was told it was better to use another document class for my thesis. I therefore tried the report document class, but I got many error-messages. I tried to delete much of the text I had written above the start of the document (\newtheorem \newcommand and so forth), but it still doesn't run. Does anyone have any tips for how to change from amsart document class to report class (or some other document class which a thesis could be written in)? I am using pdflatex.

This is what I have written before the introduction:

    \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

This is the first error message I get:

  { ! LaTeX Error: \tocsection undefined.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...                                              

l.150     \renewcommand{\tocsection}
                                    [3]{%
? }
  • As a first start, after your \documentclass line, add \usepackage{amsmath,amsthm,amsfonts} and see if that works. (And don't change anything else). – Alan Munn Jun 5 '17 at 16:10
  • Thank you for your comment! I tried adding that, but I got the same error-message. – David Jun 5 '17 at 16:12
  • Take a look at the amsart documentation and look for commands that it defines, then comment out those lines in your file. There's a list in Table 1 of the docs. The class also defines \specialsection so if you've used that, it will also give an error. – Alan Munn Jun 5 '17 at 16:20
  • if you want help with an error message it is best if you show the error message, show the full message from the log file from ! to ? use {} in this site's editor to mark it as a code block so line endings are preserved. – David Carlisle Jun 5 '17 at 16:50
  • I have updated the question in order to try to include what you mentioned. – David Jun 5 '17 at 17:50
3

Your preamble is rather strange but this runs without error (with a warning about duplicated destinations but that will probably resolve itself once you have more text) I added comments where I changed your input

   \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}
  • Thank you for your detailed answer! It worked fine in my whole document when I deleted the lines including {tocline}. – David Jun 6 '17 at 13:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.