I've shared over here - https://www.literatureandlatte.com/forum/viewtopic.php?f=21&t=36854 - some development I'm doing for supporting LaTeX with Scrivener in a more versatile, and faster, way than using Scrivener's own compile. This I've recently started as I started working on my PhD. I've posted it over there in the MultiMarkDown board because originally I was planning to only add my own Markdown flavor.
Turns out, that's now the smaller part of it; the script can do some more things that could be of interest for you:
- Compile any selection of assets from a Scrivener project, in any order, to plain text (and LaTeX), and optionally parse embedded Markdown (TeXDown flavor)
- Rather than having to specify what to include each time, optionally supports the use of configuration files where you can have shortcuts to your collections of stuff, and then just use those.
- Search for any string in any place of a Scrivener project, and also apply regular expressions as you do so
- If you know a document ID of some rtf file of the Files/Docs folder, quickly identify where that is referred to in Scrivener
- List assets of any sub path of anything in Scrivener
- While doing any of these, take into account the "IncludeInCompile" flag hierarchically, i.e., if you temporarily want to exclude something, it is sufficient to set that check mark at some higher level.
All of this is done not using Scrivener's export/compile, which I found very slow, but directly parsing Scrivener's XML (.scrivx) file. It is massively faster, and can be combined on the command line with a whole lot of pre- or post processing - e.g. handing the results down to LaTeX.
This now has quickly turned Scrivener into my preferred writing environment for LaTeX. Before, I had like a mostly static project structure where I cloned, for each new paper I wrote, my "template" and then would stick to its structure of chapters, etc.
Now, I no longer need to do that. I also don't need to use the header and footer options that Scrivener provides for the LaTeX scenario, as these are by far too restrictive if I have more complicated document setups with appendices, etc.
Rather, I keep all my LaTeX content in Scrivener itself, and just pull together what I happen to want to include now in whatever paper I want to write.
Here's the GitHub project for you to use this - feel free to suggest stuff. I'm happy to share and to listen.
I'm also planning to include a sample Scrivener project within that soon - am just cleaning up a bit my 25 year old mess of template - so that you can actually directly start using it in the LaTeX scenario, with an actual project. You can of course use it already right now, but that will make things even simpler.