6

Say I'm writing a text:

* Animals

There are many of them in the wild.

** Examples of animals :noexport:
- Dogs
- Fish
- Triceratops

# I'd like the subheading to end here!! Following sentence should belong to outer scope. 

Animals are not the same as plants.

* Plants

There are also many of them in the wild.

I'd like my subheading Examples of animals in the example above, to end after - Triceratops, and all further text to continue on the parent heading Animals. Currently, if I cycle visibility and hide Examples of animals, then all text below it will be hidden up entil the next heading.

How can I force to prematurely end a headline?!

If this functionality is not implemented in org-mode, how can I insert structured text in the middle of a heading and selectively hide (org-cycle) it?

  • 2
    Pretty sure you can't. – Dan May 29 '17 at 14:09
  • Any alternatives to insert structured text in the middle of a heading and selectively hide it? The solution need not consist of a subheading – dangom May 29 '17 at 14:16
  • 1
    An example block #+BEGIN_EXAMPLE...#+END_EXAMPLE would seem more appropriate here. – Andrew Swann May 29 '17 at 17:11
4

As others have mentioned, org-mode is strictly hierarchical. Once you begin a headline at a certain level, nothing ends it except a new headline. You can't return to the previous one. If you want a certain chunk of text in the middle of a section to be set off and foldable you want a block; use either an example block or a source block (with org as the source language):

#+NAME: examples-of-animals
#+BEGIN_EXAMPLE
- test 1
- test 2
#+END_EXAMPLE

EXAMPLE blocks are exported literally. If you want formatted export (and to control whether it exports at all) use a source block:

#+BEGIN_SRC org-mode :exports none
** Examples of animals
  - test 1
  - test 2
#+END_SRC

http://orgmode.org/manual/Working-with-source-code.html#Working-with-source-code In this case the :exports none option causes the block to not be exported, but it will be editable as normal org-mode text.

3

That cannot be done: org-mode imposes a strictly hierarchical structure on the document. As a possible answer to your last question, you may be able to use inline tasks - see the Org-mode FAQ for more info.

  • Thanks, but inline tasks do not selectively hide, i.e., they still glob the contents until the next heading comes around. – dangom May 29 '17 at 23:51
2

You may be able to use an inline task for this. It is like a headline but usually 15stars deep. It is not part of the outline hierarchy.

  • I didn't know about inline tasks. They are cool but they still obey the org-mode structure, i.e., they'll still glob all content until the next heading comes around. – dangom May 29 '17 at 23:53
  • You need to add an END at end of a 15 star headline to make it like a drawer. See orgmode.org/w/?p=org-mode.git;a=blob_plain;f=lisp/… – John Kitchin May 30 '17 at 11:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.