0

I am writing a report in latex and i need to use cuthesis library (found at http://www.nmai.ca/resources). I don't know why when I add mathtools library, lots of errors are generated. Can you please help me fix this error? One of the errors: Undefined control sequence\@calc@post@scan ...st@scan \else \def \calc@next{\calc@error #1}\fi \fi \f...\newtheorem{thy}{Theorem}[chapter]

Here is the code

\documentclass{report}
\usepackage[phd,4committee,nonsequential]{cuthesis}
\usepackage{mathtools}  
\usepackage{amssymb, amsbsy, amsthm, eqnarray}             % Mathematical symbols by AMS-LaTeX
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}    % see http://ctan.org/pkg/xcolor
\usepackage{setspace,etoolbox,titlesec,sectsty}



%-------------------------------------------------------------------------------------------------------------------------------------------
% Define some colors
%-------------------------------------------------------------------------------------------------------------------------------------------
\definecolor{cadmiumred}{rgb}{0.89, 0.0, 0.13}
\definecolor{darkBlue}{rgb}{0,0,.6}
\definecolor{darkRed}{rgb}{.7,0,0}

%-------------------------------------------------------------------------------------------------------------------------------------------
% Set the counter
%-------------------------------------------------------------------------------------------------------------------------------------------
\setlength\parindent{0pt}
\setcounter{tocdepth}{5}
\setcounter{secnumdepth}{3}  % Displying the section/subsection number
\interfootnotelinepenalty=10000

%-------------------------------------------------------------------------------------------------------------------------------------------
% Define Chapters and Section Headers font, Color and Shape
%-------------------------------------------------------------------------------------------------------------------------------------------
\newcommand{\colbox}{\colorbox[rgb]{1,0.41,0.13}}
\sectionfont{\color{orange}}                 % sets colour of sections
\subsectionfont{\color{RoyalBlue}}           % sets colour of subsections
\subsubsectionfont{\color{ForestGreen}}      % sets colour of subsubsections
\titleformat{\chapter}[display]{\normalfont\huge\bfseries\color{darkBlue}}{\chaptertitlename\ \thechapter}{2pt}{\Huge} 
\titlespacing{\chapter}{0pt}{1pt}{1pt} 
\titlespacing{\section}{0pt}{2pt}{4pt}
\titlespacing{\subsection}{0pt}{2pt}{4pt}
\makeatletter % changes the catcode/category code of @ to 11
\renewcommand{\@seccntformat}[1]{\csname the#1\endcsname)\;} % Add bracket after section # and small space by\;
\makeatother % changes the catcode/category code of @ back to 12

%-------------------------------------------------------------------------------------------------------------------------------------------
% Define the some styles
%-------------------------------------------------------------------------------------------------------------------------------------------
\newtheoremstyle{exstyle}                % name
  {3pt}                                          % Space above
  {3pt}                                          % Space below
  {}                                             % Body font
  {}                                             % Indent amount (empty = no indent, \parindent = para indent)
  {\normalfont\color{cadmiumred}}% Thm head font
  {:}                                            % Punctuation after thm head
  %{.5em}                                        % Space after thm head: " " = normal interword space;
  {\newline}                                     %\newline = linebreak
  {\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}} %Thm head spec (can be left empty, meaning 'normal')

\theoremstyle{exstyle}
%\newtheorem{mydef}{Definition}[chapter]
%\newtheorem{ex}{Example}[chapter]

\newtheoremstyle{mytheoremstyle}  % name
        {\topsep}                     % Space above
        {\topsep}                     % Space below
        {\slshape\selectfont}         % Body font
        {}                            % Indent amount
        {\bfseries\color{cadmiumred}} % Theorem head font {\bfseries\itshape\
        {:}                           % Punctuation after theorem head
        %{.5em}                       % Space after theorem head
        {\newline}                                    %\newline = linebreak
        {\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}} % Theorem head spec (can be left empty, meaning 'normal')

\theoremstyle{mytheoremstyle}
\newtheorem{thy}{Theorem}[chapter]   
\newtheorem{coly}{Corollary}[chapter] 
\newtheorem{lem}{Lemma}[chapter] 
\newtheorem{pro}{Proposition}[chapter] 
\newtheorem{Res}{Result}[chapter] 
\newtheorem{prop}{Property}[chapter] 
\newtheorem{remark}{Remark}[chapter] 
\newtheorem{note}{Note}[chapter]

\numberwithin{equation}{chapter}


