0

I want to add dots in my table of contents, and modify its size. I know there were tons of questions in the style, but I'm incredibly dumb. I don't even know what the \begin command do. I also want to change the language. I don't want it to write "contents" but "table des matieres" which is in french.

Here are my 2 lines

\newpage
  \tableofcontents
  \addtocontents{toc}{~\hfill\textbf{Page}\par} 

Please tell me what I should add and where. I tried many stuff, and I don't have time in front of me to learn latex.

Thank you very much

2
  • Welcome to TeX.SE... Can you elaborate your question with a required screenshot or something else...
    – MadyYuvi
    Mar 20 '20 at 11:35
  • The titletoc package, which comes with titlesec, but can be used independently, has a \dottedcontents command, and other tools to format the title of contents. See §6, pp. 14–20 of the titlesec documentation.
    – Bernard
    Mar 20 '20 at 12:02
1

Inspired by @Bernard's comment and borrowing from Overleaf and @cmhughes' answer to a similar question:

\documentclass[french]{article}

\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{babel}

\usepackage{titletoc}

% \dottedcontents{<section>}[<left>]{<above-code>}{<label width>}{<leader width>}
\dottedcontents{section}[0em]{\bfseries}{2.9em}{1pc}
%\dottedcontents{subsection}[5em]{}{3.3em}{1pc}

\begin{document}

\tableofcontents

\vspace{2cm} % Add a 2cm space

\begin{abstract}
Ceci est un bref résumé du contenu du document écrit en français.
\end{abstract}

\section{Section d'introduction}
Il s'agit de la première section, nous ajoutons des éléments supplémentaires et tout sera correctement orthographiés. En outre, si un mot est trop long et doit être tronqué, babel va essayer de tronquer correctement en fonction de la langue.

\subsection{Subsection}

\section{Section théorèmes}
Cette section est de voir ce qui se passe avec les commandes de texte qui définissent.

\end{document}

Output:

enter image description here

0

I don't really know what you are after: what does "changing size" refer to; where do you want to add dots?

However the tocloft package is the answer. Below is an MWE that shows how it can be used.

% tocprob4.tex SE 533373 Customize ToC, dots and size
\documentclass{report}
\usepackage{lipsum}
\usepackage{tocloft}
\renewcommand{\contentsname}{table des matieres} % change the title
\renewcommand{\cftchapdotsep}{\cftdotsep} % add dots for chapters
\renewcommand{\cftsecdotsep}{10} % increase space between dots for sections
\renewcommand{\cftdot}{\ensuremath{\ast}} % replace dots by asterisks
%\renewcommand{\cftdot}{\Large .} % make dots Large

\begin{document}
\addtocontents{toc}{\hfill \textbf{Page}\par} % put Page above page numbers
\tableofcontents

\chapter{A chapter}
\lipsum[1]
\section{A section}
Some text in a section.
\subsection{A subsection}
Some text in a subsection.
\end{document}

Read the documentation (texdoc tocloft) for more information.

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.