0

While exporting following sample org file content to html, final output skips headings from 3rd depth in table of content.

After reading org documentation, and forum questions, I tried following, but still no luck in exporting all sub headings.

  1. Changed org-imenu-depth to 4
  2. Changed imenu-auto-rescan to a non-nil value
  3. Chanaged imenu auto rescan maxout to 600000 as file size is 400 KB.

Sample:

* Head 1 shown
* Head 2 shown
** Head 2.1 shown
*** Head 2.3 not shown
* Head 3

Emacs version: GNU Emacs 26.1 (build 1, x86_64-w64-mingw32) of 2018-05-30

Org mode 9.1.9

msinfo
  • 177
  • 1
  • 6
  • 1
    Try inserting `#+OPTIONS: H:3` at the top of the org file. – Tobias Jun 13 '19 at 15:22
  • Tried, but seems not working. – msinfo Jun 13 '19 at 15:25
  • What `emacs version`, what `org-version`, have you tried with `emacs -Q` and `M-x package-initialize`? – Tobias Jun 13 '19 at 15:27
  • Emacs 26.1 and Org 9.1.9 – msinfo Jun 13 '19 at 15:37
  • And I am running Emacs from its graphical version(on Windows) , and not console. – msinfo Jun 13 '19 at 15:41
  • 1
    What is the value of `org-export-headline-levels`? Note, that `org-export` has (AFAIK) nothing to do with `imenu`. Pitingly, that means that all your attempts are pointless with respect to html export. You can start `emacs -Q` from within emacs. Just use `M-& emacs -Q`. This is just for testing. (So you do not need the `runemacs` stuff. Just ignore the additional Windows window.) After starting up Emacs run `M-x package-initialize` and afterwards do your tests. – Tobias Jun 13 '19 at 15:50
  • Thanks @Tobias following worked. Changed org-export-headline-levels value to 5, removed #+OPTIONS: H:3 from top, and then restarted Emacs. Can you write down it in answer, so I can mark this as answered. – msinfo Jun 13 '19 at 17:06
  • `imenu` option was mentioned in following questions https://emacs.stackexchange.com/questions/9533/speedbar-and-org-mode-only-shows-subheadings-but-not-3rd-level-subheadings and https://emacs.stackexchange.com/questions/20759/all-org-subheadings-in-imenu – msinfo Jun 13 '19 at 17:13
  • Adding the `#+OPTIONS: H:5` line and then *reevaluating with C-c C-c on that line* should be enough. Alternatively, you could restart emacs instead of reevaluation but that is less desirable. The option does exactly the same thing as setting `org-export-headline-levels` except that it is specific to this file: setting the variable changes it for *every* file. – NickD Jun 13 '19 at 17:22
  • 1
    @msinfo: those references to `imenu` (and `imenu` in general, as @Tobias points out) have nothing to do with HTML export – NickD Jun 13 '19 at 17:26
  • True @NickD, it seems I was so focused on subheading word, that I missed its context in asked questions. Thanks for clarifying. – msinfo Jun 13 '19 at 17:54

1 Answers1

2

org-export-headline-levels is the option determining up to which level headlines are included in the table of contents of the exported document.

The standard value of org-export-headline-levels in Orgmode 9.1.9 is 3.

I tested your example org file with this standard setting and Head 2.3 was also included in the table of contents. That indicates that you have customized org-export-headline-levels to a lower value in your configuration.

You can easily increase the default value for org-export-headline-levels with M-x customize-option RET org-export-headline-levels RET.

All org documents will work with this default value if you do not set the value of org-export-headline-levels explicitly in the document.

You can set the value explicitly locally for one org document with a line like the following:

#+OPTIONS: H:5

Adapt the value 5 to your likings.

Equivalently you can set the option as file local variable:

  1. Either use the following first line for the org file:
    # -*- org-export-headline-levels: 5 -*-

  2. or append the following section to your org file. It does not hurt since it is excluded from export.

    * Local Variables :noexport:
    Local Variables:
    org-export-headline-levels: 5
    End:
    
Tobias
  • 32,569
  • 1
  • 34
  • 75