How to exclude a section from the TOC?

I am preparing a template for the final year project for my students. I use the book style and included an acknowledgment section*. But I don’t want it to appear in the TOC, which appears after it. The section macro has Toc next and Toc prefix options, but I didn’t find help on them.

Please try the following definition; it looks like a section, but it does not add an entry in the Table of Contents.

<assign|section-no-toc|<macro|title|<assign|section-numbered|<compound|section-display-numbers>><assign|section-prefix|<macro|<compound|the-section>.>><compound|next-section><compound|section-clean><compound|section-header|<arg|title>><if|<value|section-numbered>|<compound|section-numbered-title|<arg|title>>|<compound|section-unnumbered-title|<arg|title>>>>>

I did it by guessing, starting from the definition of section which I found with the Macro Editor. I hope that it works, id est I do not know if everything, except the inclusion in the TOC, works like for a default section. In particular I did not try referencing and I did not try the “smart reference” packages preview-ref and smart-ref.

You could also temporarily redefine the section-toc macro to do nothing:

<\with|section-toc|<macro|name|>>
<section*|Acknowledgements>

My infinite gratitude goes to X and Y<text-dots>
</with>
2 Likes

It looks to me that this risks less than mine to “break something”. So I would use this, and not my way.