3

I'm looking for a way to remove the page number of entries that are on the same page.
I would like to avoid having repeated page numbers in the ToC.. but I've found nothing explicit enough.

Here's an example :

\documentclass[12pts, a4paper]{article}
\begin{document}
\tableofcontents
\newpage
  \section{Lorem ipsum}
    dolor sit amet
    \subsection{consectetur adipiscing}
      elit. Donec a diam lectus.
        \subsubsection{Sed}
  \section{sit amet}
   ipsum mauris. Maecenas congue[...]
\newpage
  \section{ligula}
    ac quam viverra[...]
    \newpage
    \subsection{nec}
\end{document}

So here, only the first section, the third section, and the 3.1 subsection ("nec") should have a pagenumber.

fr33tux
  • 31
  • Are you having this because you have too short sections or subsections? – Sigur Nov 07 '13 at 17:46
  • the dots going all the way to the page number should be removed too? –  Nov 07 '13 at 17:54
  • 1
    Does/should this hold for all entries on the same page? So you want to keep the first reference to the page, but not any others? I guess it should at least replicate the page when there's an overflow to the following page, right? How about creating a minimal working example (MWE) for the community to play with, and discuss all the cases that should be handled? – Werner Nov 07 '13 at 18:03
  • The linked question above is nearly the same. However I think the solution is really spare and it's not useful for most users. So closing this question should be avoided (first). – Marco Daniel Nov 07 '13 at 18:05
  • @Fran : Yes, it's the same question, but this topic does'nt help me : there's no handy solution in it.

    Sigur : Yes, but even for a short document or report, it's not pretty. So even if you're right, I can't make them longer..

    jfbu : Yes, the dots should appear only if the entry has a page number.

    Werner : Yes, all entries (part, section, sub(sub)sections..).

    – fr33tux Nov 07 '13 at 18:27
  • @fr33tux I know that the answer to the other question is not satisfactory, but if anyone can give a better answer to your question, it must be answered in the other question. Spread the answers to the same problem on several questions have no sense, but it makes sense to have several questions to find the same problem. So, even if your question is closed as being a duplicate, anyone can still read it and see the link to right place to respond. – Fran Nov 07 '13 at 20:27
  • @MarcoDaniel But according to the philosophy of this site, in this case someone should offer a reward to the former question, or re-edit to make it active, and thus stimulate more/better answers, but not open an identical question. Or have I missed something? – Fran Nov 07 '13 at 21:04
  • Sorry, the other one got a "best answer", so I thought it was not the place to ask :/ @Werner I've updated my first post with a working example. Do you have an way to solve ? – fr33tux Nov 07 '13 at 21:06
  • 1
    I have added an answer to the duplicate question, based on your MWE. – Andrew Swann Nov 08 '13 at 06:50

0 Answers0