Preserving internal links when exporting to files

I don’t know why you’d put it that way. :slight_smile: I think Scrivener is one of the best platforms for producing LaTeX—whether directly or via conversion with Pandoc/MultiMarkdown. It’s safe to say that most anything I write in Scrivener, if I intend to make a PDF of it, ends up going through LaTeX.

But to get to the point: you are correct in that Scrivener’s format is tuned more toward recovery out of desperation than providing a completely open and usable file repository at all times, or to serve in and of itself as a human-friendly backup. It’s more that if in a worst case scenario, you at least wouldn’t be extracting data out of an arcane database or locked into the format with proprietary binary files. For myself, and anyone with a little scripting knowledge, if I were in the position of having to recover data from a Scrivener project, the way to go would be to write a simple XML trawl on the master .scrivx file—that’s where you would get the metadata and ID mappings, and from there assemble the files into a useful but simplified structure from that same script. This could even resolve links with a small amount of digging into RTF syntax.

That aside, and to get more to heart of what you’re looking for, it sounds to me as though the compiler is going to be a better tool for you, and perhaps the only reason you haven’t gone down that path as yet is on account of how it is generally designed to produce one document from the outline, rather than many documents from the outline. That however is in and of itself only a surface limitation.

You may be interested in this previous conversation. The example project I provided there includes all of the necessary automation to make it work, and should be able to serve as a sufficient proof of concept. It’s not going to do exactly what you want, as I understand it, but it might be a good starting point. I think the main thing you would want to have done differently is to have it work from the Plain-Text output rather than through Markdown, where the latter is then converted to LaTeX. It sounds to me more like you’re using Scrivener to compose LaTeX directly.

And so this is how internal links would be resolved, since the compiler of course has the necessary technology to turn them into something useful outside of Scrivener. For LaTeX, they would end up being useful in an \autoref sense, where they point to the individual sections they were meant to. But I strikes me that it wouldn’t be impossible to create file:// links, it would probably take a little scripting to manage where files are going and being named, but I can’t think of anything that would get in the way of doing so.

I guess the main question is how set you are on using RTF to archive LaTeX material. To me it seems like that wouldn’t be terribly useful, and would impose additional difficulties down the way, but I’ve never been a huge fan of the RTF format for various reasons. I’d rather archive in plain-text (typically with some kind of markup in it).