Additional prefixes for _some_ titles

In my workflow I use Scrivener to compile into plain text and I need to have an additional prefixes for some titles.

Here is how the project looks in the Binder:

Foo
Bar
  Aaa
  Bbb
Baz
  Ccc
  Ddd
Xyz
Zyx

And here is how it should look in the compiled form:

[preface]
= Foo

foo text

= Bar

== Aaa

aaa text

== Bbb

bbb text

= Baz

== Ccc

ccc text

== Ddd

ddd text

[appendix]
== Xyz

xyz text

[appendix]
== Zyx

zyx text

Foo is a preface, Xyz is a first appendix, Zyx is a second appendix.

Of course, this example is very basic. In real life the document will be much larger.

The key point is that I cannot understand a way to add these [preface] and [appendix] labels to the target titles. I tried to find some good workaround, but the only one which really work is very inconvenient:

to add the label as the last line of the previous text.

E.g. the label [appendix] should be the last line of Ddd.

Are there any better workarounds for it?

Have a look at the Formatting compile option pane. You can set up “rules” that export your structure based on its hierarchy and item type (folder/file/file group). One of the tools available to you is a title prefix and suffix, accessible by clicking on the Section Layout… button for the selected level.

So that could in fact do the ‘=’ prefixes as well, making your outline more dynamic if you’re typing those in by hand at the moment. As for getting some material on the previous line, you can use tabs and returns in these prefix/suffix files, so multi-line titles are no problem.

At the moment this is the extent of what you can do, level-based structure. In v3 you’ll have access to a hybrid system, one that can be level-based, but allow for breaking the rules on a per item basis. This will all be done by a formal semantic typing system—in other words you would be able to say, “this item here is an appendix entry”, and then set up a rule in the compiler that adds the [appendix] tag as a prefix.

But for now think of using the three-type distinctions to give you extra “types” as well as artificial outline structuring (like putting all preface items into a subfolder merely to bump them down a level).