On Tue, Sep 19, 2017 at 10:49 AM Kaushal Modi wrote: > Can we enforce the TOC generation using the "toc:" option. Below does not > work at the moment, but would like that to work. > > #+OPTIONS: num:nil H:4 toc:4 > Above works after the below patch: diff --git a/lisp/ox.el b/lisp/ox.el index 2be77a87b33..1831432df87 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -5227,7 +5227,8 @@ Footnote sections and unnumbered headlines are ignored." (org-element-map (org-element-contents scope) 'headline (lambda (headline) (unless (or (org-element-property :footnote-section-p headline) - (not (org-export-numbered-headline-p headline info))) + (and (null (plist-get info :with-toc)) + (not (org-export-numbered-headline-p headline info)))) (let ((level (org-export-get-relative-level headline info))) (and (<= level n) headline)))) info))) But I am pretty sure that's not the right way as the default value of org-export-with-toc is t. -- Kaushal Modi