Below is a heading on page 10 starting by an anchored object
When I create my ToC (below), this anchored object is still there. Any idea to get rid of it?
Use Grep find/change to remove anchored objects in your Toc. Find ~a (anchored object marker), replace by nothing.
Pros: super fast
Cons: You need to redo it every time you update the TOC
If not done already, create an object style and apply it to all your anchored objects. It's not absolutely necessary, but will give you better control over all anchored objects, so I recommend you don't skip this step.
Then, go to object style options > anchored object options.
Change position from "inline" to "custom" and adjust position in order to get the same layout than initially. You'll probably have to make a few more adjustments (text warp, left indent, space before...).
The trick is than Indesign kinda "separate" anchored object from text paragraph when the objects aren't positioned "inline". Why? I don't know ^^ but it results that custom positioned objects do not show in Table of contents.
Pros: No need to redo anything while updating TOC. Anchored objects will always be ignored.
Cons: Much more time consuming method than solution 1
Find / Change in the Table of Contents. Find ^a Change to [nothing—keep blank] Be sure to Search within the Story or Selection, whichever makes more sense. Only Search in the TOC, not the document.
Not perfect according to me because not automatic but at least it works. Any other idea appreciated...