[Solved] undefined control sequence when using addchap

kerdouj kardouj Asks: undefined control sequence when using addchap
When I compile my thesis.tex file which is compiled fine including the addchap, I noticed that I have used usepackage{unnumberedtotoc}. When I want to use my thesis.tex file on another computer it says tex capacity exceeded, sorry [input stack size=5000]. When I uncomment usepackage{unnumberedtotoc}, it says ! undefined control sequence addchap. Here I have pasted all the beginning of the packages that I have used in my thesis but I still get some problems in compilation, I don’t know why, but I think if I can compile this code, then I can solve the problem :

Code:
 immediatewrite18{makeindex jobname.nlo -s nomencl.ist -o jobname.nls}
documentclass[12pt]{report}
DeclareMathSizes{12}{30}{16}{12}
usepackage[utf8]{inputenc}
usepackage{graphicx}
usepackage{lineno}
usepackage{amsmath}
 usepackage{array, nccmath}
 usepackage[nottoc]{tocbibind}
newcolumntype{L}{>{$}l<{$}}
newcolumntype{m}{>{displaystyle}l}
usepackage{framed}
usepackage{cclicenses}
usepackage{makecell}
usepackage[french]{babel}
usepackage{setspace}
usepackage{mathptmx}
 usepackage{multirow}
 usepackage{gensymb}
 usepackage{empheq}
  usepackage{mathtools}
  usepackage{array}
  renewcommand{arraystretch}{1.9}
  newcolumntype{P}{>{centeringarraybackslash$}p{1.6em}<{$}}
  newcolumntype{C}{>{centeringarraybackslash$}c<{$}}
  usepackage{makecell}
  usepackage{booktabs}
  usepackage{subcaption}
  usepackage[intoc]{nomencl}
  makenomenclature
  setcounter{secnumdepth}{4}
  setcounter{tocdepth}{4}
  usepackage[justification=centering]{caption}
   usepackage{etoolbox}
    usepackage{unnumberedtotoc} %https://github.com/johannesbottcher/unnumberedtotoc/
    usepackage[automark,
    plainheadsepline,
    headsepline,
    plainfootsepline,
     footsepline,
    markcase=ignoreupper]{scrlayer-scrpage}
   clearpairofpagestyles
   ihead*{leftmark}
   cfoot*{pagemark}
   setkomafont{pageheadfoot}{scshape}
   usepackage{titlesec}
   graphicspath{{imagesthesis/}}
   deffrenchlistfigurename{Liste des figures}
   usepackage[a4paper,right=20mm,left=25mm,top=26mm, bottom=26mm]{geometry}
   makeatletter
   titleformat{chapter}[display]
   {normalfonthugebfseries}{chaptertitlename thechapter}{20pt}{Huge}
   % this alters "before" spacing (the second length argument) to 0
   titlespacing*{chapter}{0pt}{0pt}{20pt}
   %patchcmd{@makechapterhead}{vspace*{20p@}}{}{}{}% Removes space above chapter head
   %patchcmd{@makeschapterhead}{vspace*{20p@}}{}{}{}% Removes space above chapter* head
   makeatother
   title {itle of the thesis}
   titleformat{paragraph}
   {normalfontnormalsizebfseries}{theparagraph}{1em}{}
   titlespacing*{paragraph}
    {0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}



 usepackage[thin, , thinc]{esdiff}
 usepackage{subcaption}
 usepackage{caption}
 usepackage{framed}  
 usepackage{nomencl} 
 setlength{nomitemsep}{-parskip}usepackage{booktabs,multirow}
 renewcommand{cellset}{renewcommand{arraystretch}{0.5}}

 begin{document}
 renewcommandarraystretch{0.8}
%noindent
 doublespacing
 maketitle
 tableofcontents
%listoffigures
 addchap{Publications et communications}

 section*{$:$  a. Publications:}
 section*{$:$  b. Communications:}
 addchap{Remerciements}
 end{document}

Ten-tools.com may not be responsible for the answers or solutions given to any question asked by the users. All Answers or responses are user generated answers and we do not have proof of its validity or correctness. Please vote for the answer that helped you in order to help others find out which is the most helpful answer. Questions labeled as solved may be solved or may not be solved depending on the type of question and the date posted for some posts may be scheduled to be deleted periodically. Do not hesitate to share your response here to help other visitors like you. Thank you, Ten-tools.