[Tex/LaTex] Paragraph numbers and table of contents

numberingtable of contents

I have given a number to some of the paragraphs of my PhD dissertation. But they appear as a \paragraph in the table of contents. I also have "real" \paragraph titles, that I want them to appear in the table of contents.

For the moment, if the "false" paragraphs are \paragraph*, the don't appear in the table of contents but they don't number those paragraphs anymore. If they are \paragraph, they do number the paragraphs, but they appear, as single number, in the table of contents.

Basically, I would like them to appear in the text, but not in the table of contents.

If you have ideas, thanks a lot!

A compilable example, with \paragraph:

\documentclass{memoir}
\usepackage[french]{babel}
\frenchbsetup{FrenchFootnotes=false}
\setcounter{secnumdepth}{5}
\usepackage{chngcntr}
\counterwithout{paragraph}{subsubsection}
\renewcommand*{\theparagraph}{\arabic{paragraph}.}
\newcommand\p{\paragraph{}}

^This is the \paragraph I'm talking about.

\begin{document}

\section*{\noun{\textemdash{} }Section 1 \textemdash \noun{}\protect \\
\noun{Lorem impsum}}

\addcontentsline{toc}{section}{\protect\numberline{}Section 1 --- Lorem ipsum}

\selectlanguage{english}%
\p{}\foreignlanguage{french}{XXXXXXXX}

\selectlanguage{french}%

\subsection*{§1 \textemdash{} Ipsum lorem}

\addcontentsline{toc}{subsection}{\protect\numberline{}§1 --- Ipsum lorem}

\selectlanguage{english}%
\p{}\foreignlanguage{french}{XXXXXXXXX}

\tableofcontents{}

\end{document}

What it is now:
What it is now
What I would like it to be, without losing the numbers in front of the paragraphs in the text:
What I would like it to be

Best Answer

I must say that your MWE is not easy to understand. I just ditched all that code you have there for sections and for French and English. Here is a very simple approach for having some paragraphs appear in the TOC and others not:

\documentclass{memoir}
\setcounter{secnumdepth}{5}
\setcounter{tocdepth}{5}
\newcommand\simpleparagraph[1]{%
  \stepcounter{paragraph}\paragraph*{\theparagraph\quad{}#1}}
\begin{document}
\tableofcontents
\simpleparagraph{normal} paragraph (not in the toc)
\paragraph{special} paragraph that will appear in the toc.
\simpleparagraph{normal} paragraph (not in the toc)
\paragraph{special} paragraph that will appear in the toc.
\end{document}

enter image description

If you make a lot of changes to the layout of sections and the like I recommend the titlesec package.

If this is not what you are looking for I also have to ask you to clean up your MWE to be minimal.

Related Question