Compiling for Latex

I am transitioning to Scrivener 3. My process is to compile for Latex using the MultiMarkdown → Latex option. Previously in Scrivener 1, this would produce several different .tex files in the selected directory (main document, header, footer, etc.). In Scrivener 3, compiling seems to produce a folder containing the .tex files. From a Latex standpoint this is counterproductive, because compiling in Latex typically requires many other files – library, images, other .tex files to be added – to be in the working directory. Is there a way in scrivener 3 to create the .tex files without creating a new folder?

The previous behaviour was actually always a bug. It has always been meant to create a folder whenever the compiler is scheduled to produce multiple files. This is done in order to produce the least surprising and disruptive effect. Imagine compiling into your main Documents folder and unwittingly spamming it with 750 image files, .tex files and so on. You’d have a huge mess to clean up, and would have to mentally remind yourself to always create an empty folder first, before choosing a spot to compile. (Granted, you’ve trained yourself to think otherwise, but hopefully you see where we are coming from with that.)

But you aren’t stuck with that approach, and along with fixing this bug we have added ways to override that behaviour and indeed spam the target folder with all the output—just what you want if you’ve got a bunch of .sty files and other ephemera ready for the output. LaTeX is not the only one that benefits from this, HTML, with its .css, .js and other potential includes also can benefit from having a static staging folder.

You can read about this in the user manual PDF, under §21.5.1, Compile Folder, in the chapter on Markdown. But something worth noting is that if you don’t rename the original compile folder and just keeping picking “my_project.tex/my_project.tex” as your overwrite location, it should work without modification—i.e. you won’t get an infinitely nesting sequence of folders.

By the way, you may have already noticed, but the version of MMD in the old version was fairly ancient, as I recall. We’re using the latest MMD build (6.6.0) in Scrivener 3, which may do things a little differently with regards to setting up .tex boilerplate files. That may not impact you, as it sounds like you’ve been relying on Scrivener’s stock settings to do that for you though, and those have of course all been modernised internally.

But if you do start making your own boilerplate, it’s worth noting it is a lot easier now. You only need to throw one metadata keyword in: LaTeX Config: template_basename. This is automatically extrapolated into \input commands for you, with the right placement:

\input{mmd6-template_basename-leader}
% MMD metadata variable output
\input{mmd6-template_basename-begin}
\input{mmd6-template_basename-footer}

So if you name your three files thus, with ‘.tex’ extensions, then it should all work without any further messing around. The old metadata system was a lot more troublesome to set up.

1 Like

I see, thanks…I think I have mostly figured this out, though still getting used to it.