Ehm, hello, forget about this, this is an issue with mawk(1) which doesn't properly (imho) fflush("") before END{}, resulting in partial output which then irritates mandoc(1) (different to groff(1) which passed over the "EOF" already in it's sequential processing): ?0[]$ awk -v TOC=Ss -f mdocmx.awk < mdocmx.7|mandoc|v ... TABLE OF CONTENTS SYNOPSIS DESCRIPTION Creating a table of contents ... ?0[]$ mawk -v TOC=Ss -f mdocmx.awk < mdocmx.7|mandoc|v ... TABLE OF CONTENTS DESCRIPTION Creating a table of contents ... I've sent a mail to Thomas Dickey regarding this. Sorry for the noise. --steffen