Compiling different Latex documents from project - customizing metadata filenames

I use the mmd → tex compile option. I want to produce multiple Latex documents from the same project (an academic paper and an appendix). I created a separate project format for the main document and the appendix with the correct metadata for each. The problem is that both files produce latex metadata files with the same names (mmd6-scrivcustom-leader, mmd6-scrivcustom-begin, etc.) This means that the metadata files in the compile folder correspond to whichever document (main paper or appendix) I compiled most recently. Is there a way to customize these metadata filenames so they are different in the different project formats?

I suppose an alternative is to compile to different target folders, but this involves additional project management complications because I then have to sort out which latex sub-documents and images go in which folder, which is a chore. So customizing the metadata filenames would work better in my setup.

I perhaps don’t understand why an appendix would have a different metadata setup than the mainmatter, as MultiMarkdown metadata tends to pertain to the full document, not individual sections within it. So I’m a little confused there, as to why you have these things separated.

If they are meant to be one actual document, as typeset to PDF or whatever, then I would strongly reconsider using separate Scrivener projects for this, and have all of the main matter and appendix together in the same draft folder, all compiling at once.

The Scrivener user manual project demonstrates one way in which you can do this. The “Appendices” group in the draft folder is manually assigned to the “Appendix” Section Type, which is assigned to the “Appendix” Section Layout. That layout prints the following from the Suffix tab:

`\appendix`{=latex}

This is, at least for the document class I use, the LaTeX command I need to switch over to A, B, C major section titling. You’ll note I also put the title manually in there, but that can be ignored as it is a very implementation-specific workaround. (My Parts print LaTeX commands to set the epigraph and attribution commands, for setting the fancy quotes you see in the PDF, as part of the \part command itself. So I need those to print before the title is printed, hence the text being above the title.)

Here is the result of this part of the draft folder, to put it concisely and cut out the fat:

\part{Appendices}
\appendix
\chapter{Menus \& Keyboard Shortcuts}

Well, sorry if I’m not understanding at all, but if you are really basically wanting two “books”, a standalone appendix volume, then you’ll do better by switching off “Custom” in the LaTeX Options compile format pane, to “None (use metadata)”, and then supply the root keyword to use in each project’s metadata, using the “LaTeX Config” MMD key. For example, when you use “Custom”, Scrivener automatically adds this to your metadata block:

LaTeX Config: scrivcustom

Multimarkdown then derives from that the mmd6-scrivcustom-leader (and so on) file naming. Hence if your appendix project uses the keyword ‘appendix’ for LaTeX Config, you would get mmd6-appendix-leader and so on.

You would of course be maintaining your .tex files by hand at that point instead of storing their data in the compile format and having them regenerated, but if you’re like me, that’s nicer anyway since you can use VSCodium or whatever to maintain the .tex files rather than the simple multi-line text field in the compiler.

I’ve written more on making one’s own MMD-friendly .tex boilerplate files in this post, if any of the above is unclear or too brief, you may find answers there (although to be clear that goes more into making your own entire documentclass level setup rather than just forking metadata and maybe a few preamble calls—same concepts apply to both though).

2 Likes

Thanks as always. Your very first point led to the conclusion that I was making this more complicated than it needs to be. The only thing in my .tex files that I really had to change was removing \maketitle from the mmd-scrivcustom-begin file, where I had it. (I don’t want a title page in my appendix document). Other than that I can basically use the same latex preamble. There are some other tricky things, one of which is juggling separate reference lists – my Latex compiler doesn’t always regenerate the bibliography so there’s a chance of ending up with the wrong reference list in the wrong document. But this mostly solves the problem that my question was about.

2 Likes