\DeclarePairedDelimiterX{\innp}[2]{\langle}{\rangle}{#1, #2}              %\innp[\bigg]{x}{y}
\DeclarePairedDelimiterX\norm[1]\lVert\rVert{\ifblank{#1}{\:\cdot\:}{#1}} %\norm[\bigg]{x}

\begin{document}

\chapter{First Chapter}\label{ch1:1}
\section{First Section}\label{ch1:sec1}

This is the first section

\section{Second Section}\label{ch1:sec2}

This is the second section

\subsection{Sub Section}\label{ch1:ssec2}

\begin{itemize}
   \item $\innp{S-\mathbf{d}}{\mathbf{d}}_\mathbf{w} = 0$ i.e. $S-\mathbf{d}$ is orthogonal to $\mathbf{d}$, so we obtain 
            \[
                    S^T\mathbf{d}=(S^T+\mathbf{d}^T-\mathbf{d}^T) \mathbf{d}= \norm[\big]{\mathbf{d}}^2
            \]
\end{itemize}



\end{document}

When I comment out the code below, these errors disappear and i have no idea why this is.

\newtheorem{thy}{Theorem}[chapter]   
\newtheorem{coly}{Corollary}[chapter] 
\newtheorem{lem}{Lemma}[chapter] 
\newtheorem{pro}{Proposition}[chapter] 
\newtheorem{Res}{Result}[chapter] 
\newtheorem{prop}{Property}[chapter] 
\newtheorem{remark}{Remark}[chapter] 
\newtheorem{note}{Note}[chapter]

\numberwithin{equation}{chapter}

Your help is greatly appreciated.

9
  • Which error did you get, exactly? I don't have the cuthesis package, but without that I don't get any errors on Overleaf. – Torbjørn T. Oct 8 '18 at 19:56
  • Please provide the error message as @TorbjørnT. suggested. I downloaded cuthesis from nmai.ca/resources and minimized your example (only the packages cuthesis, etoolbox (for \ifblank) and mathtools, and the equation from your code) and that works without errors. – Marijn Oct 8 '18 at 20:07
  • @Marijin, I use TeXnicCenter to code in LaTeX and I got 35 errors one of them is ! Undefined Control sequence. \@calc@post@scan...st@scan \else \def \calc@next{\calc@error #1} \fi \fi \fi... 1.106 \newtheorem{mydef}{Definition}[chapter] – Olel Dias Oct 8 '18 at 20:31
  • 1
    @OlelDias please try to minimize the code yourself, by removing packages and document content until the error disappears. This will provide some clues on what causes the error. – Marijn Oct 8 '18 at 21:33
  • 1
    @OlelDias the example as posted is nothing like minimal. Think of people having to trace this to debug the issue, firstly you should give a link to the copy of cuthesis.cls you used, as it is not in the standard distributions and then you should remove every package not involved in the error. Do you really need to load massive packages such as tikz and tabu (which you don't appear to use) to show the error? – David Carlisle Oct 8 '18 at 22:55
2

If you remove bits of cuthesis.cls until the error goes away you find this is a more minimal example:

\documentclass{report}
\makeatletter



\newcounter{mychapcitecount}




\def\cl@chapter{%
  \setcounter{mychapcitecount}{0}%
  \@ifundefined{@nonsequential}{%
    \@elt{section}\@elt{footnote}%
  }{%
    \@elt{equation}\@elt{figure}\@elt{footnote}\@elt{section}\@elt{table}%
  }}


\makeatother



\usepackage{calc}
\usepackage{amsthm}             % Mathematical symbols by AMS-LaTeX

\usepackage{setspace,etoolbox,titlesec,sectsty}



%-------------------------------------------------------------------------------------------------------------------------------------------
% Define some colors
%-------------------------------------------------------------------------------------------------------------------------------------------
% Set the counter
%-------------------------------------------------------------------------------------------------------------------------------------------


\newtheorem{thy}{Theorem}[chapter]   


\begin{document}



\end{document}

So you can undo that package's definition of \cl@chapter and find this version of your example runs without error

\documentclass{report}
\makeatletter
\let\foo\cl@chapter
\usepackage[phd,4committee,nonsequential]{cuthesis}
\let\cl@chapter\foo
\makeatother

\usepackage{mathtools}  
\usepackage{amssymb, amsbsy, amsthm, eqnarray}             % Mathematical symbols by AMS-LaTeX
\usepackage[usenames,dvipsnames,svgnames,table]{xcolor}    % see http://ctan.org/pkg/xcolor
\usepackage{setspace,etoolbox,titlesec,sectsty}



%-------------------------------------------------------------------------------------------------------------------------------------------
% Define some colors
%-------------------------------------------------------------------------------------------------------------------------------------------
\definecolor{cadmiumred}{rgb}{0.89, 0.0, 0.13}
\definecolor{darkBlue}{rgb}{0,0,.6}
\definecolor{darkRed}{rgb}{.7,0,0}

%-------------------------------------------------------------------------------------------------------------------------------------------
% Set the counter
%-------------------------------------------------------------------------------------------------------------------------------------------
\setlength\parindent{0pt}
\setcounter{tocdepth}{5}
\setcounter{secnumdepth}{3}  % Displying the section/subsection number
\interfootnotelinepenalty=10000

%-------------------------------------------------------------------------------------------------------------------------------------------
% Define Chapters and Section Headers font, Color and Shape
%-------------------------------------------------------------------------------------------------------------------------------------------
\newcommand{\colbox}{\colorbox[rgb]{1,0.41,0.13}}
\sectionfont{\color{orange}}                 % sets colour of sections
\subsectionfont{\color{RoyalBlue}}           % sets colour of subsections
\subsubsectionfont{\color{ForestGreen}}      % sets colour of subsubsections
\titleformat{\chapter}[display]{\normalfont\huge\bfseries\color{darkBlue}}{\chaptertitlename\ \thechapter}{2pt}{\Huge} 
\titlespacing{\chapter}{0pt}{1pt}{1pt} 
\titlespacing{\section}{0pt}{2pt}{4pt}
\titlespacing{\subsection}{0pt}{2pt}{4pt}
\makeatletter % changes the catcode/category code of @ to 11
\renewcommand{\@seccntformat}[1]{\csname the#1\endcsname)\;} % Add bracket after section # and small space by\;
\makeatother % changes the catcode/category code of @ back to 12

%-------------------------------------------------------------------------------------------------------------------------------------------
% Define the some styles
%-------------------------------------------------------------------------------------------------------------------------------------------
\newtheoremstyle{exstyle}                % name
  {3pt}                                          % Space above
  {3pt}                                          % Space below
  {}                                             % Body font
  {}                                             % Indent amount (empty = no indent, \parindent = para indent)
  {\normalfont\color{cadmiumred}}% Thm head font
  {:}                                            % Punctuation after thm head
  %{.5em}                                        % Space after thm head: " " = normal interword space;
  {\newline}                                     %\newline = linebreak
  {\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}} %Thm head spec (can be left empty, meaning 'normal')

\theoremstyle{exstyle}
%\newtheorem{mydef}{Definition}[chapter]
%\newtheorem{ex}{Example}[chapter]

\newtheoremstyle{mytheoremstyle}  % name
        {\topsep}                     % Space above
        {\topsep}                     % Space below
        {\slshape\selectfont}         % Body font
        {}                            % Indent amount
        {\bfseries\color{cadmiumred}} % Theorem head font {\bfseries\itshape\
        {:}                           % Punctuation after theorem head
        %{.5em}                       % Space after theorem head
        {\newline}                                    %\newline = linebreak
        {\thmname{#1}\thmnumber{ #2}\thmnote{ (#3)}} % Theorem head spec (can be left empty, meaning 'normal')

\theoremstyle{mytheoremstyle}
\newtheorem{thy}{Theorem}[chapter]   
\newtheorem{coly}{Corollary}[chapter] 
\newtheorem{lem}{Lemma}[chapter] 
\newtheorem{pro}{Proposition}[chapter] 
\newtheorem{Res}{Result}[chapter] 
\newtheorem{prop}{Property}[chapter] 
\newtheorem{remark}{Remark}[chapter] 
\newtheorem{note}{Note}[chapter]

\numberwithin{equation}{chapter}


\DeclarePairedDelimiterX{\innp}[2]{\langle}{\rangle}{#1, #2}              %\innp[\bigg]{x}{y}
\DeclarePairedDelimiterX\norm[1]\lVert\rVert{\ifblank{#1}{\:\cdot\:}{#1}} %\norm[\bigg]{x}

\begin{document}

\chapter{First Chapter}\label{ch1:1}
\section{First Section}\label{ch1:sec1}

This is the first section

\section{Second Section}\label{ch1:sec2}

This is the second section

\subsection{Sub Section}\label{ch1:ssec2}

\begin{itemize}
   \item $\innp{S-\mathbf{d}}{\mathbf{d}}_\mathbf{w} = 0$ i.e. $S-\mathbf{d}$ is orthogonal to $\mathbf{d}$, so we obtain 
            \[
                    S^T\mathbf{d}=(S^T+\mathbf{d}^T-\mathbf{d}^T) \mathbf{d}= \norm[\big]{\mathbf{d}}^2
            \]
\end{itemize}



\end{document}

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.