1

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

  • Please provide a real MWE! This is a lot of code to read. I guess such a question could be asked with 5 lines of code. \documentclass{article}\begin{document}\tableofcontents\paragraph{test}\end{document}. Your question is very unclear as it is. Where is the \paragraph you are talking about? – LaRiFaRi Oct 2 '14 at 7:50
  • I just did it. Is it ok? – Simon Oct 2 '14 at 9:02
  • Better, but not compilable. What is \noun coming from? Do we need all these language switches and so on? Wouldn't it make more sense, to put those "paragraphs" in a enumerate environment? And I do not understand your macro \p. You can't give your paragraph a title. And you can not make it starred. – LaRiFaRi Oct 2 '14 at 9:18
  • I tried to put them in an enumerate environment, but I don't want all paragraphs to have a number. The macro \p allows me to choose what paragraph has a number. – Simon Oct 2 '14 at 9:32
  • Basically, I would like to decide what paragraph is in my table of contents. – Simon Oct 2 '14 at 9:33
3

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.

  • This is exactly what I needed. Thanks a lot! Sorry for the poor MWE. I will do better next time. – Simon Oct 2 '14 at 15:54

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.