Cross-referencing documents

I have a question about cross-referencing chapters. It is probably best to spell out what I am doing so as to explain the question.

Each chapter is a Level 2 folder, and I have defined, under compile, a prefix “Chapter <$n:chapter>”. To create references of the form, “This will be discussed in Chapter 7 below”, I create entries such as "This will be discussed in Chapter <$n#chapter:[drop folder here]>, or to reference backwards “As I said in Chapter 2”, create “As I said in Chapter <n:chapter:[drop link to folder here]>”. This seems to work.

However, the problem comes when, as is inevitable, I decide to rename or change the order of chapters, as if I do this, the cross-references become unlinked and either default to 1, or are frozen at what they were before the changes (I have not tested to see which it is). Is there a way round this problem, or am I creating, or referencing, my chapter numbering incorrectly? I move documents around a lot - one of the big advantages of using Scrivener.

The only solution I can see is to stop using using prefixes to number chapters, and insert chapter numbers and titles into the main text, and stop using Folder/document names as chapter titles. This works, and the ability to include text in folders is useful here. I can then have, for each chapter, a number in the form <$n:chapter:childhood> so that the tag (which is memorable, but not necessarily the same as the chapter title) remains unchanged even when the document is renamed. (Treat chapter numbers as I would table and figure numbers.) This seems to work, but it seems unsatisfactory, as it bypasses what seems a powerful feature of Scrivener (using document prefixes).

What would be even neater, if I could do it, would be to have a bookmark, and then a crossreference such as <$n#chapter:bookmarkname> that cited whatever value the variable <$n:chapter> had where the bookmark appeared. That way, a piece of text could be moved from one chapter to another and the correct chapter number would still get picked up. Is this possible? My guess is that it is not, and when I move a document from one chapter to another, I need to change any cross references to the chapter it is in manually.

Sorry if I am missing something obvious or this has been answered in another post or the manual.


The easiest way to do this is to use Scrivener links for the cross-references without worrying about adding any autonumbering tags in the text, and then using the “Update titles in document links with prefix and suffix settings” options in Compile, which can then automatically add the title prefix to any links during Compile. This will get you most of the way. The problem with this approach currently, though, is that it always includes the chapter title, so you would get “See Chapter 4 - Subtitle” rather than simply “See Chapter 4”. However, I have just added an option for the next update that will address this, “Only use title prefixes in updated links”. This will do exactly what you want. You would then be able to just use internal links without worrying about numbering, and these internal links will get replaced with “Chapter X” during Compile (provided your prefix is set up as “Chapter <$n>” or whatever - if the prefix is just the chapter number, then you would type “Chapter” before the internal link).

Hope that make sense. There’ll be a public beta made available in the “Beta Testing” forum that includes this enhancement within the next week or so.

All the best,

Thanks. This is helpful, as I had not understood the “Update Scrivener Links”. Presumably all documents in a Scrivener project have a invisible ID, to which the link is made, and visible filenames are just for human consumption. So if I rename “oldname” to “newname” and later create a new document called “oldname”, a scrivener link will still be to the file it originally referred to.

In case it is useful for anyone else reading this (I cannot be the only person who has found this difficult), and in case I have misunderstood, I recap. Perhaps you could tell me whether I am right.

(1) I use prefixes such as <$n:chapter> in my level 2 headings (the folders that correspond to chapters.

(2) If I want to cite “As in chapter n”, cross referencing a particular chapter, then I can use a scrivener link, dragging and dropping the document name from the Binder into the document. This continues to link the same document whatever changes are made to the visible document names. (That is, if I use the forthcoming release and choose the correct option.)

(3) If I want to cite the number of the chapter in which the sentence I am currently writing happens to be located when the project is compiled, I can do so as <$n#chapter>.

(4) (A conjectural postscript on something I haven’t tried) If I want to number figures and tables in the form “2.1” where the first digit is the chapter number, I could make the figure header contain <$n#chapter>.<$sn:figure:firstfigure> (so that it resets each chapter) and citations of that figure as <$n#chapter>.<$sn:figure:firstfigure>, or would the figure digit have to be reset manually each chapter because the chapter number is <$n:chapter> and not just <$n>? [As I move material around a lot, I would like to be able to create tags that pick up whatever happens to be the current chapter number.]