# LaTeX Error: LaTeX Error: \tocsection undefined

I am working on a .docx to .pdf script that use pandoc and latex,

I got requested to use the following improvement:


\usepackage{etoolbox}
\makeatletter
\def\@textbottom{\vskip \z@ \@plus 7pt}
\let\@texttop\relax
%numéros des sections en gras
\def\@secnumfont{\bfseries}
%formatage des sections
\renewcommand\subsubsection{\@startsection{subsubsection}{3}{0pt}{6pt plus 2pt minus 2pt}{-.5em}{\normalfont\bfseries}}
\renewcommand\subsection{\@startsection{subsection}{2}{0pt}{6pt plus 2pt minus 0pt}{-.5em}{\normalfont\bfseries}}
\renewcommand\section{\@startsection{section}{1}\z@{0pt}{18pt plus 2pt minus 2pt}{\clearpage\normalfont\bfseries\centering}}
%\renewcommand\section{\@startsection{section}{1}\z@{24pt plus 2pt minus 2pt}{24pt plus 2pt minus 2pt}{\normalfont\bfseries\centering}}
%lignes de points TOC
\newcommand\@dotsep{2}
%\def\l@chapter{\@tocline{0}{0pt}{0pt}{}{}}
%formatage numérotation TOC
\def\@seccntformat#1{\csname the#1\endcsname.\,}
%no indent after theorem like environments
%\def\@endtheorem{\endtrivlist}
%ajuster les hauteurs d'indices
%\newcommand{\raisemath}[1]{\mathpalette{\raisem@th{#1}}}
%\newcommand{\raisem@th}[3]{\raisebox{#1}{$#2#3$}}
\makeatother


I have tried to use it with --include-in-header option of pandoc but it failed with :

LaTeX Error: Command \@dotsep already defined.


So I replaced

- \newcommand\@dotsep{2}
+ \renewcommand\@dotsep{2}


Now I have the following error:

LaTeX Error: \tocsection undefined.


Can anybody help me understand what I am doing wrong?

• Try ‘\renewcommand‘ or ‘\def‘ instead. – Weißer Kater Oct 7 '19 at 11:22
• Thanks @PhelypeOleinik that did the trick... for that one... I have updated my question. – Dimitri Kopriwa Oct 7 '19 at 11:29
• Sorry, I have updated it once again with proper sourc e – Dimitri Kopriwa Oct 7 '19 at 11:32