0

In reStructuredText, a heading followed by a lower-level heading is read as a subtitle:

Section 1
=========

Subtitle
--------

However, what if I actually want a subsection heading to follow immediately after a section heading? According to the the docs, an empty comment "serves to terminate a preceding construct", but this doesn't seem to apply here, as

Section 1
=========

..

Section 2
---------

still gets turned into a heading for Section 1, followed by a subtitle Section 2 by, for example, rst2latex and pandoc.

Is there another way to prevent "subtitlisation" without writing any actual text between the section and subsection headings?

smheidrich
  • 4,063
  • 1
  • 17
  • 30
  • I think that adding another section title with the same style of decoration as your "Section 2" heading will prevent this heading from becoming a subtitle. In other workds and a new heading, say "Section 3" and use dashes, `-` to denote that it is a heading. "Section 2" and "Section 3" should then be the same heading level. Also, I think you need an additional dash under your "Section 2" heading. It should be at least as long as the title. – Chris Jun 03 '14 at 07:29
  • @Chris: That's a good idea as well, thank you. Why did you post it as a comment instead of an answer, though? Your comment answers my question and isn't specific to some mistake I made or anything like that. – smheidrich Jun 07 '14 at 23:17
  • I was not able to test this, so didn't want to post an answer in case it was incorrect. If this does indeed answer your question then I can post it as an answer. – Chris Jun 09 '14 at 07:46

1 Answers1

1

Nevermind, I figured it out. A backslash followed by a space will work:

Section 1
=========

\ 

Section 2
--------

I got the idea from a tip on Simple Tables in the spec:

To start a new row in a simple table without text in the first column in the processed output, use one of these:

  • an empty comment (".."), which may be omitted from the processed output (see Comments below)
  • a backslash escape ("\") followed by a space (see Escaping Mechanism above)

IMHO this isn't very consistent: The second method works for breaking up title and subtitle, whereas the first one doesn't, as I stated in my question.

smheidrich
  • 4,063
  • 1
  • 17
  • 30