I could probably use the line of code you kindly wrote for me.
If I understand well, what you suggest is I could leave a placeholder for the moment…
Honestly this is my preference no matter, because I am a firm believer in keeping formatting decisions out of the data—and numbering styles are a form of formatting. It’s one reason I use Markdown, because for me a cross-ref looks like this while writing, [Name of Binder Item], and that’s it. I’m not thinking about what that looks like, just what the intent is. What it looks like comes later after compiling.
So using a Replacement (which you can read all about in §23.4.4, Project Replacements, and also §24.14) can give you a similar level of abstraction that Markdown-based writing methods do: where writing is much simpler and you aren’t having to dwell on and perfect implementation details while writing.
You can type in, let’s say, #[namewithoutspaces]
, and link it like you would a placeholder, and have it turn into something more like that long code example (which as you note, isn’t meant work out of the box).
I was mainly showing that you can make your own custom <$hn>
marker and do whatever you want with it. You can get past the bug in this way… but another thing to consider is that if you use replacements instead of literal placeholders in your text, you may be able to just in the end have the replacements output <$hn>
, if the bug gets fixed by the time you compile.
I.e. maybe don’t worry about reinventing what that placeholder does until you need it, if the bug isn’t fixed when you need it.
“Referencing” counters is what I was already doing, I supposed, but “incrementing” counters, I have no idea what you mean.
That makes sense, since you’ve been using a placeholder that isn’t a typical incrementing numbering tool but one that simply reports the position of where it is used, or where it links to. There is a difference though between these:
<$n:chapter:chapterone>
<$n#chapter:chapterone>
The first line will increment the $n counter the first time that specific named instance (‘chapterone’) is used. The second will not. It is a pure reference, and thus can be used to refer to chapter one before chapter one occurs in the text. So all around it is safer to use the second line for references no matter where they are, in case things get moved around.
So that first punctuation mark after the counter type is the key, and that should help explain why some of my example had those, while the last part had a colon. For an actual cross-ref to that section we’d want hashes across the board.
All this is a bit more complicated than I expected, but I still think it is worth it, still much better than waiting until I have 400 pages and going through all the references afterwards. Initially, that is what I had thought of doing, so I had written “part??” each time… :-/
True, though it really depends on what you need and how long you intend the output document itself to be “alive” for. Scrivener’s approach is kind of… “dumb” let’s say, in the sense that the result is exactly like having gone through and typed in the numbers by hand. If this document needs to live on after you compile it, for years maybe, and survive multiple rounds of revision and editing—maybe manually typed in chapter numbers and such is a bad idea, for all of the obvious reasons we would want to avoid doing that in Scrivener too.
It might be worth it, in that case, to deferring all of that to the stylesheet and marking down where actual cross-ref fields should be inserted as opposed to text that statically says, “1.2.3 King of the Hill”. It will mean more work when you’re done with Scrivener for this particular project, but it will mean a document that isn’t static and dependent upon Scrivener after that point.
This isn’t a choice you have to make up front though if you make use of the concept of abstraction. If you aren’t going to use a writing method that has that concept built in, like Markdown, then Replacements are the key to keeping your work flexible, where the implementation is something the compiler does to the source.