Section numbering and cross-referencing

Hello, I am pretty new to Scrivener, and very enthusiast!

I am currently trying to figure out how to auto-number sections and refer to them by their number. This must be possible as the manual is full of this kind of referencing, but I am not clear how this is done (I assume, of course, that the manual was written in Scrivener).

Most journals to which I submit articles expect that I have organized my paper roughly in the following way:

                    Titel of the paper
Introduction
1. Background
2. First argument
    2.1 Intro to the first argument
    2.2 The first argument
    2.3 Possible objections against the first argument
    2.4 Summary of the first argument
3. Second argument
    3.1 Intro to the second argument
    3.2 The second argument
    3.3 Possible objections against the second argument
    3.4 Summary of the second argument
4. Conclusions
References

My first problem is how to get the numbering of the subsections correct. When I instruct the compiler to add the prefix '<$n>. ’ to the title of the first level folders and '<$sn> ’ to the title of second level folders, the sections are numbered fine, but the subsections lack the section number, for example Section 2 looks like this:

2. First argument
    1 Intro to the first argument
    2 The first argument
    3 Possible objections against the first argument
    4 Summary of the first argument

I assume that it is possible to use the n variable without increment (so that I can use '<$nn>.<$sn> ’ as a prefix for the titels of second level folders and <$nn> is replaced by n during compilation, but n is not increased)), but I can’t find the relevant place holder in the list.

My second problem is how to refer to sections by their number. I am supposed to end the introduction by explaining the structure of the paper (‘In Section 1 I explain my thesis. In Section 2 I give the first argument for my thesis. In Section 3 I …’) and I need to refer to what I have said in the course of the paper (‘As I explained in Section …, …’).

When I make a Scrivener link (‘In Section First Argument I give the first argument’) the prefix is added during compilation (the result is ‘In Section 1. First Argument I give the first argument’).

How do I instruct the compiler to replace the link with the section number instead of the prefix and the title?

I am probably missing something obvious. Please, help me out!

The manual (which is yes, written in Scrivener) uses the MultiMarkdown system, which has a system for cross-reference built into it, so that is how I can insert a proliferation of forward and backward references. In the manual, a cross reference looks like:

For more information, read [Using Collections][].

The “Using Collections” binder item, when compiled, turns into the MMD code for a header:

## Using Collections ##

Which when converted to LaTeX looks like:

\chapter{Using Collections} \label{usingcollections}

And the original cross-reference becomes:

 For more information, read Using Collections \autoref{usingcollections}

So as you can see it handles all of the labelling and connective code for you, just by calling something “Using Collections” in the binder, and by putting brackets around it in the spot you want to cross-ref.

Setting that aside though (because MultiMarkdown is a whole different way of writing, and if it interests you feel free to dig in, but you’ll have to be prepared to write in simple syntax for the whole thing, all the way down to italics) you can do what you want up to a point. For one, I would recommend using the <$hn> token all by itself instead of trying to build it from scratch with <$n>.<$sn>. <$hn> is nicer because it compacts to a single numeral at the top level, and all items beneath it use that numeral in their numbering. So a chapter gets assigned ‘5’, and the third section beneath it, ‘5.3’, and there is a sub-section, ‘5.3.1’, all with that one code. That’s handy as it means fewer rules in the Formatting compile pane.

But just in case that doesn’t work for you, there is a way to do parallel counter streams and fixed counter numbers. The alternate syntax is <$n:stream:item>. A practical example might be, “<$n:chapter:firstArgument>”. The first time the compiler comes across that, it will assign it the next numeral in the counter, but the second time it encounters it, it will use the already assigned number. So as you can see, this works great for back-references. Forward references don’t work as well because it increments at the first instance, so the cross-reference would increment the counter and the section number itself would use the already established number for that token ID. You can drop the item ID part of the syntax to just do parallel counter streams, like “<$n:chapter> <$n:section> <$n:chapter>”, too. If you pasted that into Scrivener and compiled, you’ll get “1 1 2”. The section stream is independent, and the second chapter stream increments the counter.

What you are doing here is actually the best trick for cross-referencing because it works for both forward and backward references. You just need to set up the formatting pane to handle that way of working, and put the token in the prefix as well. If you don’t want “Section” in the title, just put "<$hn>: " into the prefix, and cross-ref it like, “(the result is in section First Argument)”. That will come out as “(the result is in section 2.5: First Argument)”.

One more trick there, you can also Scrivener Link a “<$p>” token to get the page number for the target. So, “(the result is in section First Argument; pg. <$p>)” will compile to “(the result is in section 2.5: First Argument; pg. 83)”.

Thanks for your explanation Amber!

.

Ah, that explains much. I feel a little less stupid for not figuring out automatic numbering myself, :slight_smile: (on the other hand I feel a little more stupid, because I suddenly recall that the manual says that it is written using the MultiMarkdown system :blush: )

Unfortunately I will not be able to use MultiMarkdown, because my co-authors will find it too difficult. I feel very lucky that I could convince them to use Scrivener, but MultiMarkdown will be a bridge too far.

Okay, that works fine. Thanks!

I tried that before posting, but it didn’t work. It produces the following kind of numbering:

1. Background
1. First argument
    1.1 Intro to the first argument
    1.1 The first argument
    1.1 Possible objections against the first argument
    1.1 Summary of the first argument
1. Second argument
    1.1 Intro to the second argument
    1.1 The second argument
    1.1 Possible objections against the second argument
    1.1 Summary of the second argument

Exactly, that is why it doesn’t work!

Apparently, I haven’t made myself clear enough. I’ll try it again. I want the prefix appear before the title in the section heading (e.g. ‘2. First Argument’), but I only want the number when I refer to that Section (e.g. ‘see Section 2’). So, in your example instead of '“(the result is in section 2.5: First Argument)” I want ‘(the result is in Section 2.5)’.

What should I do to get that?

I knew that trick, but as the page number depends on the physical place in the journal issue in which the article ultimately appears, referring to pages numbers makes no sense. It can be that a section begins in p. 6 in my manuscript and on page 1685 when published! Often even the proofs haven’t page numbers. So, I really need to refer to sections rather than to pages.

Best wishes,

Arno.