0

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
%suppression des \vbox underfull badness
\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
\renewcommand{\tocsection}[3]{\indentlabel{\@ifnotempty{#2}{\ignorespaces#1\makebox[\widthof{00.}][l]{#2.}\quad}}#3\dotfill}
\renewcommand{\tocsubsection}[3]{\indentlabel{\@ifnotempty{#2}{\ignorespaces#1\makebox[\widthof{00.00.}][l]{#2.}\quad}}#3\dotfill}
\renewcommand{\tocsubsubsection}[3]{\indentlabel{\@ifnotempty{#2}{\ignorespaces#1\makebox[\widthof{00.00.00}][l]{#2.}\quad}}#3\dotfill}
\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?

12
  • Try ‘\renewcommand‘ or ‘\def‘ instead. – Weißer Kater Oct 7 '19 at 11:22
  • Welcome to TeX.SX! LaTeX's base classes already define \@dotsep, so it's normal that \newcommand raises an error. Try \renewcommand if you want to change the value of \@dotsep. – Phelype Oleinik Oct 7 '19 at 11:23
  • Thanks @PhelypeOleinik that did the trick... for that one... I have updated my question. – Dimitri Kopriwa Oct 7 '19 at 11:29
  • @DimitriKopriwa Make sure that @ is a letter token when you do that. Try \makeatletter\renewcommand{\@dotsep}{2}. However a few lines below in your code you already have \renewcommand\@dotsep{2} again, so I think you don't need to do that again... – Phelype Oleinik Oct 7 '19 at 11:31
  • Sorry, I have updated it once again with proper sourc e – Dimitri Kopriwa Oct 7 '19 at 11:32

Your Answer

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

Browse other questions tagged or ask your own question.