# [texhax] Adding "\section*" entries to TOC

Jerry jerry at seibercom.net
Sun Jun 2 12:18:12 CEST 2013

On Sun, 2 Jun 2013 09:29:53 +0200
jfbu articulated:

> Le 2 juin 2013 à 02:51, Reinhard Kotucha <reinhard.kotucha at web.de> a
> écrit :
>
> > On 2013-06-01 at 21:58:52 +0200, jfbu wrote:
> >
> >> If you insert
> >>
> >> \setcounter{secnumdepth}{0}
> >>
> >> at the beginning of the body of the document, and use \section{FOO}
> >> without the star, then the TOC will display the (unnumbered)
> >> section entries.
> >
> > I assume that with "body of the document" you mean everything
> > between \begin{document} and \end{document}.
> >
> > You can do this alraedy in the preamble of the document.  The
> > default value is set in the document class file.
>
> Not knowing which class was used by the OP, I said that as a
> preemptive measure in case some package, or the class, did things
> using \AtBeginDocument (or \AtEndPreamble if etoolbox is used).
>
> It is indeed probably cleaner to insert this instruction in the
> preamble.
>
> Assuming of course (as is a kind of rule in LaTeX concepts of the
> look of a document) that the user does not wish to change the
> value midways through the document, then there would not be much
> ground to put the first such instruction mandatorily in the preamble.
>
> >
> > A basic idea of LaTeX is to separate content and layout.  Thus, no
> > layout instructions should be inserted after \begin{document}.  In
> > some cases it cannot be avoided but in these rare cases the macro
> > \AtBeginDocument can be used.
> >
> > The ability to keep content and layout separately is an invaluable
> > feature of LaTeX.
>
> ? well it is a feature, realized to /some/ extent.
>
> And observe how it (of course one may change it forcefully)
> rigidifies the layout at the start. I don't
> want to start a war about the pros and cons, but I will just
> say that I have observed again and again that masters
> systematically forget the amount of sacrificing any apprentice
> has to do with respect to initial expectations:
>
>    software is exemplary in that regard: learning to use a
> software is learning not to repeat the naive things which
> ended up in failure but could have worked. After a while, the
> better learners do not attempt anymore anything which reveals
> a failure of the software and then, they have learned it.
>
>    for the more alert, life is like learning step by step that
> everything, starting with language, is ultimately a lie. The more
> alert is seldom the happier guy.
> >
> >> Subsections will not be numbered too, and you can control with the
> >> tocdepth counter if they appear or not in the TOC
> >
> > If you've set up tocdepth to a value which prevents sections to
> > appear in the TOC, the only way to get subsections into the TOC is
> > to use \addcontentsline.  "tocdepth" works from top to bottom.
> >
> > Regards,
> >  Reinhard
>
> agreed of course,
> it was sort of tacit here that the OP would not set tocdepth
> to a value preventing even sections to show.
>
> regards,
> Jean-Francois

The document class is "report" and no, I do not have any special or
fancy entries in the preamble. Actually, I do use the package
"fancy",but that is another story. I am also not even sure what the
macro "\AtBeginDocument" is referring too. I am a very new user of
LaTex, as you might have discovered, although I have used MS Word, all
versions, extensively for well over 10 years. I am currently using the
MiKTeX distribution on an MS Windows machine. Most of my writings deal
with legislative and/or government actions.

--
Jerry ♔

Disclaimer: off-list followups get on-list replies or get ignored.